Numpy MCQs with answers Page - 4

Here, you will find a collection of MCQ questions on Numpy. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 802.91K Points
Coach

Q. How can you fill a NumPy array with a specific value?

  • (A) np.fill()
  • (B) np.assign()
  • (C) np.full()
  • (D) np.value()

A

Admin • 802.91K Points
Coach

Q. Which of these functions does NOT create an array?

  • (A) np.ones()
  • (B) np.zeros()
  • (C) np.arange()
  • (D) np.arrayize()

A

Admin • 802.91K Points
Coach

Q. How do you round elements of a NumPy array?

  • (A) np.round()
  • (B) np.floor()
  • (C) np.ceil()
  • (D) All of the above

A

Admin • 802.91K Points
Coach

Q. What does np.random.seed(0) do?

  • (A) Randomizes output
  • (B) Sets the seed for reproducibility
  • (C) Resets array
  • (D) Shuffles array

A

Admin • 802.91K Points
Coach

Q. Which function returns an array with evenly spaced numbers over a specified interval?

  • (A) np.linspace()
  • (B) np.arange()
  • (C) np.range()
  • (D) np.space()

A

Admin • 802.91K Points
Coach

Q. What does np.cov() compute?

  • (A) Variance
  • (B) Mean
  • (C) Covariance matrix
  • (D) Correlation matrix

A

Admin • 802.91K Points
Coach

Q. How to get the real part of a complex NumPy array?

  • (A) .real
  • (B) .imag
  • (C) .real_part
  • (D) .magnitude

A

Admin • 802.91K Points
Coach

Q. What will be the shape of np.zeros((2, 3, 4))?

  • (A) (2, 3)
  • (B) (3, 4)
  • (C) (2, 3, 4)
  • (D) (4, 3, 2)

A

Admin • 802.91K Points
Coach

Q. Which attribute gives the total number of elements in the array?

  • (A) ndim
  • (B) shape
  • (C) size
  • (D) len

A

Admin • 802.91K Points
Coach

Q. What will np.array([True, False, True]) + np.array([False, True, True]) return?

  • (A) [True, True, True]
  • (B) [1, 1, 2]
  • (C) [False, False, True]
  • (D) [1, 0, 1]