ProgrammingHardGATE CS · Campus placements

How many subsets of {1, 2, 3, 4, 5} have a bitwise XOR of their elements equal to 0? Count the empty set.

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

Correct answer: C. 4

The qualifying subsets are the empty set, {1,2,3}, {1,4,5} and {2,3,4,5}, giving 4. Each is checked directly: for example 2^3^4^5 = 0.

More C Programming questions

Exams that ask this topic