1. Home
  2. Data Science
  3. NumPy
  4. Which function is used to create a new array filled with…

Added 24 Feb 2024

Which function is used to create a new array filled with zeros?

  1. zeros() Correct answer
  2. ones()
  3. empty()
  4. arange()

Correct answer

A. zeros()

11 views

MCQSEXAM

Explanation

zeros() creates an array filled with zeros: np.zeros((2, 3)) gives a 2×3 array of 0.0.

ones() fills with ones, empty() allocates memory without initialising it, and arange() produces a sequence of numbers.

For more solved questions like this one, see Data Science MCQs on MCQsExam.com.

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More NumPy MCQs

Practise all NumPy MCQs

Similar MCQs