ProgrammingHardProduct-company MCQ pattern

What is printed?

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

Correct answer: A. -2 -4 -3

Exact halves go to the even neighbour, so -2.5 becomes -2 and -3.5 becomes -4. Subtracting a tiny amount moves -2.5 past the midpoint, so it rounds to -3.

More Python Programming questions

Exams that ask this topic