ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(ord('A') + 1, chr(ord('a') + 25), chr(0x1F600) == '\U0001F600', len('\U0001F600'), '\N{SNOWMAN}')
  1. A. 66 z True 2 ☃
  2. B. 65 z True 1 ☃
  3. C. 66 a True 1 ☃
  4. D. 66 z True 1 ☃

Correct answer: D. 66 z True 1 ☃

ord('A') is 65, so adding 1 gives 66. 'a' + 25 is 'z', and an emoji outside the BMP is still a single code point in Python 3, so its length is 1.

More Python Programming questions

Exams that ask this topic