Hamming Code Multiple Choice Questions and Answers (MCQs)

This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Hamming Code”.

1. The most common hamming codes are a generalized version of?
a) Hamming(7, 4) code
b) Hamming(8, 4) code
c) Hamming(6, 3) code
d) Hamming(5, 7) code
View Answer

Answer: a
Explanation: The most common hamming codes generalize to form hamming(7, 4) code. It encodes four bits of data into seven bits by adding three parity bits.

2. What is the minimal Hamming distance between any two correct codewords?
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: c
Explanation: Since we use a generalized version of Hamming(7, 4) code, the minimal hamming distance is 3. It cannot correct burst errors.

3. Why do we require hamming codes?
a) Error correction
b) Encryption only
c) Decryption
d) Bit stuffing
View Answer

Answer: a
Explanation: Hamming codes are used for the purpose of error detection and correction. It is also used for channel encoding and decoding. They are linear-error correcting codes.
advertisement
advertisement

4. Hamming codes can be used for both single-bit error and burst error detection and correction.
a) True
b) False
View Answer

Answer: b
Explanation: Hamming bits are suitable only for single-bit error detection and correction and two bit error detection. It is very unlikely to detect burst errors.

5. Who invented Hamming codes?
a) Richard Hamming
b) Ross Hamming
c) Shannon
d) Huffman
View Answer

Answer: a
Explanation: Richard W. Hamming invented hamming codes in Bell Telephone Laboratory to minimize the errors in punched card readers. Huffman invented huffman codes. Shannon invented Shannon-Fanno codes.

6. What is the total block length ‘n’ of a Hamming code?
a) 2r
b) 2r-1
c) 2r-1-1
d) 2r+1
View Answer

Answer: b
Explanation: Hamming codes are a class of binary linear codes, hence r>=2. For a hamming(7, 4) code, the block length ‘n’ is 2r-1 where r is the parity bit. Here, r=3.

7. What is the message length ‘k’ of a Hamming(7,4) code?
a) 2r-1
b) 2r-r+1
c) 2r-r-1
d) 2r+1-r
View Answer

Answer: c
Explanation: Hamming codes are a class of binary linear codes, hence r>=2. For a hamming(7,4) code, the message length ‘k’ is 2r-r-1 where r is the parity bit. Here, r=3.
advertisement

8. What is the rate of hamming codes?
a) 1-[r/(2r-1)]
b) 1-(r/2r)
c) 1+(r/2r)
d) r/2r+1
View Answer

Answer: a
Explanation: Rate of a hamming code is message length divided by block length (i.e.) 2r-r-1/2r-1 = 1-[r/(2r-1)]. It is the highest rate for a minimum distance of three.

9. A two-out-of-five code consists of _________
a) Two 0s and three 1s
b) Three 0s and two 1s
c) Four 0s and one 1s
d) One 0s and four 1s
View Answer

Answer: b
Explanation: A two-out-of-five code consists of three 0s and two 1s. Hence, it contains ten possible combinations to represent digits from 0-9.
advertisement

10. Including a parity bit along with the data surely detects the errors.
a) true
b) false
View Answer

Answer: b
Explanation: If error has occurred in a data string, parity will change inorder to indicate errors. However, if the error occurs in parity bit, the error goes undetected.

11. ________ is the mechanism of sending data bits multiple times to ensure consistency.
a) Repetition
b) Duplication
c) Mirroring
d) Redundancy
View Answer

Answer: a
Explanation: Repeating data bits multiple times is done to ensure consistency. If the data bit to be sent is a 1, a n=3 repetition code will send 111. If the bits are not the same, an error has occurred.

12. An Extended hamming code is also called as __________
a) SEDDEC
b) SEDDED
c) SECDED
d) SECDEC
View Answer

Answer: c
Explanation: An Extended Hamming code is also called as SECDED (Single Error Correction Double Error Detection). The most popular codes are (72, 64) code and (127,120) code.

13. What is the code rate of a repetition Hamming code (3, 1)?
a) 1
b) 3
c) 1/3
d) 1.3
View Answer

Answer: c
Explanation: The code rate of a repetition hamming code is the second number divided by the first number. Here, it is 1/3.

14. For a hamming code of parity bit m=8, what is the total bits and data bits?
a) (255, 247)
b) (127, 119)
c) (31, 26)
d) (0, 8)
View Answer

Answer: a
Explanation: Total bits are computed as, 2m-1 = 28-1 =255.
Data bits are computed as 2m-m-1= 28-8-1= 247.

15. What is the rate of the hamming code of parity bit m=8?
a) 0.94
b) 0.92
c) 0.90
d) 0.97
View Answer

Answer: d
Explanation: For a hamming code of parity bit 8, total bits = 255 and data bits = 247. Rate= data bits/ total bits
= 247/255 = 0.969 = 0.97.

Sanfoundry Global Education & Learning Series – Data Structures & Algorithms.

To practice all areas of Data Structures & Algorithms, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.