Consider the 8-bit signed integers π, π and π represented using the sign-magnitude
form. The binary representations of π and π are as follows:
π: 10110100 π: 01001100
Which of the following operations to compute π result(s) in an arithmetic
overflow?
An alternative way to spot overflow in sign-magnitude addition is to recognize that overflow can only happen when we effectively add two magnitudes of the same sign, and the resulting magnitude needs more than 7 bits to store.
Step 1: Identify sign and magnitude.
X = 10110100 has sign bit 1 (negative) and magnitude \(0110100_2 = 52\), so \(X = -52\). Y = 01001100 has sign bit 0 (positive) and magnitude \(1001100_2 = 76\), so \(Y = 76\).
Step 2: Classify each operation as magnitude-adding or magnitude-subtracting.
For \(Z = X+Y = -52+76\): signs differ, so magnitudes subtract: \(76-52=24\), which can never exceed the larger operand (76), so no overflow is possible.
For \(Z = X-Y = -52-76\): this is the same as adding \(-52\) and \(-76\), both negative, so magnitudes ADD: \(52+76=128\), the overflow-prone case.
For \(Z = -X+Y = 52+76\): both positive, so magnitudes ADD again: \(52+76=128\), another overflow-prone case.
For \(Z = -X-Y = 52-76\): signs differ, so magnitudes subtract: \(76-52=24\), safely within range.
Step 3: Apply the 7-bit magnitude limit.
Only the two same-direction addition cases, \(X-Y\) and \(-X+Y\), produce a magnitude of 128, which needs 8 bits and cannot fit in the 7 magnitude bits available (max value 127). Both overflow.
So the operations causing overflow are \(Z=X-Y\) (option B) and \(Z=-X+Y\) (option C), matching the direct decimal computation.