ProgrammingVery hardJEE Advanced · CAT placement

What is printed?

What is printed?
print(int(1e16 + 1), 2**53 + 1 == float(2**53 + 1), float(2**53 + 1) == 2**53)
  1. A. 10000000000000002 True False
  2. B. 10000000000000000 False True
  3. C. 10000000000000000 True True
  4. D. 10000000000000001 False True

Correct answer: B. 10000000000000000 False True

1e16 + 1 lies exactly between two doubles spaced by 2, and round-half-to-even picks 1e16. Converting 2**53 + 1 to float also rounds to 2**53, so the exact int comparison is False and the float comparison is True.

More Python Programming questions

Exams that ask this topic