Which of the following binary codes for decimal digits are self complementing?…
2019
Which of the following binary codes for decimal digits are self complementing?
(a) 8421 code
(b) 2421 code
(c) excess-3 code
(d) excess-3 gray code
Choose the correct option:
- A.
(a) and (b)
- B.
(b) and (c)
- C.
(c) and (d)
- D.
(d) and (a)
Attempted by 769 students.
Show answer & explanation
Correct answer: B
Correct answer: 2421 code and excess-3 code.
Definition: A code is self-complementing if the bitwise complement of the codeword for digit d equals the codeword for 9−d.
2421 code: This is a weighted code with weights 2, 4, 2, 1. The sum of weights is 2+4+2+1 = 9, so when every bit is complemented the represented value becomes 9 minus the original value. Therefore the bitwise complement of the code for d is the code for 9−d, and 2421 is self-complementing.
Excess-3 code: Each digit d is represented by the 4-bit binary of (d+3). The bitwise complement of binary(d+3) equals binary(15−(d+3)) = binary(12−d) = binary((9−d)+3), which is exactly the excess-3 code for 9−d. Example: excess-3 for 2 is binary(5)=0101 and for 7 is binary(10)=1010, which are complements.
Why the other codes fail:
8421 code is not self-complementing because its weights sum to 8+4+2+1 = 15, not 9; bitwise complementing a 8421 codeword does not produce the 9's complement codeword.
Excess-3 Gray code is not self-complementing because applying Gray coding to excess-3 codewords breaks the direct bitwise-complement relation; the Gray transform does not map complements to complements in general.
A video solution is available for this question — log in and enroll to watch it.