Data Structures & AlgorithmsModerateTCS NQT Digital · Python semantics

Problem: What does the following print?

Problem: What does the following print?
print('10' < '9', 10 < 9)
  1. A. True False
  2. B. False False
  3. C. True True
  4. D. False True

Correct answer: A. True False

String comparison is lexicographic, so '1' < '9' decides the first result as True, while integer comparison gives False.

More Coding Interview Problems questions

Exams that ask this topic