Numpy MCQs with answers Page - 3

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

Q. What is the result of np.array([1, 2, 3]) + 5?

  • (A) [6, 7, 8]
  • (B) [5, 5, 5]
  • (C) [1, 2, 3, 5]
  • (D) Error

A

Admin • 831.35K Points
Coach

Q. Which NumPy function stacks arrays vertically?

  • (A) np.vstack()
  • (B) np.hstack()
  • (C) np.stack()
  • (D) np.combine()

A

Admin • 831.35K Points
Coach

Q. What does np.hstack([a, b]) do?

  • (A) Stacks arrays vertically
  • (B) Stacks arrays horizontally
  • (C) Multiplies arrays
  • (D) Sorts arrays

A

Admin • 831.35K Points
Coach

Q. Which function returns the index of the maximum value?

  • (A) np.argmax()
  • (B) np.max()
  • (C) np.where()
  • (D) np.locate()

A

Admin • 831.35K Points
Coach

Q. How can you generate a diagonal matrix with NumPy?

  • (A) np.diag()
  • (B) np.eye()
  • (C) np.diagonal()
  • (D) np.matrix_diag()

A

Admin • 831.35K Points
Coach

Q. Which method returns the minimum value in a NumPy array?

  • (A) np.lowest()
  • (B) np.min()
  • (C) np.minimum()
  • (D) np.smallest()

A

Admin • 831.35K Points
Coach

Q. What will np.arange(1, 10, 3) return?

  • (A) [1, 4, 7]
  • (B) [1, 2, 3]
  • (C) [1, 4, 9]
  • (D) [1, 5, 10]

A

Admin • 831.35K Points
Coach

Q. What is the effect of np.reshape(a, (1, -1))?

  • (A) Flattens the array
  • (B) Creates a 1D array
  • (C) Creates a row vector
  • (D) Creates a column vector

A

Admin • 831.35K Points
Coach

Q. Which of the following is NOT a feature of NumPy?

  • (A) Broadcasting
  • (B) Fast computations
  • (C) Symbolic math
  • (D) Multidimensional arrays

A

Admin • 831.35K Points
Coach

Q. What will np.array([[1, 2], [3, 4]])[1, 0] return?

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