Introduction:
This question checks your understanding of two’s-complement encoding for negative integers in 8-bit binary. The core idea is that a negative value −N is represented by taking the binary of +N, inverting all bits, and then adding 1. We will test whether 11101000₂ indeed corresponds to −24 in two’s-complement representation.
Given Data / Assumptions:
- Word size = 8 bits.
- Target decimal value to verify: −24.
- Encoding scheme: two’s-complement.
- Binary arithmetic uses base-2 with carry/borrow as usual.
Concept / Approach:
To verify, convert the given code to its magnitude: for a negative two’s-complement number, compute the two’s complement again (invert and add 1) to get the absolute value. If the magnitude comes out 24 (00011000₂), then the original code is −24. Alternatively, forward-encode +24 to −24 and compare with the given pattern.
Step-by-Step Solution:
Step 1: Start from 11101000₂. Since MSB = 1, it represents a negative number.Step 2: Invert bits: 11101000 → 00010111.Step 3: Add 1: 00010111 + 1 = 00011000₂.Step 4: 00011000₂ = 16 + 8 = 24. Therefore the original pattern encodes −24.
Verification / Alternative check:
Encode −24 directly: +24 = 00011000₂ → invert 11100111 → add 1 = 11101000₂, which matches the given pattern exactly.
Why Other Options Are Wrong:
Incorrect: Contradicted by the direct conversion showing magnitude 24 after inversion and +1.Ambiguous without sign bit: In two’s complement, MSB provides the sign; ambiguity does not exist for fixed 8 bits.Depends on one’s complement: We are not using one’s complement; two’s complement adds 1 after inversion.
Common Pitfalls:
Forgetting to add 1 after inversion (that would be one’s complement, not two’s complement).Dropping the fixed 8-bit width and performing variable-length inversion.
Final Answer:
Correct
Discussion & Comments