Bird
0
0

If arr = np.array([5, 10, 15, 20, 25]), what does arr[-3] return?

easy📝 Conceptual Q2 of 15
NumPy - Indexing and Slicing
If arr = np.array([5, 10, 15, 20, 25]), what does arr[-3] return?
A25
B10
C15
D20
Step-by-Step Solution
Solution:
  1. Step 1: Identify the element at negative index -3

    Negative index -1 is last element (25), -2 is 20, so -3 is 15.
  2. Step 2: Confirm the value at arr[-3]

    arr[-3] equals 15 as counted from the end.
  3. Final Answer:

    15 -> Option C
  4. Quick Check:

    arr[-3] = 15 [OK]
Quick Trick: Count backwards: -1 last, -2 second last, etc. [OK]
Common Mistakes:
  • Counting negative index from start
  • Mixing up index positions
  • Using positive index instead of negative

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes