Bird
0
0

Which of the following is the correct syntax to create an uninitialized 3x2 array using np.empty()?

easy📝 Conceptual Q3 of 15
NumPy - Creating Arrays
Which of the following is the correct syntax to create an uninitialized 3x2 array using np.empty()?
Anp.empty[3, 2]
Bnp.empty((3, 2))
Cnp.empty{3, 2}
Dnp.empty(3, 2)
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct shape argument format

    NumPy expects shape as a tuple, so (3, 2) is correct.
  2. Step 2: Check syntax correctness

    Subscript notation invalid; curly braces invalid; separate arguments invalid.
  3. Final Answer:

    np.empty((3, 2)) -> Option B
  4. Quick Check:

    Shape argument must be a tuple (3, 2) [OK]
Quick Trick: Use tuple for shape: np.empty((rows, cols)) [OK]
Common Mistakes:
  • Using subscript notation
  • Using curly braces
  • Passing shape as separate args

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes