ProgrammingModerateTCS NQT · Infosys

How many 1 bits are set in 2^20 - 1 (a 32-bit unsigned value)?

  1. A. 19
  2. B. 20
  3. C. 21
  4. D. 10

Correct answer: B. 20

2^20 - 1 has its low 20 bits set and nothing else, so the popcount is 20.

More C Programming questions

Exams that ask this topic