GATE 2026 CS (CS1) – Question 22
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 \quad Y: 01001100$$
Which of the following operations to compute $Z$ result(s) in an arithmetic overflow?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (B) $Z = X - Y$; (C) $Z = -X + Y$
Explanation
In 8-bit sign-magnitude representation, the MSB is the sign bit ($0$ for positive, $1$ for negative) and the remaining 7 bits represent the magnitude. The representable range of numbers is $[-(2^7 - 1), +(2^7 - 1)] = [-127, +127]$.
Decoding $X$ and $Y$:
- $X = 10110100_2$: MSB is 1 (negative). Magnitude = $0110100_2 = 32 + 16 + 4 = 52$. So $X = -52$.
- $Y = 01001100_2$: MSB is 0 (positive). Magnitude = $1001100_2 = 64 + 8 + 4 = 76$. So $Y = +76$.
Evaluating each operation:
- (A) $Z = X + Y = -52 + 76 = +24$. Since $+24 \in [-127, 127]$, it fits with no overflow.
- (B) $Z = X - Y = -52 - 76 = -128$. Since $-128 < -127$, it CANNOT be represented in 8-bit sign-magnitude format. Hence, arithmetic OVERFLOW occurs.
- (C) $Z = -X + Y = -(-52) + 76 = +52 + 76 = +128$. Since $+128 > +127$, it CANNOT be represented. Hence, arithmetic OVERFLOW occurs.
- (D) $Z = -X - Y = +52 - 76 = -24$. Since $-24 \in [-127, 127]$, it fits with no overflow.
Therefore, options (B) and (C) result in arithmetic overflow.