Bird
0
0

Which of the following is the correct syntax to create a 3x3 NumPy array filled with the value 7 using np.full()?

easy📝 Syntax Q12 of 15
NumPy - Creating Arrays
Which of the following is the correct syntax to create a 3x3 NumPy array filled with the value 7 using np.full()?
Anp.full((3, 3), 7)
Bnp.full(3, 3, 7)
Cnp.full([3, 3], value=7)
Dnp.full(7, shape=(3,3))
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct parameter order for np.full()

    np.full() takes the shape as the first argument (tuple), then the fill value as the second argument.
  2. Step 2: Check each option's syntax

    np.full((3, 3), 7) uses np.full((3, 3), 7) which matches the correct order and types. Others misuse argument order or syntax.
  3. Final Answer:

    np.full((3, 3), 7) -> Option A
  4. Quick Check:

    Shape tuple first, fill value second [OK]
Quick Trick: Shape is first tuple, value is second argument [OK]
Common Mistakes:
  • Passing shape and value as separate arguments without tuple
  • Using keyword arguments incorrectly
  • Swapping the order of shape and fill value

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes