ProgrammingModerateTCS NQT · Infosys

What is the value of 1 << 2 + 3 in C?

  1. A. 12
  2. B. 7
  3. C. 8
  4. D. 32

Correct answer: D. 32

Additive operators bind tighter than shift operators, so the expression is 1 << (2 + 3), which is 1 << 5 = 32. Writing (1 << 2) + 3 would give 7 instead.

More C Programming questions

Exams that ask this topic