ProgrammingVery hardTCS NQT · Accenture

What is printed?

What is printed?
print(round(0.5 * 3), round(4.5) + round(5.5), int(2.9999999999999996), int(3.0000000000000004))
  1. A. 2 9 3 3
  2. B. 2 10 2 3
  3. C. 3 10 2 3
  4. D. 2 10 3 3

Correct answer: B. 2 10 2 3

0.5 * 3 is 1.5, which rounds to 2 under half-to-even. round(4.5) is 4 and round(5.5) is 6, and int() truncates 2.9999999999999996 to 2 but 3.0000000000000004 to 3.

More Python Programming questions

Exams that ask this topic