1. Home
  2. Data Science
  3. NumPy
  4. What is the dtype of np.array([1, 2]) + 0.5?

Added 2 Nov 2026

What is the dtype of np.array([1, 2]) + 0.5?

  1. int64
  2. float64 Correct answer
  3. int32
  4. object

Correct answer

B. float64

18 views

MCQSEXAM

Explanation

NumPy upcasts to a type that can hold all results, so adding a float to integers produces float64: array([1.5, 2.5]).

Reference

Asked in: Data Science Interviews

Preparing for an exam?

Doubts & discussion

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