ProgrammingHardGATE CS · Campus placements

How many subsets of {0, 1, 2, 3, 4, 5} contain exactly three elements?

  1. A. 15
  2. B. 20
  3. C. 18
  4. D. 30

Correct answer: B. 20

Choosing 3 of 6 elements gives C(6,3) = 20 subsets. Counting each mask of 6 bits with popcount 3 gives the same number.

More C Programming questions

Exams that ask this topic