ProgrammingVery hardJEE Advanced · CAT placement

What is printed?

What is printed?
print(int(float(2**53)) == 2**53, float(2**53 + 1) - 2**53, (2**53 + 1) - 2**53)
  1. A. True 1.0 1
  2. B. False 0.0 1
  3. C. True 0.0 1
  4. D. True 0.0 0

Correct answer: C. True 0.0 1

2**53 + 1 rounds to 2**53 as a float, so the float difference is 0.0. Integer arithmetic is exact, so the int difference is 1.

More Python Programming questions

Exams that ask this topic