GATE | GATE-IT-2004 | Question 41
Using a 4-bit 2’s complement arithmetic, which of the following additions will result in an overflow?
(i) 1100 + 1100
(ii) 0011 + 0111
(iii) 1111 + 0111
(A) (i) only
(B) (ii) only
(C) (iii) only
(D) (i) and (iii) only
Explanation: When two signed 2’s complement numbers are added, overflow is detected if:
- both operands are positive and the result is negative, or
- both operands are negative and the result is positive
When two unsigned numbers are added, overflow occurs if
- there is a carry out of the leftmost bit
With these conditions only (ii) will get an overflow
Therefore, B is the answer
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.