Question:

Consider $Z = X - Y$, where $X$, $Y$ and $Z$ are all in sign-magnitude form. $X$ and $Y$ are each represented in $n$ bits. To avoid overflow, the representation of $Z$ would require a minimum of:

Show Hint

In sign-magnitude arithmetic, subtraction can double the maximum magnitude. So, always expect {one extra bit} beyond the original word length to avoid overflow.
Updated On: Feb 8, 2026
  • $n$ bits
  • $n-1$ bits
  • $n+1$ bits
  • $n+2$ bits
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Step 1: Understand sign-magnitude representation.
In sign-magnitude representation:
-- 1 bit is used for the sign
-- Remaining $(n-1)$ bits are used for the magnitude
So, the range of values representable by an $n$-bit sign-magnitude number is: \[ -(2^{n-1}-1) \;\text{to}\; +(2^{n-1}-1) \] Step 2: Analyze the subtraction $Z = X - Y$.
Subtraction can be rewritten as: \[ Z = X + (-Y) \] The worst-case magnitude of $Z$ occurs when:
-- $X$ is the largest positive number, and
-- $Y$ is the largest negative number.
That is: \[ X = +(2^{n-1}-1), \quad Y = -(2^{n-1}-1) \] Step 3: Compute the maximum possible value of $Z$.
\[ Z_{\max} = (2^{n-1}-1) - (-(2^{n-1}-1)) = 2 \times (2^{n-1}-1) \] \[ Z_{\max} = 2^n - 2 \] Step 4: Determine the number of bits required.
To represent a magnitude close to $2^n$, we need $n$ magnitude bits.
Including the sign bit, the total number of bits required is: \[ n + 1 \] Step 5: Conclusion.
To avoid overflow in sign-magnitude representation, $Z$ must be represented using \[ \boxed{n+1 \text{ bits}} \]
Was this answer helpful?
0
0