Bird
0
0

Given a 3D numpy array arr with shape (2, 3, 4), how would you access the element in the second block, first row, and third column?

hard📝 Application Q8 of 15
NumPy - Indexing and Slicing
Given a 3D numpy array arr with shape (2, 3, 4), how would you access the element in the second block, first row, and third column?
Aarr[1, 0, 2]
Barr[0, 1, 2]
Carr[1, 2, 0]
Darr[2, 1, 3]
Step-by-Step Solution
Solution:
  1. Step 1: Understand 3D array indexing

    Shape (2, 3, 4) means 2 blocks, each with 3 rows and 4 columns.
  2. Step 2: Map requested element to indices

    Second block = index 1, first row = index 0, third column = index 2.
  3. Final Answer:

    arr[1, 0, 2] -> Option A
  4. Quick Check:

    3D element access = arr[1, 0, 2] [OK]
Quick Trick: Index each dimension in order: block, row, column [OK]
Common Mistakes:
  • Mixing dimension order
  • Using 1-based indexing
  • Confusing rows and columns

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes