Numpy MCQs with answers Page - 6

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

Q. Which function would you use to calculate the correlation coefficient between two arrays?

  • (A) np.cov()
  • (B) np.corrcoef()
  • (C) np.corr()
  • (D) np.covcorr()

A

Admin • 832.27K Points
Coach

Q. What does np.argsort() return when applied to an array?

  • (A) A sorted version of the array
  • (B) Indices that would sort the array
  • (C) The indices of maximum values in the array
  • (D) A boolean array indicating sorted order

A

Admin • 832.27K Points
Coach

Q. Which function returns the sum of array elements along a specific axis?

  • (A) np.sum()
  • (B) np.add()
  • (C) np.aggregate()
  • (D) np.prod()

A

Admin • 832.27K Points
Coach

Q. What is the purpose of using np.copy() on an array?

  • (A) To create a reference to the same array
  • (B) To create a deep copy of the array
  • (C) To convert the array to a list
  • (D) To sort the array

A

Admin • 832.27K Points
Coach

Q. Which function generates random floating-point numbers in NumPy?

  • (A) np.random.rand()
  • (B) np.random.randint()
  • (C) np.random.random_integers()
  • (D) np.random.choice()

A

Admin • 832.27K Points
Coach

Q. Which of the following functions can generate a sequence of evenly spaced numbers over an interval?

  • (A) np.arange()
  • (B) np.linspace()
  • (C) np.logspace()
  • (D) All of the above

A

Admin • 832.27K Points
Coach

Q. What does np.empty() do when creating a new array?

  • (A) Creates an array filled with zeros
  • (B) Creates an uninitialized array of the specified shape
  • (C) Creates an array filled with ones
  • (D) Creates an array with random numbers

A

Admin • 832.27K Points
Coach

Q. Which attribute of a NumPy array provides the total number of elements in the array?

  • (A) array.size
  • (B) array.shape
  • (C) array.ndim
  • (D) array.length

A

Admin • 832.27K Points
Coach

Q. Which attribute gives the byte size of each element in a NumPy array?

  • (A) itemsize
  • (B) nbytes
  • (C) size
  • (D) bytesize

A

Admin • 832.27K Points
Coach

Q. For a 2D array, what does np.sum(arr, axis=0) do?

  • (A) Sums the elements across each row
  • (B) Sums the elements down each column
  • (C) Sums all elements in the array
  • (D) Returns the number of rows