Numpy MCQs with answers Page - 8

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. What does `a[a > 0]` return?

  • (A) Indexes of elements greater than 0
  • (B) Boolean array
  • (C) Elements of a that are greater than 0
  • (D) None of the above

A

Admin • 802.91K Points
Coach

Q. Which NumPy function returns the number of dimensions in an array?

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

A

Admin • 802.91K Points
Coach

Q. How can you check for infinite values in a NumPy array?

  • (A) np.isinf()
  • (B) np.isfinite()
  • (C) np.isnan()
  • (D) np.checkinf()

A

Admin • 802.91K Points
Coach

Q. Which function returns a view of the array with dimensions permuted?

  • (A) np.swapaxes()
  • (B) np.transpose()
  • (C) np.permute()
  • (D) np.reverse()

A

Admin • 802.91K Points
Coach

Q. What does np.tile(x, 2) do?

  • (A) Repeats x twice
  • (B) Returns transpose of x
  • (C) Adds 2 to all elements of x
  • (D) Creates a tiled matrix from x with 2 rows

A

Admin • 802.91K Points
Coach

Q. Which of the following functions will round elements to the nearest integer?

  • (A) np.fix()
  • (B) np.round()
  • (C) np.ceil()
  • (D) np.floor()

A

Admin • 802.91K Points
Coach

Q. How to get diagonal elements of a 2D array?

  • (A) np.diagonal()
  • (B) np.diag()
  • (C) np.get_diag()
  • (D) np.extract_diag()

A

Admin • 802.91K Points
Coach

Q. What is the default axis in np.mean(arr)?

  • (A) 0
  • (B) 1
  • (C) None
  • (D) 2

A

Admin • 802.91K Points
Coach

Q. Which of these is used for element-wise multiplication in NumPy?

  • (A) np.multiply()
  • (B) np.dot()
  • (C) np.prod()
  • (D) np.matmult()

A

Admin • 802.91K Points
Coach

Q. What will be the output of np.array([1,2,3], dtype='float32').dtype?

  • (A) int32
  • (B) float32
  • (C) float64
  • (D) int64

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ