ProgrammingHardTCS NQT · Infosys

int x = 5, y = 3; What does printf("%d", x & y | 4 ^ 1) print?

  1. A. 1
  2. B. 4
  3. C. 5
  4. D. 6

Correct answer: C. 5

& binds tighter than ^, which binds tighter than |. So the expression is (5 & 3) | (4 ^ 1) = 1 | 5 = 5.

More C Programming questions

Exams that ask this topic