ProgrammingVery hardGATE CS · Campus placements

How many 1 bits does 0xDEADBEEF have in binary?

  1. A. 22
  2. B. 26
  3. C. 24
  4. D. 20

Correct answer: C. 24

Counting the set bits nibble by nibble gives 24. A popcount that loops with x &= x - 1 finds the same total in one iteration per set bit.

More C Programming questions

Exams that ask this topic