Consider a system that uses 5 bits for representing signed integers in 2’s complement format. In this system, two integers \(A\) and \(B\) are represented as \(A\)=01010 and \(B\)=11010. Which one of the following operations will result in either an arithmetic overflow or an arithmetic underflow?
Answer
(B)
Explanation
With 5 bits, 2’s complement covers \(-16\) to \(+15\). Decode the operands: \(A = 01010 = +10\), and \(B = 11010 = -6\) (invert and add 1 to get \(00110 = 6\)).
- \(A + B = 4\): in range.
- \(A - B = 10 + 6 = 16\): above \(+15\), so it overflows; the 5-bit result 10000 would read as \(-16\).
- \(B - A = -16\): exactly the most negative value, so it fits.
- \(2 * B = -12\): in range.
Only \(A - B\) leaves the representable range.
Answer: B