ProgrammingModerate

What is the number of 1 bits in 0xF0F0 (a 16-bit value)?

  1. A. 4
  2. B. 12
  3. C. 8
  4. D. 16

Correct answer: C. 8

0xF0F0 is 1111 0000 1111 0000: each hex F contributes four 1 bits and each 0 none, so 2 x 4 = 8. 4 counts only one byte, and 16 is the width, not the popcount.

More C Programming questions

Exams that ask this topic