ProgrammingVery hard

How many subsets of {1, 2, 3, 4} (including the empty set) have XOR equal to 0?

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

Correct answer: B. 2

Only the empty set and {1, 2, 3} have XOR 0, because 1 ^ 2 ^ 3 = 0. Checking all 16 subsets confirms no other one works.

More C Programming questions

Exams that ask this topic