Difficulty: Easy
Correct Answer: –128 to +127
Explanation:
Introduction / Context:
Two's-complement is the dominant signed-integer representation in digital systems because it makes addition and subtraction uniform for positive and negative numbers. Understanding the numeric range for a given bit width is essential for preventing overflow and designing robust software/hardware interfaces.
Given Data / Assumptions:
Concept / Approach:
For an n-bit two's-complement number, the range is from −2^(n−1) to +2^(n−1)−1. This asymmetry occurs because there is one more negative number than positive number in the encoding (zero consumes one nonnegative code word).
Step-by-Step Solution:
1) Set n = 8.2) Compute negative bound: −2^(8−1) = −2^7 = −128.3) Compute positive bound: +2^(8−1) − 1 = 2^7 − 1 = 128 − 1 = +127.4) Therefore the representable range is −128 to +127.
Verification / Alternative check:
Check special codes: 1000 0000 represents −128 (unique, with no positive counterpart), and 0111 1111 represents +127. Zero is 0000 0000, which fits between them. This matches the stated range.
Why Other Options Are Wrong:
Ranges including +128 or excluding −128 are invalid in 8-bit two's complement.Symmetric ranges like −127 to +127 do not match two's-complement capacity.
Common Pitfalls:
Assuming symmetry about zero, or believing +128 is encodable. Attempting to negate −128 in 8 bits causes overflow, a frequent bug in low-level code.
Final Answer:
–128 to +127
Discussion & Comments