1. Home
  2. Data Science
  3. NumPy
  4. What is the purpose of broadcasting in NumPy?

Added 24 Feb 2024

What is the purpose of broadcasting in NumPy?

  1. To adjust array dimensions to perform arithmetic operations Correct answer
  2. To increase the speed of array operations
  3. To convert arrays into a different data type
  4. None of the above

Correct answer

A. To adjust array dimensions to perform arithmetic operations

12 views

MCQSEXAM

Explanation

Broadcasting lets NumPy stretch arrays of different shapes so arithmetic can be performed on them. For example, adding a scalar or a 1-D row to a 2-D array applies it across every row, without copying data.

Dimensions are compatible when they are equal or one of them is 1.

Want more practice? Try the full set of 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