ProgrammingVery hardGATE CS · Product-company placement

What is printed?

What is printed?
print(chr(ord("a") + 25), ord("A") - ord("a"), "".join(chr(ord(c) ^ 32) for c in "PyThOn"), str(b"x", "ascii"))
  1. A. y -32 pYtHoN x
  2. B. { -32 pYtHoN x
  3. C. z -32 PYTHON b'x'
  4. D. z -32 pYtHoN x

Correct answer: D. z -32 pYtHoN x

'a' + 25 is 'z'. Uppercase letters are 32 below lowercase in ASCII, and flipping bit 5 (XOR 32) swaps case. str(bytes, encoding) decodes rather than giving the repr.

More Python Programming questions

Exams that ask this topic