ProgrammingVery hardJEE Advanced · CAT placement

What is printed?

What is printed?
from math import inf
print(inf - 1 == inf, 2 * inf, -inf < -10 ** 400, inf > 10 ** 400)
  1. A. False inf True True
  2. B. True -inf False True
  3. C. True inf True True
  4. D. True inf True False

Correct answer: C. True inf True True

Subtracting 1 from infinity leaves infinity, so the first check is True. Multiplying by 2 keeps infinity, and infinity compares larger than any int, even 10**400.

More Python Programming questions

Exams that ask this topic