Question
When two 8-bit numbers and in 2's complement representation (with and as the least significant bits) are added using a ripple-carry adder, the sum bits obtained are and the carry bits are . An overflow is said to have occurred if
Official answer and solution
- Official answer
- C
- From
- Official GATE 2017 answer key
Solution
Formulate the arithmetic overflow condition for 2's complement addition based on operand signs and the result sign.
In 2's complement representation, the most significant bit (MSB) is the sign bit: 0 indicates a non-negative number and 1 indicates a negative number. Here, the MSBs are for the operands and for the sum.
Overflow can only occur when adding two numbers of the same sign:
- Adding two negative numbers () yields a positive result (). This condition is represented by the Boolean product term .
- Adding two non-negative numbers () yields a negative result (). This condition is represented by the Boolean product term .
Therefore, overflow occurs if and only if:
This matches Option C.
C
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2017 Computer Science and Information Technology (CS) Session 1
- Question
- 9 of 65, printed as CS Q.9
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.