Question:

In a system, numbers are represented using 4-bit two's complement form. Consider four numbers \(N1 = 1011\), \(N2 = 1101\), \(N3 = 1010\) and \(N4 = 1001\) in the system. Which of the following operations will result in arithmetic overflow?

Show Hint

The 4-bit two's complement range is -8 to 7; find the true decimal sum or difference of each pair and check whether it falls outside this range.
Updated On: Jul 22, 2026
  • \(N1 + N2\)
  • \(N2 + N3\)
  • \(N3 - N4\)
  • \(N1 + N4\)
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B, D

Solution and Explanation

Step 1: Decode each 4-bit two's complement number.
In 4-bit two's complement, a number \(b_3b_2b_1b_0\) has the value
\[ -8b_3 + 4b_2 + 2b_1 + b_0 \]
Applying this:
\(N1 = 1011 \Rightarrow -8+0+2+1 = -5\)
\(N2 = 1101 \Rightarrow -8+4+0+1 = -3\)
\(N3 = 1010 \Rightarrow -8+0+2+0 = -6\)
\(N4 = 1001 \Rightarrow -8+0+0+1 = -7\)
The representable range for 4-bit two's complement numbers is \(-8\) to \(7\). Any true result falling outside this range cannot be stored correctly, and that mismatch is what overflow means.

Step 2: Recall the overflow rule.
For addition, overflow occurs exactly when the carry going into the sign bit is different from the carry coming out of the sign bit.

Step 3: Check option (A), \(N1+N2\).
\[ 1011 + 1101 \]
Adding bit by bit from the right: bit 0 gives \(1+1=10\), write \(0\) carry \(1\). Bit 1 gives \(1+0+1=10\), write \(0\) carry \(1\). Bit 2 gives \(0+1+1=10\), write \(0\) carry \(1\). Bit 3, the sign bit, gives \(1+1+1=11\), write \(1\) carry \(1\).
Result is \(1000\). Carry into the sign bit is \(1\) (from bit 2), and carry out of the sign bit is also \(1\). These match, so there is no overflow.
Checking with decimal values, \(N1+N2 = -5+(-3) = -8\), which lies inside the range \([-8,7]\), and \(1000\) does decode to \(-8\). Correct, no overflow. Option (A) does not overflow.

Step 4: Check option (B), \(N2+N3\).
\[ 1101 + 1010 \]
Bit 0: \(1+0=1\), carry \(0\). Bit 1: \(0+1=1\), carry \(0\). Bit 2: \(1+0+0=1\), carry \(0\). Bit 3: \(1+1+0=10\), write \(0\), carry \(1\).
Result is \(0111\). Carry into the sign bit is \(0\) (from bit 2), carry out of the sign bit is \(1\). These differ, so there is overflow.
Checking with decimal values confirms this: \(N2+N3 = -3+(-6) = -9\), which falls outside the range \([-8,7]\), while the computed bit pattern \(0111\) wrongly decodes to \(+7\). Option (B) overflows.

Step 5: Check option (C), \(N3-N4\).
Subtraction is done by adding the two's complement of \(N4\). Flipping \(N4 = 1001\) bit by bit gives \(0110\), and adding \(1\) gives \(0111\), the representation of \(+7\), which matches \(-N4 = 7\) since \(N4=-7\).
Now add \(N3 + (-N4)\):
\[ 1010 + 0111 \]
Bit 0: \(0+1=1\), carry \(0\). Bit 1: \(1+1=10\), write \(0\), carry \(1\). Bit 2: \(0+1+1=10\), write \(0\), carry \(1\). Bit 3: \(1+0+1=10\), write \(0\), carry \(1\).
Result is \(0001\). Carry into the sign bit is \(1\), and carry out of the sign bit is \(1\). These match, so there is no overflow.
Checking with decimal values, \(N3-N4 = -6-(-7) = 1\), which lies inside the range and matches \(0001 = 1\). Option (C) does not overflow.

Step 6: Check option (D), \(N1+N4\).
\[ 1011 + 1001 \]
Bit 0: \(1+1=10\), write \(0\), carry \(1\). Bit 1: \(1+0+1=10\), write \(0\), carry \(1\). Bit 2: \(0+0+1=1\), carry \(0\). Bit 3: \(1+1+0=10\), write \(0\), carry \(1\).
Result is \(0100\). Carry into the sign bit is \(0\) (from bit 2), carry out of the sign bit is \(1\). These differ, so there is overflow.
Checking with decimal values, \(N1+N4 = -5+(-7) = -12\), which falls outside the range \([-8,7]\), while the wrong bit pattern \(0100\) decodes to \(+4\). Option (D) overflows.

Final Answer:
Overflow occurs in \(N2+N3\) and \(N1+N4\), because both true sums fall outside the representable range \([-8,7]\).
\[ \boxed{N2+N3 \text{ and } N1+N4} \]
Was this answer helpful?
0
0

Top GATE CS Computer Organization and Architecture Questions

View More Questions