Skip to main content

GATE CSE 2016Digital Logic › Number Systems & RepresentationVerified

GATE CSE 2016 PYQ: Let X X X be the number of distinct 16 16 16 -bit integers in 2 ′ s 2's 2 ′ s complement representation. Let…

Let XX be the number of distinct 16-bit integers in 2′s2's complement representation. Let YY be the number of distinct 16-bit integers in sign magnitude representation Then X−YX - Y is______.

    Answer

    1

    Approach

    For an $n$-bit encoding, count how many distinct integer values each representation can actually name. In 2's complement every one of the $2^n$ bit patterns maps to a unique integer, whereas in sign-magnitude two patterns collapse onto zero, so only $2^n - 1$ distinct integers appear. Subtract the two counts.

    2's complement uses all $2^n$ patterns for $2^n$ distinct values, while sign-magnitude wastes two patterns on a duplicated zero and thus covers only $2^n-1$ distinct values. The difference is always 1, so for 16 bits $X - Y = 65536 - 65535 = 1$.

    Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.