Two’s-complement range check In an 8-bit two’s-complement system, what is the range of representable positive integers (including zero)?

Difficulty: Easy

Correct Answer: 0 to 127

Explanation:


Introduction / Context:
Two’s-complement is the dominant signed number representation in computers. Knowing the numeric range prevents overflow and helps interpret register contents correctly.



Given Data / Assumptions:

  • Word size: 8 bits.
  • Two’s-complement encoding.


Concept / Approach:
For n-bit two’s-complement, the range is from −2^(n−1) to +2^(n−1) − 1. Positive numbers include zero through the maximum positive.



Step-by-Step Solution:
Compute upper bound: +2^(8−1) − 1 = 2^7 − 1 = 128 − 1 = 127.Compute lower bound: −2^7 = −128 (not part of the positive range).Thus the nonnegative (positive including zero) range is 0 to 127.


Verification / Alternative check:
Binary view: 0111 1111 is 127; 1000 0000 represents −128, confirming symmetry around zero except for the additional negative value.



Why Other Options Are Wrong:
0–64 and 0–100 understate the upper limit; 0–256 confuses unsigned range; 1–127 improperly excludes zero.


Common Pitfalls:
Mixing signed and unsigned ranges or forgetting that positive max is one less than 2^(n−1).



Final Answer:
0 to 127

Discussion & Comments

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