Let us consider 2 n bit binary numbers, A and B in their 2’s complement form. Where A = An-1….A1A0 and B = Bn-1….B1B0.
Let their sum, S = SnSn-1….S1S0
Then overflow occurs whenever:
- An-1.Bn-1.(Sn-1)’ + (An-1)’. (Bn-1)’. Sn-1 = 1
- Cn XOR Cn-1 = 1 , where Cn and Cn-1 are the carry bits for nth and (n-1)th bit respectively.
Hence, option b is the only answer.