Two’s-complement conversion practice Convert the following 8-bit two’s-complement numbers to signed decimal: 00000101, 11111100, 11111000.

Difficulty: Easy

Correct Answer: +5 –4 –8

Explanation:


Introduction / Context:
Interpreting two’s-complement values is a core skill for embedded systems and computer architecture. This exercise reinforces the conversion of binary to signed decimal for positive and negative values.



Given Data / Assumptions:

  • Word size: 8 bits; range is –128 to +127.
  • Values: 00000101, 11111100, 11111000.
  • Two’s-complement rules apply.


Concept / Approach:
If MSB = 0, the number is positive; convert directly. If MSB = 1, the number is negative; magnitude is found by inverting all bits and adding 1, then applying a minus sign.



Step-by-Step Solution:
00000101: MSB = 0 → positive. Value = 5 → +5.11111100: MSB = 1 → negative. Invert = 00000011; add 1 → 00000100 = 4 → –4.11111000: MSB = 1 → negative. Invert = 00000111; add 1 → 00001000 = 8 → –8.


Verification / Alternative check:
Re-encode: +5 = 00000101; –4 → two’s complement of 00000100 = 11111100; –8 → two’s complement of 00001000 = 11111000. All match originals.



Why Other Options Are Wrong:
–5 +4 +8, –5 +252 +248, +5 –252 –248: These misinterpret two’s-complement and bit width.+5 +4 +8: Treats negatives as positives; incorrect signs.


Common Pitfalls:
Forgetting the add-1 step after inversion for negatives, or misreading the 8-bit range. Always check MSB and then apply the two-step conversion for negative numbers.



Final Answer:
+5 –4 –8

Discussion & Comments

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