ProgrammingModerateProduct-company MCQ pattern

What is printed?

What is printed?
print(round(2.5), round(3.5), round(-0.5))
  1. A. 2 3 0
  2. B. 3 4 0
  3. C. 2 4 0
  4. D. 3 4 -1

Correct answer: C. 2 4 0

Python 3's round() uses banker's rounding: an exact .5 goes to the nearest EVEN integer. So 2.5 → 2, 3.5 → 4 and -0.5 → 0. 'Always round half up' gives the trap answer 3 4.

More Python Programming questions

Exams that ask this topic