ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(int(1e20) == 10**20, int(1e20 + 1) == 10**20 + 1, int(1e20) - 10**20)
  1. A. True True 0
  2. B. False False 0
  3. C. True False 0
  4. D. True False 1

Correct answer: C. True False 0

1e20 is exactly representable, so int(1e20) equals 10**20. Adding 1 to the float has no effect at this magnitude, so the second comparison is False.

More Python Programming questions

Exams that ask this topic