ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(0b1111 ^ 0b1010 & 0b0110, (0b1111 ^ 0b1010) & 0b0110, 6 & 3 | 4 ^ 1)
  1. A. 13 4 5
  2. B. 13 4 7
  3. C. 11 4 7
  4. D. 13 2 7

Correct answer: B. 13 4 7

& binds tighter than ^, so 0b1010 & 0b0110 is 2 and 15 ^ 2 is 13. In 6 & 3 | 4 ^ 1 the ^ comes before |, giving 2 | 5 = 7.

More Python Programming questions

Exams that ask this topic