Question
The 16-bit 2's complement representation of an integer is 1111 1111 1111 0101; its decimal representation is _____.
Official answer and solution
- Official answer
- -11
- From
- Official GATE 2016 answer key
Solution
Convert a 16-bit 2's complement negative number to its signed decimal value.
We are given the 16-bit binary string:
The most significant bit (MSB) is 1, indicating that the number is negative in 2's complement representation.
To find the magnitude of the negative number, take the 2's complement:
- Bitwise NOT (1's complement):
- Add 1:
Converting to decimal gives .
Since the original sign bit was 1, the decimal value is .
-11
Treating the string as unsigned binary () instead of signed 2's complement.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2016 Computer Science and Information Technology (CS) Session 1
- Question
- 17 of 65, printed as CS Q.7
- 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.