Question
Consider , where and are all in sign-magnitude form. and are each represented in bits. To avoid overflow, the representation of would require a minimum of:
Official answer and solution
- Official answer
- C
- From
- Official GATE 2019 answer key
Solution
Find the range of values of the difference Z = X - Y in sign-magnitude representation and determine the minimum number of bits needed to represent it without overflow.
In an -bit sign-magnitude representation, bit is used for the sign and bits are used for the magnitude. The range of representable numbers is:
Let . The maximum possible value of occurs when and :
Similarly, the minimum possible value is:
To represent a magnitude as large as in sign-magnitude form:
Thus, the magnitude requires at least bits. Adding bit for the sign gives a total of bits.
C
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2019 Computer Science and Information Technology (CS)
- Question
- 18 of 65, printed as CS Q.8
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.