Skip to content

GATE CS 2006 Q39 — Number Representations (Fixed and Floating Point)

Explain with AI

We consider the addition of two 2′s2's complement numbers bn−1bn−2…b0b_{n-1}b_{n-2}\dots b_{0} and an−1an−2…a0a_{n-1}a_{n-2}\dots a_{0}. A binary adder for adding unsigned binary numbers is used to add  the two numbers. The sum is denoted by cn−1cn−2…c0c_{n-1}c_{n-2}\dots c_{0} and the carry-out by coutc_{out}. Which one of the following options correctly identifies the overflow condition?

Choose one option
View worked solution

Answer: B

In 22's complement representation, the most significant bit (MSB) acts as the sign bit (00 for positive numbers and 11 for negative numbers). Here, the sign bits of the two numbers are an−1a_{n-1} and bn−1b_{n-1}, and the sign bit of the resulting sum is cn−1c_{n-1}.

An overflow in 22's complement addition occurs if and only if adding two numbers of the same sign yields a result with the opposite sign. Adding two numbers of opposite signs can never result in an overflow.

This gives us two mutually exclusive scenarios for overflow:

  1. Adding two negative numbers yields a positive sum:
    • Both inputs are negative: an−1=1a_{n-1} = 1 and bn−1=1b_{n-1} = 1
    • The sum is positive: cn−1=0c_{n-1} = 0
    • Boolean term: an−1bn−1cn−1‾a_{n-1} b_{n-1} \overline{c_{n-1}}
  2. Adding two positive numbers yields a negative sum:
    • Both inputs are positive: an−1=0a_{n-1} = 0 and bn−1=0b_{n-1} = 0
    • The sum is negative: cn−1=1c_{n-1} = 1
    • Boolean term: an−1‾ bn−1‾cn−1\overline{a_{n-1}} \, \overline{b_{n-1}} c_{n-1}

Combining these two conditions using the logical OR operator, we get the complete overflow condition:

Overflow=an−1bn−1cn−1‾+an−1‾bn−1‾cn−1\text{Overflow} = a_{n-1}b_{n-1}\overline{c_{n-1}} + \overline{a_{n-1}}\overline{b_{n-1}}c_{n-1}

This matches Option B.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Number Representations (Fixed and Floating Point) questions