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:

B=1111 1111 1111 01012B = 1111\ 1111\ 1111\ 0101_2

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:

  1. Bitwise NOT (1's complement):
0000 0000 0000 101020000\ 0000\ 0000\ 1010_2
  1. Add 1:
0000 0000 0000 101120000\ 0000\ 0000\ 1011_2

Converting 101121011_2 to decimal gives 8+2+1=118 + 2 + 1 = 11.
Since the original sign bit was 1, the decimal value is −11-11.

Final answer

-11

Common trap

Treating the string as unsigned binary (6552565525) 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.