ProgrammingModerateProduct-company MCQ pattern

What is printed?

What is printed?
print("abc" < "abd" < "ab", "10" < "9", 10 < 9)
  1. A. True False True
  2. B. False True False
  3. C. False False False
  4. D. True True False

Correct answer: B. False True False

"abc" < "abd" is True, but the chain also needs "abd" < "ab", and that is False because a prefix is smaller than the longer string. Strings compare character by character, so "10" < "9" ('1' < '9') is True, while the numbers give 10 < 9, which is False.

More Python Programming questions

Exams that ask this topic