GATE / CS ARCHIVE

GATE CSE 2002 / QUESTION 1.21

Overflow when adding opposite signs

Digital Logic · Number Systems & Computer Arithmetic · Full GATE CSE 2002 paper

GATE 2002, Q1.21 1 mark · MCQ
Report issue

Number Systems & Computer Arithmetic

Question 1.21, GATE 2002: Which statement about overflow in two’s-complement addition is correct?
(A) A carry from the sign-bit addition always flags overflow.
(B) Adding a positive value to a negative value cannot overflow.
(C) Overflow is flagged when the carries from the sign bit and the preceding bit agree.
(D) None of these.
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Step 1: Contrast carry with signed overflow.

Step 2: In four bits, 0111+0001=1000 overflows the signed range even though there is no final carry. Conversely, 1111+0001=0000 with a carry represents−1+1=0 without signed overflow. These examples rule out a carry-only test. Opposite-sign operands always have a sum between the two operands and therefore within range.

Conclusion: If a≥0 and b<0 are representable, their sum lies between b and a and remains representable. Thus opposite-sign addition cannot overflow, B. For two’s complement, overflow is the XOR of the carry into and out of the sign position, not simply the outgoing carry or equality of those carries.

Original paper, page 3