ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(int('zz', 36), format(1295, 'x'), int('1295', 10) == 1295, int('zz', 36) == 35 * 36 + 35)
  1. A. 1295 51f True True
  2. B. 1295 50f False True
  3. C. 1205 50f True True
  4. D. 1295 50f True True

Correct answer: D. 1295 50f True True

Base 36 uses letters for digits 10 to 35, so 'zz' is 35 * 36 + 35 = 1295. In hex, 1295 is 0x50f, and the lower-case format gives 50f.

More Python Programming questions

Exams that ask this topic