ProgrammingModerateProduct-company MCQ pattern

What is printed?

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

Correct answer: D. x 0 0

or returns the first truthy operand, or the last one if none is truthy. and returns the first falsy operand, or the last one. So 0 or [] or "x" gives "x", 1 and 0 and 5 stops at 0, and None or 0 gives 0 (the last operand).

More Python Programming questions

Exams that ask this topic