ProgrammingModerateTCS NQT · Wipro pattern

What is printed?

What is printed?
print(3 % 2 == 1 and 4 % 2 == 0, 3 // 2 == 1 or 1 / 0)
  1. A. True True
  2. B. True False
  3. C. False True
  4. D. ZeroDivisionError

Correct answer: A. True True

Both halves of the and are True, and the or short-circuits because 3 // 2 is 1, so 1 / 0 is never evaluated.

More Python Programming questions

Exams that ask this topic