ProgrammingVery hardJEE Main · CAT placement

What is printed?

What is printed?
print(0o777 ^ 0o070, 0b1111 & 0xF0 | 0x0F, 1_000_000 // 1e3)
  1. A. 455 15 1000
  2. B. 447 15 1000.0
  3. C. 455 15 1000.0
  4. D. 455 255 1000.0

Correct answer: C. 455 15 1000.0

0o777 is 511 and 0o070 is 56, and their xor is 455. & binds tighter than |, so the second value is 0 | 15. Floor division with a float gives a float.

More Python Programming questions

Exams that ask this topic