BCD encoding — three-digit number Convert the decimal number 127 into packed BCD (concatenate one 4-bit nibble per decimal digit).

Difficulty: Easy

Correct Answer: 000100100111

Explanation:


Introduction / Context:
Binary-Coded Decimal (BCD) stores each decimal digit in its own 4-bit field. For a 3-digit number like 127, we form three nibbles in order: one for 1, one for 2, and one for 7. This preserves decimal readability and simplifies display drivers and certain decimal arithmetic operations.


Given Data / Assumptions:

  • Target: 127 (decimal).
  • BCD map: 1→0001, 2→0010, 7→0111.
  • Packed representation: concatenate nibbles MS digit to LS digit without separators.


Concept / Approach:

Translate each decimal digit independently to a 4-bit nibble and concatenate in order (hundreds, tens, ones). No binary arithmetic is needed; it is a direct symbol-to-nibble mapping exercise.


Step-by-Step Solution:

Hundreds digit 1 → 0001.Tens digit 2 → 0010.Ones digit 7 → 0111.Concatenate: 0001 0010 0111 → 000100100111.


Verification / Alternative check:

Split 000100100111 into nibbles: 0001 (1), 0010 (2), 0111 (7) → 127, confirming the mapping.


Why Other Options Are Wrong:

011100100001 and 001010111 scramble nibble order or digits.

111010001 is neither proper BCD for 127 nor a correct concatenation of the required digit codes.


Common Pitfalls:

Confusing BCD with binary of 127 (which would be 1111111), or reversing digit order (721). Always encode each decimal digit as a valid nibble 0000–1001.


Final Answer:

000100100111

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion