Difficulty: Easy
Correct Answer: Excess-3 code
Explanation:
Introduction / Context:Several BCD variants exist to simplify arithmetic and error detection. Excess-3 (also written XS-3) is a self-complementing code that shifts each decimal digit by 3 before encoding it in 4-bit binary. This property eases 9’s complement and subtraction operations in certain hardware designs.
Given Data / Assumptions:
Concept / Approach:By adding 3 to the decimal digit, Excess-3 ensures that the 9’s complement of a number corresponds to bitwise complement of its code, simplifying subtraction via complements. For example, digit 0 maps to 0011, 1→0100, …, 9→1100. This is not a weighted code and differs from 8421 BCD, which maps 0→0000 through 9→1001 directly without the +3 offset.
Step-by-Step Solution:
Start with digit d in 0–9.Compute d + 3.Encode the result as a 4-bit binary value.Thus obtain the Excess-3 codeword for that digit.Verification / Alternative check:Take d = 5: 5 + 3 = 8 → 1000; d = 9: 9 + 3 = 12 → 1100. The mapping matches standard XS-3 tables.
Why Other Options Are Wrong:
9's complement: arithmetic concept, not the code itself.8421: direct weighted BCD without the +3 shift.Gray: unit-distance code for sequencing, not decimal encoding.Two's complement: signed binary integer representation, not per-digit BCD.Common Pitfalls:Confusing Excess-3 with 8421 due to both using 4 bits; overlooking its self-complementing advantage for subtraction operations.
Final Answer:Excess-3 code
Discussion & Comments