Bird
0
0

Given a 3D ndarray with shape (2, 3, 4), how many total elements does it contain?

hard📝 Application Q9 of 15
NumPy - Fundamentals

Given a 3D ndarray with shape (2, 3, 4), how many total elements does it contain?

A6
B24
C9
D12
Step-by-Step Solution
Solution:
  1. Step 1: Understand shape dimensions

    The shape (2, 3, 4) means 2 blocks, each with 3 rows and 4 columns.
  2. Step 2: Calculate total elements

    Multiply dimensions: 2 * 3 * 4 = 24 total elements.
  3. Final Answer:

    24 -> Option B
  4. Quick Check:

    Total elements = product of shape dimensions [OK]
Quick Trick: Multiply shape tuple values for total elements [OK]
Common Mistakes:
  • Adding dimensions instead of multiplying
  • Confusing shape with size
  • Ignoring one dimension

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes