ProgrammingHardTCS NQT · Infosys

int x = 3; printf("%d", x << 2 | x >> 1); What is printed?

  1. A. 12
  2. B. 1
  3. C. 7
  4. D. 13

Correct answer: D. 13

Shifts bind tighter than |, so the value is (3 << 2) | (3 >> 1) = 12 | 1 = 13.

More C Programming questions

Exams that ask this topic