GATE 2016 CS (CS2) – Question 19
X is the number of distinct 16-bit two’s-complement integers; Y is the number of distinct 16-bit sign-magnitude integers. Find X − Y.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 1.0 to 1.0
Explanation
Two’s complement represents $2^{16}$ distinct integers. Sign magnitude has two encodings of zero, leaving only $2^{16}-1$ distinct integer values from the same number of bit patterns. Hence X−Y=1.