ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(1 << 64 == 2**64, (1 << 64) - 1 & 0xFFFF)
  1. A. False 65535
  2. B. True 65536
  3. C. True 0
  4. D. True 65535

Correct answer: D. True 65535

<< binds tighter than ==, so the first test is True. Subtraction binds tighter than &, so the second value is ((1 << 64) - 1) & 0xFFFF = 65535.

More Python Programming questions

Exams that ask this topic