Open In App

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

Like Article
Like
Save
Share
Report

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


Answer: (A)

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.



Quiz of this Question


Last Updated : 27 Sep, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads