# GATE | GATE-CS-2017 (Set 2) | Question 55

Consider a binary code that consists only four valid codewords as given below.

00000, 01011, 10101, 11110

Let minimum Hamming distance of code be p and maximum number of erroneous bits that can be corrected by the code be q. The value of p and q are:

(A) p = 3 and q = 1
(B) p = 3 and q = 2
(C) p = 4 and q = 1
(D) p = 4 and q = 2

Explanation: We need to find minimum hamming distance(difference in their corresponding bit position)

```00000, 01011, 10101, 11110

For two binary strings, hamming distance is number
of ones in XOR of the two strings.

Hamming distance of first and second is 3, so is
for first and third. Hamming distance of first and
fourth is 4.

Hamming distance of second and third is 4, and
second and fourth is 3.

Hamming distance of third and fourth is 3.

Thus a code with minimum Hamming distance d
between its codewords can detect at most d-1
errors and can correct ⌊(d-1)/2⌋ errors.

Here d = 3. So number of errors that can be
corrected is 1.```
My Personal Notes arrow_drop_up
Article Tags :

1

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.