ProgrammingHardTCS NQT · Infosys

What is printed?

What is printed?
print(1 < 2 < 3 < 4 == 4.0, 4 == 4.0 != 5, 1 < 3 > 2 < 2)
  1. A. True False True
  2. B. False True False
  3. C. True True False
  4. D. True True True

Correct answer: C. True True False

Each chained comparison checks adjacent pairs, so the first two are True. The last needs 2 < 2, which is False.

More Python Programming questions

Exams that ask this topic