Question:

Consider the 8-bit signed integers \( X, Y \) and \( Z \) represented using the sign-magnitude form. The binary representations of \( X \) and \( Y \) are as follows:
\[ X: 10110100 \qquad Y: 01001100 \]
Which of the following operations to compute \( Z \) result(s) in an arithmetic overflow?

Show Hint

Overflow in sign-magnitude addition happens only when two same-signed operands' magnitudes add up to more than 127 (7-bit limit); opposite-signed operands only ever subtract magnitudes and can never overflow.
Updated On: Jul 22, 2026
  • \( Z = X + Y \)
  • \( Z = X - Y \)
  • \( Z = -X + Y \)
  • \( Z = -X - Y \)
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B, C

Solution and Explanation

Step 1: Decode the given 8-bit sign-magnitude numbers.
The leftmost (MSB) bit is the sign bit (0 = positive, 1 = negative) and the remaining 7 bits give the magnitude.
\( X = 1\,0110100 \): sign = 1 (negative), magnitude = 0110100 = 32+16+4 = 52. So \( X = -52 \).
\( Y = 0\,1001100 \): sign = 0 (positive), magnitude = 1001100 = 64+8+4 = 76. So \( Y = +76 \).
Step 2: Recall the representable range and overflow rule for 8-bit sign-magnitude numbers.
With 1 sign bit and 7 magnitude bits, the largest storable magnitude is \( 2^7-1 = 127 \), so representable values run from -127 to +127. Overflow in sign-magnitude addition can occur only when adding two operands of the SAME sign, since their magnitudes add and may exceed 127. When the two operands have different signs, the operation reduces to a subtraction of magnitudes, which can never exceed the larger operand's magnitude, so it can never overflow.
Step 3: Evaluate (A) \( Z=X+Y \).
X is negative and Y is positive: different signs, so this is a magnitude subtraction; true value = -52+76 = 24, well inside [-127,127]. No overflow.
Step 4: Evaluate (B) \( Z=X-Y = X+(-Y) \).
X is negative (-52) and -Y is negative (-76): SAME sign, magnitudes add: 52+76 = 128. True value = -128. Since 128 > 127, this magnitude cannot be stored in the 7-bit field: arithmetic overflow.
Step 5: Evaluate (C) \( Z=-X+Y \).
-X is positive (+52) and Y is positive (+76): SAME sign, magnitudes add: 52+76=128. True value = +128. Since 128 > 127, this is also an arithmetic overflow.
Step 6: Evaluate (D) \( Z=-X-Y = (-X)+(-Y) \).
-X is positive (+52) and -Y is negative (-76): different signs, magnitude subtraction; true value = 52-76 = -24, well inside [-127,127]. No overflow.
Step 7: Conclusion.
Overflow occurs only for (B) X-Y = -128 and (C) -X+Y = +128, the two cases combining same-signed magnitudes past 127. Options (A) and (D) subtract opposite-signed magnitudes and stay in range.
\[ \boxed{\text{Options (B) and (C)}} \]
Was this answer helpful?
0
0

Top GATE CS Computer Organization and Architecture Questions

View More Questions