Numpy MCQs with answers Page - 2

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 • 828.03K Points
Coach

Q. What does np.linspace(0, 1, 5) return?

  • (A) Array of 5 values from 0 to 1 with equal spacing
  • (B) Array of integers from 0 to 1
  • (C) Array of 5 zeros
  • (D) Array from 0 to 5

A

Admin • 828.03K Points
Coach

Q. How can you generate random numbers in NumPy?

  • (A) np.generate()
  • (B) np.random()
  • (C) np.rand()
  • (D) np.random.rand()

A

Admin • 828.03K Points
Coach

Q. Which function is used to find the maximum value in an array?

  • (A) np.max()
  • (B) np.maximum()
  • (C) np.argmax()
  • (D) np.highest()

A

Admin • 828.03K Points
Coach

Q. What does the function np.mean() compute?

  • (A) Median
  • (B) Mode
  • (C) Mean
  • (D) Minimum

A

Admin • 828.03K Points
Coach

Q. Which function sorts a NumPy array?

  • (A) np.arrange()
  • (B) np.order()
  • (C) np.sort()
  • (D) np.sorted()

A

Admin • 828.03K Points
Coach

Q. What does np.unique() return?

  • (A) All elements
  • (B) Duplicate elements
  • (C) Sorted array
  • (D) Unique elements

A

Admin • 828.03K Points
Coach

Q. How to check if any element of a NumPy array is non-zero?

  • (A) np.any()
  • (B) np.all()
  • (C) np.nonzero()
  • (D) np.exists()

A

Admin • 828.03K Points
Coach

Q. Which of these is used to transpose a matrix in NumPy?

  • (A) transpose()
  • (B) np.transpose()
  • (C) T
  • (D) All of the above

A

Admin • 828.03K Points
Coach

Q. How do you find the data type of elements in a NumPy array?

  • (A) dtype()
  • (B) type()
  • (C) datatype()
  • (D) dtype

A

Admin • 828.03K Points
Coach

Q. Which attribute shows the number of dimensions in a NumPy array?

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

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