Which function is used to create a new array filled with zeros?
Correct answer
A. zeros()
11 views
A. zeros()
11 views
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.
Not sure why the answer is A? Ask here and get an explanation.