ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(round(1e-20, 25) == 1e-20, round(123.456, 10), round(0.5 + 1e-17, 0))
  1. A. True 123.456 0.0
  2. B. True 123.456 1.0
  3. C. False 123.456 0.0
  4. D. True 123.4560000001 0.0

Correct answer: A. True 123.456 0.0

Rounding to 25 places keeps 1e-20 intact, and 123.456 has no more digits to round. 0.5 + 1e-17 is exactly 0.5 in double precision, so round-half-to-even sends it to 0.0.

More Python Programming questions

Exams that ask this topic