ProgrammingVery hardJEE Main · CAT placement

What is printed?

What is printed?
print(-(2**64) >> 3, -(2**64) // 8, -(2**64) % 10)
  1. A. -2305843009213693952 -2305843009213693952 4
  2. B. -2305843009213693952 -2305843009213693952 -6
  3. C. -2305843009213693952 2305843009213693952 2
  4. D. -2305843009213693951 -2305843009213693952 4

Correct answer: A. -2305843009213693952 -2305843009213693952 4

Right shift and floor division on a negative big integer both round toward negative infinity, and 2**64 is divisible by 8, so both give -2**61. The modulus is taken with the divisor's sign: -(2**64) is congruent to 4 mod 10.

More Python Programming questions

Exams that ask this topic