1. Home
  2. Data Science
  3. NumPy
  4. What does the np.zeros() function do in NumPy?

Added 25 Feb 2024

What does the np.zeros() function do in NumPy?

  1. Creates an array filled with zeros Correct answer
  2. Creates an array filled with ones
  3. Creates an identity matrix
  4. Creates a random array

Correct answer

A. Creates an array filled with zeros

15 views

MCQSEXAM

Explanation

The np.zeros() function is used to create an array filled with zeros of a specified shape. This is useful when you need to initialize an array with zeros before filling it with actual data. For example, np.zeros((3, 3)) creates a 3x3 array filled with zeros

Reference

https://www.w3schools.com/python/numpy/default.asp

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