ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print('5' * 3 > '10' * 2, 5 * 3 > 10 * 2, '55' < '9', 55 < 9)
  1. A. False False True False
  2. B. True True True False
  3. C. True False False False
  4. D. True False True False

Correct answer: D. True False True False

'555' is greater than '1010' because '5' is greater than '1' at the first character. Numerically 15 is not greater than 20, and '55' sorts before '9' as text.

More Python Programming questions

Exams that ask this topic