Bird
0
0

Which of the following is the correct syntax to transpose a 2D NumPy array named arr?

easy📝 Conceptual Q12 of 15
NumPy - Array Manipulation
Which of the following is the correct syntax to transpose a 2D NumPy array named arr?
Atranspose(arr)
Barr.transpose
Carr.transpose()
Darr.transpose[]
Step-by-Step Solution
Solution:
  1. Step 1: Recall method call syntax in Python

    To call a method, parentheses are required: arr.transpose().
  2. Step 2: Check other options

    transpose(arr) is incorrect because transpose is a method, not a standalone function here; arr.transpose misses parentheses; arr.transpose[] is invalid syntax.
  3. Final Answer:

    arr.transpose() -> Option C
  4. Quick Check:

    Method call needs parentheses [OK]
Quick Trick: Use parentheses to call transpose method: arr.transpose() [OK]
Common Mistakes:
  • Omitting parentheses when calling transpose
  • Using transpose as a standalone function without import
  • Using invalid syntax like brackets after method

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes