ProgrammingVery hardCAT · MBA placement

What is printed?

What is printed?
print(len('é'.encode('utf-8').decode('latin-1')), 'é'.encode('utf-8').decode('latin-1'))
  1. A. 2 é
  2. B. 1 é
  3. C. 2 é
  4. D. 3 é

Correct answer: A. 2 é

é is two bytes in UTF-8, and decoding those bytes as Latin-1 gives two separate characters, Ã and ©. So the string has two characters.

More Python Programming questions

Exams that ask this topic