GATE | GATE CS 2019 | Question 15
Consider Z = X − Y where X, Y and Z are all in sign-magnitude form. X and Y are each represented in n bits. To avoid overflow, the representation of Z would require a minimum of:
(A) n bits
(B) n−1 bits
(C) n+1 bits
(D) n+2 bits
Answer: (C)
Explanation: 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.
Recommended Posts:
- GATE | GATE CS 1999 | Question 36
- GATE | GATE CS Mock 2018 | Question 39
- Top 5 Topics for Each Section of GATE CS Syllabus
- How to prepare in Last 10 days to score high in GATE?
- Aptitude | GATE IT 2006 | Question 7
- Aptitude | GATE IT 2006 | Question 8
- GATE | GATE CS 2013 | Question 1
- GATE | GATE CS 2013 | Question 3
- GATE | GATE CS 2013 | Question 4
- GATE | GATE CS 2013 | Question 65
- GATE | GATE CS 2013 | Question 6
- GATE | GATE CS 2013 | Question 7
- GATE | GATE CS 2013 | Question 8
- GATE | GATE CS 2013 | Question 65
- GATE | GATE CS 2013 | Question 65


