Bird
0
0

What is the shape of a numpy ndarray?

easy📝 Conceptual Q1 of 15
NumPy - Fundamentals

What is the shape of a numpy ndarray?

AA tuple representing the size of each dimension
BA list of all elements in the array
CThe total number of elements in the array
DThe data type of the elements
Step-by-Step Solution
Solution:
  1. Step 1: Understand what shape means in ndarray context

    The shape tells how many elements are in each dimension of the array.
  2. Step 2: Identify the correct description

    Shape is always a tuple showing sizes per dimension, like (3, 4) for 3 rows and 4 columns.
  3. Final Answer:

    A tuple representing the size of each dimension -> Option A
  4. Quick Check:

    Shape = tuple of dimension sizes [OK]
Quick Trick: Shape is a tuple showing array dimensions [OK]
Common Mistakes:
  • Confusing shape with size
  • Thinking shape is a list
  • Mixing shape with data type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes