ProgrammingVery hardJEE Advanced · CAT placement

What is printed?

What is printed?
print(float('9007199254740993') == 9007199254740993, int(float('9007199254740993')), int(9007199254740993.0))
  1. A. False 9007199254740992 9007199254740992
  2. B. True 9007199254740993 9007199254740992
  3. C. False 9007199254740993 9007199254740993
  4. D. False 9007199254740992 9007199254740993

Correct answer: A. False 9007199254740992 9007199254740992

2**53 + 1 is not representable as a double, and it rounds to even 2**53. The exact int comparison with the float is therefore False, and both conversions give 9007199254740992.

More Python Programming questions

Exams that ask this topic