The bit string 0101 1001 can represent decimal 59 in 8421 BCD, but decimal 59 in ordinary binary is 111011. The difference is the unit being encoded: BCD handles each decimal digit separately, while pure binary represents the whole magnitude. The quickest check is to ask whether the question is coding decimal digits or representing one complete value. Learn that distinction first, then exact conversions, BCD addition and special-code recognition become manageable even under exam pressure.
1. What BCD actually represents
8421 BCD is a weighted code with bit weights 8, 4, 2 and 1. Each decimal digit receives its own four-bit group. The valid mapping runs from 0 = 0000 and 1 = 0001 through 9 = 1001. The six patterns 1010 through 1111 are invalid as individual 8421 BCD digits.
For decimal 59, code the digits separately:
5 -> 01019 -> 1001Therefore,
59 -> 0101 1001in BCD.
In ordinary binary, the whole value is converted at once: 59 = 32 + 16 + 8 + 2 + 1, so 59 -> 111011. The ideas of positional value used here come from number systems and base conversions, but the important BCD habit is to preserve the space between decimal-digit groups.
2. Encode and decode 8421 BCD without losing digit boundaries
To encode decimal 259, split it as 2 | 5 | 9. Map each digit independently:
2 -> 0010, 5 -> 0101, 9 -> 1001
Therefore, 259 -> 0010 0101 1001 in 8421 BCD. The bit string 100000011 is not the answer to this BCD question. It is the whole-number binary representation of 259 because 259 = 256 + 2 + 1.
For the reverse direction, group 0100 1001 0011 into sets of four from the right. Then 0100 = 4, 1001 = 9 and 0011 = 3, so the decimal value is 493.
Validation comes before decoding. In 0110 1010, the first nibble represents 6, but 1010 is not a valid 8421 BCD digit. The complete code is invalid, not decimal 610. Use one routine: identify the code, preserve four-bit groups, validate every group, then decode. Leading zeroes inside a nibble are data.
3. Worked BCD addition: why the correction is 0110
A four-bit BCD digit needs correction when its raw sum is greater than 1001, or when addition produces a carry out of that nibble. Add 0110 because six binary patterns, 1010 through 1111, separate the largest valid BCD digit from the next four-bit boundary. This adjustment produces the correct decimal carry and remainder.
Now add 59 + 38:
Encode
59as0101 1001and38as0011 1000.Add the units:
1001 + 1000 = 1 0001. Keep low nibble0001and carry 1 into the tens nibble. The carry means correction is required, even though0001looks valid.Including that carry, the raw two-nibble sum is
1001 0001.Add the correction to the units nibble:
1001 0001 + 0000 0110 = 1001 0111.Decode the final nibbles as 9 and 7. The answer is decimal
97, which agrees with59 + 38 = 97.
Do not add 0110 merely because a question mentions BCD. Test each digit sum. Also do not miss correction when a carry makes the retained four bits look like a valid digit.

4. Weighted, biased and self-complementing codes
8421 and 2421 are weighted codes, but 2421 uses its own conventional Aiken table. A bit pattern is not automatically a valid 2421 digit just because its weighted sum appears correct. Excess-3 is different: it is a biased, non-weighted code. Add decimal 3 to each digit, then write the adjusted digit in 8421 binary. Identify the relevant code family before interpreting bit positions or applying a complement.
Decimal digit | 8421 BCD | 2421 (Aiken) | Excess-3 |
|---|---|---|---|
0 | 0000 | 0000 | 0011 |
1 | 0001 | 0001 | 0100 |
2 | 0010 | 0010 | 0101 |
3 | 0011 | 0011 | 0110 |
4 | 0100 | 0100 | 0111 |
5 | 0101 | 1011 | 1000 |
6 | 0110 | 1100 | 1001 |
7 | 0111 | 1101 | 1010 |
8 | 1000 | 1110 | 1011 |
9 | 1001 | 1111 | 1100 |
For decimal 59 in Excess-3, calculate 5 + 3 = 8 -> 1000 and 9 + 3 = 12 -> 1100. Therefore, 59 -> 1000 1100. Add 3 to each digit, not once to the whole number.
Both 2421 and Excess-3 are self-complementing. In 2421, 2 -> 0010; its bitwise complement is 1101, the table code for 7, and 7 = 9 - 2. In Excess-3, 2 -> 0101; complementing it gives 1010, which decodes to 7. Ordinary 8421 BCD is not self-complementing.
5. Gray code: convert in both directions and test the one-bit-change property
Reflected Gray code is non-weighted, and adjacent values differ in one bit. To convert binary to Gray, copy the most significant bit, then XOR each adjacent pair of original binary bits.
For binary 10110:
g4 = b4 = 1g3 = b4 XOR b3 = 1 XOR 0 = 1g2 = b3 XOR b2 = 0 XOR 1 = 1g1 = b2 XOR b1 = 1 XOR 1 = 0g0 = b1 XOR b0 = 1 XOR 0 = 1
The Gray result is 11101. Reverse it with cumulative XOR: start with b4 = g4 = 1, then recover b3 = 0, b2 = 1, b1 = 1 and b0 = 0. This returns 10110.
The adjacency rule also survives a binary rollover. Decimal 7 is binary 0111 and Gray 0100. Decimal 8 is binary 1000 and Gray 1100. All four binary bits change, but the Gray words differ only in their leftmost bit.

6. How exam questions turn these rules into traps
Code questions usually test an operation, not a long definition. You may need to encode or decode a grouped word, reject an invalid 8421 nibble, select a defined weighted-code entry, use a self-complement, apply BCD correction, or convert between binary and Gray. The key task is to recognize the code family and apply the relevant operation, not recall a long definition.
Try four rapid checks:
BCD of
37is0011 0111, not pure binary100101.1010is invalid as a single 8421 BCD digit.Excess-3 of
29is0101 1100because2 + 3 = 5and9 + 3 = 12.The BCD sum
59 + 38is1001 0111.
Identify the code family before touching the bits. Use Number System MCQs for focused representation practice, then move into a wider digital-electronics question mix.
7. Common mistakes and the correction routine
Treating BCD as ordinary binary produces the wrong bit string. Dropping leading zeroes destroys digit boundaries, and accepting 1010 through 1111 invents decimal digits that 8421 BCD does not encode. Replace these habits with split -> map -> group -> validate.
For Excess-3, add 3 to every decimal digit, not to the full number. For 2421, use the defined table instead of inventing a word from the weights. Do not assume every four-bit code is weighted, or complement a code before confirming that it is self-complementing.
In BCD arithmetic, test every digit sum for a result above 1001 or a nibble carry before adding 0110. In binary-to-Gray conversion, XOR adjacent original binary bits. In Gray-to-binary conversion, use the previously recovered binary bit in the next cumulative XOR. Those two XOR routines look similar but use different inputs.
8. The short version and the next practice step
Keep four ideas separate: 8421 BCD codes each decimal digit, Excess-3 biases each digit by 3, 2421 follows a defined weighted table, and Gray code provides one-bit adjacency. Recheck the anchors: 59 -> 0101 1001, 59 + 38 -> 1001 0111, and binary 10110 -> Gray 11101.
Use GATE Guidance by Sanchit Sir for a structured GATE path, ZERO TO HERO for a broader CS foundation, or browse CS Fundamentals to compare the available learning routes.




