# GATE | GATE-CS-2016 (Set 2) | Question 19

Let X be the number of distinct 16-bit integers in 2’s complement representation. Let Y be the number of distinct 16-bit integers in sign magnitude representation. Then X −Y is _________

[This Question was originally a Fill-in-the-blanks Question]

(A) 1
(B) 2
(C) 3
(D) 0

Explanation: For n bits, Distinct values represented in 2’s complement is -2^n-1 to 2^n-1 -1

Distinct values represented in Signed Magnitude is -(2^(n-1) -1) to 2^(n-1) -1

For example if n = 8, we can represent numbers from -128 to 127 in 2’s complement representation and numbers from -127 to 127 in signed magnitude representation.

Difference is 1. The difference of 1 is there because there are two different representations of +0 and -0 in signed magnitude representation. But in 2’s complement representation, there is one representation of 0.

My Personal Notes arrow_drop_up
Article Tags :

1

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.