The hamming distance between 10101 and 11110 is

2025

The hamming distance between 10101 and 11110 is

  1. A.

    2

  2. B.

    3

  3. C.

    4

  4. D.

    5

Attempted by 616 students.

Show answer & explanation

Correct answer: B

Solution: Compare the two bit strings position by position to count differing bits.

  1. Write the two bit strings aligned: 10101 and 11110.

  2. Compare each position: 1 vs 1 (same), 0 vs 1 (different), 1 vs 1 (same), 0 vs 1 (different), 1 vs 0 (different).

  3. Count the differing positions: there are 3 differences (positions 2, 4, and 5). Therefore the Hamming distance is 3.

Answer: 3

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Tpsc Assistant Technical Officer