ProgrammingHardTCS NQT · Accenture

What is printed?

What is printed?
print('%c%c' % (72, 105), chr(0x263A) == '\u263a', ord('A') + 1, chr(ord('a') + 25))
  1. A. Hi False 66 z
  2. B. Hi True 65 z
  3. C. Hi True 66 z
  4. D. Ho True 66 z

Correct answer: C. Hi True 66 z

%c turns the integers 72 and 105 into H and i. chr and ord are inverses, so the smiley escape matches its literal, and ord('A') + 1 is 66.

More Python Programming questions

Exams that ask this topic