Related Articles

Related Articles

GATE | GATE-IT-2004 | Question 42
  • Last Updated : 02 Dec, 2015

Using a 4-bit 2’s complement arithmetic, which of the following additions will result in an overflow?

  1. 1100 + 1100
  2. 0011 + 0111
  3. 1111 + 0111

(A) (i) only
(B) (ii) only
(C) (iii) only
(D) (i) and (iii) only

Answer: (B)

Explanation: The rules for detecting overflow in a two’s complement sum are :

  1. If the sum of two positive numbers yields a negative result;(+A) + (+B) = −C
  2. If the sum of two negative numbers yields a positive result;(−A) + (−B) = +C
  3. Otherwise, the sum has not overflowed.

4-bit Two’s Complement numbers range from (−8 ≤ x ≤ +7); Only ii will cause overflow after solving

  • Another way to detect: The OVERFLOW flag is the XOR of the carry coming into the sign bit (if any) with the carry going out of the sign bit (if any). Overflow happens if the carry in does not equal the carry out

Quiz of this Question


My Personal Notes arrow_drop_up
Recommended Articles
Page :