Q.Write the table of 2-4-2-1 code and show that it is a self complimenting code.
[!TLDR]
The 2-4-2-1 code is a weighted BCD code whose bit-by-bit complement of any digit equals the code of its 9's complement, so it is self-complementing.
2-4-2-1 code table (weights 2, 4, 2, 1):
| Decimal | 2 4 2 1 code |
|---|---|
| 0 | 0 0 0 0 |
| 1 | 0 0 0 1 |
| 2 | 0 0 1 0 |
| 3 | 0 0 1 1 |
| 4 | 0 1 0 0 |
| 5 | 1 0 1 1 |
| 6 | 1 1 0 0 |
| 7 | 1 1 0 1 |
| 8 | 1 1 1 0 |
| 9 | 1 1 1 1 |
(For example 5 = 1011 → 2+0+2+1 = 5 and 6 = 1100 → 2+4+0+0 = 6, confirming the weights.)
Self-complementing property: A code is self-complementing if the 1's complement (bit-by-bit inversion) of the code of a digit equals the code of , its 9's complement.
| Digit D | Code | Complement of code | Digit of complement |
|---|---|---|---|
| 0 | 0000 | 1111 | 9 |
| 1 | 0001 | 1110 | 8 |
| 2 | 0010 | 1101 | 7 |
| 3 | 0011 | 1100 | 6 |
| 4 | 0100 | 1011 | 5 |
In every pair the two digits add up to 9 and their codes are exact bit complements of each other. Hence the 2-4-2-1 code is a self-complementing code.
[!ANSWER]
The 2-4-2-1 code is listed above; inverting every bit of any digit's code yields the code of its 9's complement (0↔9, 1↔8, 2↔7, 3↔6, 4↔5), which proves it is a self-complementing code.
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.