1. Home
  2. Data Science
  3. NumPy
  4. What does (scores >= 50).sum() return for a NumPy array of…

Added 2 Nov 2026

What does (scores >= 50).sum() return for a NumPy array of exam scores?

  1. The total of all scores at or above 50
  2. The average of every score in the array
  3. The number of scores that are at least 50 Correct answer
  4. The index of the first score above 50

Correct answer

C. The number of scores that are at least 50

16 views

MCQSEXAM

Explanation

Comparison produces a boolean array, and summing treats True as 1. This is a fast, vectorised way to count elements that meet a condition.

Reference

Asked in: Data Science Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? 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