ProgrammingHardTCS NQT · Accenture

What is printed?

What is printed?
print(0 or [] or 'x', 2 and 0 and 5, None or 0)
  1. A. x 0 None
  2. B. False 0 0
  3. C. x 0 0
  4. D. x 5 0

Correct answer: C. x 0 0

or returns its first truthy operand and and returns its first falsy operand, so the values themselves are printed. None or 0 returns 0.

More Python Programming questions

Exams that ask this topic