ProgrammingVery hard

What is 1 ^ 2 ^ 3 ^ 4 ^ 5 ^ 6 ^ 7 ^ 8 ^ 9 ^ 10 in C?

  1. A. 10
  2. B. 11
  3. C. 9
  4. D. 0

Correct answer: B. 11

The XOR of 1 through n depends on n mod 4. For n = 10, n mod 4 = 2, which gives n + 1 = 11.

More C Programming questions

Exams that ask this topic