ProgrammingVery hardJEE Main · CAT placement
What is printed?
What is printed?
print(-(2**64) >> 3, -(2**64) // 8, -(2**64) % 10)
- A. -2305843009213693952 -2305843009213693952 4
- B. -2305843009213693952 -2305843009213693952 -6
- C. -2305843009213693952 2305843009213693952 2
- 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
- What is printed? python print('a,b,,c'.split(','), 'a b c'.split(), 'a b c'.split(' '), ' x '.strip(), 'x,'.split(','))
- What is printed? python print(sorted(['Bb', 'aA', 'bb', 'AA'], key=str.lower))
- What is printed? python print(-7 % 3, 7 % -3, -7 // 3, 7 // -3)
- What is printed? python print(pow(-7, 3, 5), (-7) 2 % 5, -7 2 % 5)
- What is printed? python print(2100 % 7, pow(2, 100, 7), pow(2, 100, 1))
- What is printed? python x = 1020 print(x // 3, x / 3 == x // 3, x % 3)