Loading

Quipoin Menu

Learn • Practice • Grow

python-for-ai / NumPy Broadcasting
mcq
Direction: Choose the correct option

Q1.

What is broadcasting in NumPy?
A. A method to send data over network
B. A type of array
C. A plotting feature
D. A way to perform operations on arrays of different shapes
Direction: Choose the correct option

Q2.

What is the result of `np.array([1,2,3]) + 10`?
A. Error
B. [1,2,3,10]
C. [1,2,3]
D. [11,12,13]
Direction: Choose the correct option

Q3.

What shapes are compatible for broadcasting `(3,1)` and `(1,4)`?
A. (1,4)
B. (3,1)
C. (3,4)
D. Error
Direction: Choose the correct option

Q4.

Can you broadcast a shape (2,3) array with a shape (3,) array?
A. No
B. Only if both 2D
C. Only if both 1D
D. Yes
Direction: Choose the correct option

Q5.

Which of the following rules is NOT part of NumPy broadcasting?
A. If dimensions differ, prepend 1s
B. Trailing dimensions must match
C. If a dimension is 1, it stretches
D. Arrays must have same rank
Direction: Choose the correct option

Q6.

What is the result of `np.array([[1],[2]]) + np.array([10,20])`?
A. [[11,20],[12,20]]
B. Error
C. [[11,12],[21,22]]
D. [[11,21],[12,22]]
Direction: Choose the correct option

Q7.

When broadcasting a shape (4,1) array with (3,) array, what is the result shape?
A. (4,1)
B. (3,4)
C. (4,3)
D. Error
Direction: Choose the correct option

Q8.

What does `a = np.array([1,2,3]); b = np.array([[1],[2],[3]]); a + b` produce?
A. 3x1 array
B. Error
C. 1x3 array
D. 3x3 array
Direction: Choose the correct option

Q9.

Is broadcasting more efficient than manual looping?
A. Only for large arrays
B. Only for small arrays
C. No, slower
D. Yes, implemented in C
Direction: Choose the correct option

Q10.

Will broadcasting work for shape (5,) and (6,) arrays?
A. Yes
B. Only if using reshape
C. If both are 1D
D. No, trailing dimensions do not match