The Gateway to Computer Science Excellence

+16 votes

Best answer

Let $X$ and $Y$ represents $31$ and $- 31$ respectively in binary sign magnitude form. $X$ and $Y$ will take $6$ bits as range of sign magnitude form is $-\left(2^{(n-1)}-1\right)$ to $2^{(n-1)}-1$; where $n$ is the number of bits.

Now in question $Z= X-Y$,

$Z = 31 - (-31) = 62$

To represent $62$ in sign magnitude form we need $7\;( 6+1)$ bits.

Hence, $n+1$ bits needed.

Answer is $C$.

Now in question $Z= X-Y$,

$Z = 31 - (-31) = 62$

To represent $62$ in sign magnitude form we need $7\;( 6+1)$ bits.

Hence, $n+1$ bits needed.

Answer is $C$.

+6 votes

No overflow if two number with opposite sign are added.

Here $(X+(-Y))$ wont give any overflow if sign of $X$ and $-Y$ are opposite else it may cause overflow.

Nothing mentioned in question so in worst case it will give overflow.

Additional bit needed to handle overflow.

Total $n+1$ bits needed.

Here $(X+(-Y))$ wont give any overflow if sign of $X$ and $-Y$ are opposite else it may cause overflow.

Nothing mentioned in question so in worst case it will give overflow.

Additional bit needed to handle overflow.

Total $n+1$ bits needed.

+1 vote

N bits..

Who feel they will challenge please message me the email so that I can send links

Actually in sign magnitude addition and subtraction are different.in 1 and 2's we can do subtraction using adder.but here we have different.so 31-(-31) will get changed to problem of adder

Who feel they will challenge please message me the email so that I can send links

Actually in sign magnitude addition and subtraction are different.in 1 and 2's we can do subtraction using adder.but here we have different.so 31-(-31) will get changed to problem of adder

0 votes

Overflow can occur when two same sign numbers are added or two opposite sign numbers are subtracted. *For example:*

let n = 4 bit, X = +6 and Y = -5 (1 bit for sign and 3 bit for magnitude) Therefore, Z = X - Y = 6 - (-5) = 6+5 = 11 But result (Z) 11 needs 5 (= 4 + 1) bits to store, Sin integer 11 needs 1 bit for sign and 4 bit for magnitude.

Therefore, to avoid overflow, the representation of Z would require a minimum of **(n + 1)**bits. Option (C) is correct.

–1 vote

The question asked is the minimum number of bits required to **REPRESENT Z** and NOT minimum number of bits to calculate Z. Strictly speaking this question is all about the HARDWARE implementation of sign magnitude addition and subtraction of 2 numbers, X and Y and not just paper and pencil arithmetic, a frequently asked question in Research Programme Interviews in COA. This is explained in detail on **page 417, chap.10, Digital Logic and Design by Moris Mano, 13th impression, 2011**. Exactly * 8 conditions* arise when X and Y are added or subtracted .i.e.$(\pm X) \pm ( \pm Y)$ . The n+1 bit is the overflow bit used to determine the relative magnitutes of X and Y. It is not used in the computation of Z as the nth bit of all sign magnitude numbers indicate whether the given number is positive or negative number. Hence, the number of bits required to

**There are 3 other questions with ambiguous answer : Q. 29, 40, 50. **

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.3k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.5k
- Others 1.5k
- Admissions 595
- Exam Queries 576
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 17

50,647 questions

56,492 answers

195,439 comments

100,711 users