Loading

Quipoin Menu

Learn • Practice • Grow

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

Q1.

What is NumPy?
A. A library for numerical computing
B. A web framework
C. A machine learning library
D. A data visualization library
Direction: Choose the correct option

Q2.

How do you create a NumPy array from a list?
A. Both A and C
B. np.list([1,2,3])
C. np.array([1,2,3])
D. np.asarray([1,2,3])
Direction: Choose the correct option

Q3.

What does `np.arange(5)` produce?
A. [1 2 3 4 5]
B. [0,1,2,3,4]
C. [0 1 2 3 4 5]
D. [0 1 2 3 4]
Direction: Choose the correct option

Q4.

How do you get the shape of a NumPy array `a`?
A. a.dim
B. a.ndim
C. a.size
D. a.shape
Direction: Choose the correct option

Q5.

What does `np.zeros((2,3))` create?
A. A 2x3 array of random numbers
B. A 3x2 array
C. A 2x3 array of ones
D. A 2x3 array of zeros
Direction: Choose the correct option

Q6.

What is the data type of elements in a NumPy array `np.array([1,2,3])`?
A. float64
B. str
C. object
D. int64
Direction: Choose the correct option

Q7.

How do you convert a list to a NumPy array with float type?
A. np.array(lst).astype(float)
B. np.asarray(lst, float)
C. np.float32(lst)
D. np.array(lst, dtype=float)
Direction: Choose the correct option

Q8.

What is the output of `np.array([1,2,3]) + np.array([4,5,6])`?
A. [1,2,3]
B. [4,5,6]
C. [1,2,3,4,5,6]
D. [5,7,9]
Direction: Choose the correct option

Q9.

What does `np.ones((2,2))` produce?
A. [[1,1],[1,1]]
B. [[0.,0.],[0.,0.]]
C. [[1.],[1.]]
D. [[1.,1.],[1.,1.]]
Direction: Choose the correct option

Q10.

What is the attribute that gives the number of dimensions of a NumPy array?
A. ndim
B. dtype
C. size
D. shape