BCD representation — decimal 16 as packed two-digit BCD What is the correct 8-bit BCD code for the decimal number 16 (with tens and ones encoded as 4 bits each)?
-
A00010110
-
B00010000
-
C00010010
-
D11100000
Answer
Correct Answer: 00010110
Explanation
Introduction / Context:In packed BCD, each decimal digit is encoded using 4 bits (a nibble). Two digits therefore occupy one byte. This format is common in calculators, financial processors, and display drivers where exact decimal digits are required.
Given Data / Assumptions:
- Target value: 16 decimal → digits 1 and 6.
- BCD digit mapping: 0–9 → 0000–1001.
- Packed format: high nibble = tens, low nibble = ones.
Concept / Approach:Encode 1 as 0001 and 6 as 0110. Place 0001 in the high nibble (tens place) and 0110 in the low nibble (ones place). Concatenate to form one byte.
Step-by-Step Solution:
1) Tens digit 1 → 0001.2) Ones digit 6 → 0110.3) Byte = 0001 0110 → 00010110.4) Confirm both nibbles are valid BCD (≤1001).Verification / Alternative check:Interpret 00010110 as BCD: high nibble 0001 = 1, low nibble 0110 = 6 → 16 decimal, confirming the encoding.
Why Other Options Are Wrong:
- 00010000: encodes 10, not 16.
- 00010010: encodes 12, not 16.
- 11100000: not valid BCD nibbles for 1 and 6.
Common Pitfalls:Confusing pure binary for BCD or swapping nibbles (placing ones in the high nibble).
Final Answer:00010110