Bird
0
0

Which of the following best describes the output of np.zeros((2, 2)) in NumPy?

easy📝 Conceptual Q1 of 15
NumPy - Creating Arrays
Which of the following best describes the output of np.zeros((2, 2)) in NumPy?
AA 2x2 array filled with zeros
BA 1D array with two zeros
CAn array with uninitialized values
DA 2x2 array filled with ones
Step-by-Step Solution
Solution:
  1. Step 1: Understand np.zeros()

    The function creates an array filled with zeros.
  2. Step 2: Check the shape argument

    The shape (2, 2) means a 2D array with 2 rows and 2 columns.
  3. Final Answer:

    A 2x2 array filled with zeros -> Option A
  4. Quick Check:

    Shape matches 2D zero array [OK]
Quick Trick: np.zeros(shape) creates zero array of given shape [OK]
Common Mistakes:
  • Confusing shape tuple with single integer
  • Expecting ones instead of zeros
  • Assuming 1D array when shape is 2D

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes