GATE / CS ARCHIVE

SIMILAR QUESTIONS / DIGITAL LOGIC

Derive signed representation range or cardinality

4 questions solved the same way, newest first. Back to Digital Logic

How these are solved

Count value bits and sign encodings, account for duplicated zero in sign magnitude/ones complement, and derive extreme representable integers or distinct-value counts. No operand arithmetic or encoding task; includes comparison of duplicate-zero cardinality.

1 mark · NAT
Report issue

Number Systems & Computer Arithmetic

Question 9, GATE 2016: X is the number of distinct integers representable in 16-bit two’s complement; Y is the corresponding number for 16-bit sign magnitude. Find X−Y.
Tap to enlarge
Answer & solution

Official answer: 1.0 : 1.0

Our answer: 1

Two’s complement has 216 distinct values. Sign magnitude has two encodings of zero, leaving 216−1 distinct values. Hence X−Y=1.

Two’s-complement range is −32768 through 32767, containing 65536 integers. Sign magnitude ranges from −32767 through 32767, containing 65535 integers. Both formats have 65536 bit patterns; the question asks distinct mathematical values, so +0 and −0 count once.

Original paper, page 27 · Answer key

1 mark · MCQ
Report issue

Eight-bit signed minimum

Number Systems & Computer Arithmetic

Question 4, GATE 2013: What is the smallest integer representable by an 8-bit two’s-complement number? A−256, B−128, C−127, D0.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

An8-bit two’s-complement integer has range−27 through 27−1, hence minimum−128, B.

The leftmost bit has weight−128 and the remaining seven bits have positive weights 64, 32, 16, 8, 4, 2, 1. To minimize the represented integer, set the negative-weight bit to 1 and all positive-weight bits to 0:10000000 represents−128. The opposite endpoint 01111111 represents 127. Unlike sign-magnitude, two’s complement has one more negative value than positive nonzero values, which explains why−127 is not the minimum.

Original paper, page 2 · Answer key

1 mark · MCQ
Report issue

Twos-complement integer range

Number Systems & Computer Arithmetic

Question 16, GATE 2005: Representable n-bit two’s-complement range? A −2^(n−1) through 2^(n−1)−1; B −(2^(n−1)−1) through 2^(n−1)−1; C −2^(n−1) through 2^(n−1); D −(2^(n−1)+1) through 2^(n−1)−1.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

The most significant bit has weight−2n−1 and the remaining bits sum from 0 to 2n−1−1. Thus the represented range is−2n−1 through 2n−1−1, A.

The most significant bit has weight−2n−1, while lower bits contribute from 0 through 2n−1−1. Setting only the sign bit gives the minimum; setting all lower bits and clearing the sign bit gives the maximum. There are exactly 2n values in the asymmetric interval, including zero once, so A.

Original paper, page 2

2 marks · MSQ
Report issue

Signed representations of zero

Number Systems & Computer Arithmetic

Question 2.17, GATE 1999: Which schemes have two zeros: sign-magnitude,ones complement,twos complement,none?
Tap to enlarge
Select all that apply
Answer & solution

Answer: A,B (no official key was published)

In sign-magnitude, magnitude bits all zero represent zero with either sign bit, producing +0 and −0. In ones complement, complementing the all-zero positive representation yields the all-one negative-zero pattern. In twos complement, negation complements then adds one, returning zero to the all-zero pattern after overflow is discarded; the all-one pattern represents −1 instead. Thus exactly A and B have two zero representations.

Original paper, page 5