ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(ord('a') - ord('A'), chr(ord('A') + 32), 'Z'.lower() < 'a', 'z' > 'Z')
  1. A. 32 b False True
  2. B. 32 a True False
  3. C. 31 a False True
  4. D. 32 a False True

Correct answer: D. 32 a False True

Lowercase letters are 32 code points above their uppercase forms. 'Z'.lower() is 'z', which has a larger code point than 'a', so the first comparison is False, and 'z' > 'Z' is True.

More Python Programming questions

Exams that ask this topic