ProgrammingModerateTCS NQT · Infosys

What is printed on the first line?

What is printed on the first line?
print(int('1' * 19) + 1, 10**18 * 10, 9_223_372_036_854_775_807 + 1 > 2**63 - 1)
print(2**100 // 2**98, (2**100) >> 98, 2**100 % 2**98)
  1. A. 1111111111111111112 10000000000000000000 True
  2. B. 1111111111111111111 10000000000000000000 True
  3. C. 1111111111111111112 1000000000000000000 True
  4. D. 1111111111111111112 10000000000000000000 False

Correct answer: A. 1111111111111111112 10000000000000000000 True

Python ints are unbounded, so the 64-bit boundary has no effect and the comparison is True. The result of a % b for exact powers of two is 0.

More Python Programming questions

Exams that ask this topic