ProgrammingHard

What is the Hamming distance between 13 and 22 (the number of bit positions where they differ)?

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

Correct answer: C. 4

13 ^ 22 = 27 = 0b11011, which has four set bits, so four positions differ.

More C Programming questions

Exams that ask this topic