in Digital Logic edited by
14,252 views
24 votes
24 votes

The addition of $4-bit$, two's complement, binary numbers $1101$ and $0100$ results in

  1. $0001$ and an overflow
  2. $1001$ and no overflow
  3. $0001$ and no overflow
  4. $1001$ and an overflow
in Digital Logic edited by
14.3k views

2 Comments

edited by
$\left ( 1101 \right )_2 = (-3)_{10}$

$\left ( 0100 \right )_2 = (+4)_{10}$

A positive and a negative number will never result in an overflow
8
8

Overflow condition can be written in any of the three ways – 

  1. $C_{n} \oplus C_{n-1}=1$ which says that either 1st MSB or 2nd MSB should give carry but not both.
  2. $A_{n}B_{n}\bar{C_{n-1}} + \bar{A_{n}}\bar{B_{n}}C_{n-1}=1$ where $A_n$ and $B_n$ are the MSB (which are sign bits) and $C_{n-1}$ is the carry from the 2nd MSB.
  3. $A_{n}B_{n}\bar{R_{n}} + \bar{A_{n}}\bar{B_{n}}R_{n}=1$ where $R_{n}$ is the MSB (sign bit) of result of the addition.

From the third condition above, we can see that overflow will happen when:

 1. $A_n,B_n$ is 0 (which means positive numbers) and $R_n$ is 1 (which means a negative number).

2. $A_n,B_n$ is 1 (which means both are negative numbers) and $R_n$ 0 (which means a positive number).

Conclusion: For overflow to happen, two positive numbers are added and the result is negative OR two negative numbers are added and the result is positive.

In the above question, one number is positive and the other is negative so there will be no overflow in the resulting number and the sum will be simply $0001$, Overflow = $0$, Carry = $1$.

PS: 2nd result can be derived from 1st result by replacing the value of $C_n$ with $A_nB_n + C_{n-1}(A_n \oplus B_n)$ and 3rd result can be derived from the 2nd result by thinking a bit. Let me know if you find it difficult to derive it.

2
2

3 Answers

63 votes
63 votes
Best answer

Answer: C.

The addition results in $0001$ and no overflow with $1$ as carry bit.

In 2's complement addition Overflow happens only when:

  • Sign bit of two input numbers is $0$, and the result has sign bit $1$.
  • Sign bit of two input numbers is $1$, and the result has sign bit $0$.
edited by

4 Comments

Thanks. I got it now.
1
1

@Kabir5454 @ankitgupta.1729

I am forgetting a small concept,

when we do the 2’s complement of the given negative number and then do the addition. In above e.g  we are directly adding.

0
0

@GateOverflow04 When you are asked to perform binary subtraction, say $A-B$. Then you take the 2’s complement of $B$, then it becomes $(-B)$. After that we perform addition of $A+(-B)$ to get the required result of $A-B$

In above eg, they are asking the addition of two binary numbers already in 2's complement from. So no need to take 2's complement. Here you just do simple addition and check if Carry In = Carry Out -> No overflow. Else overflow

2
2
1 vote
1 vote

when ever positive and negative no is added it may cause over flow

1 flag:
✌ Low quality (abir_banerjee)

1 comment

Addition of positive and negative number can never cause an overlow.
1
1
–3 votes
–3 votes
2's complement of 1101 is 0011

2,s complement of 0100 is 1100

now we add 0011 nd 1100 gives 1111

so it doesnot give any extra bit in carry so no overflow nd convert 1111 in original form of no 0001

so (c) option is correct

1 comment

Can we calculate the 2's complement of a positive no. as you mentioned?

So, far my knowledge is concerned 2's complement notation of a positive no. is the  no. itself.

Can you please help me with this
1
1
Answer:

Related questions