GATE / CS ARCHIVE

GATE CSE 2025 SET 1 / QUESTION 25

Sign-extending negative two’s-complement numbers

Digital Logic · Number Systems & Computer Arithmetic · Full GATE CSE 2025 Set 1 paper

GATE 2025 Set 1, Q25 1 mark · MSQ
Report issue

Number Systems & Computer Arithmetic

Question 25, GATE 2025: The four-bit two’s-complement encoding of −6 is 1010. Which wider encodings still represent −6? A eight-bit 10001010; B eight-bit 11111010; C sixteen-bit 1000000000001010; D sixteen-bit 1111111111111010.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, D

Step through it (10 steps)

Approach: Extend the sign bit, not zeros, when widening a signed two’s-complement representation.
In w bits, a word with leading bit 1 represents its unsigned value minus 2w. The four-bit word 1010 has unsigned value 10, so 10−16=−6. To preserve that signed value when adding high-order bits, copy the leading 1 into every new position.
For eight bits this gives 11111010, with unsigned value 250 and signed value 250−256=−6. For sixteen bits it gives 1111111111111010, with unsigned value 65530 and signed value 65530−65536=−6. Therefore B and D are correct.
A has unsigned value 138 and thus signed value −118. C has unsigned value 32778 and thus signed value −32758. Merely retaining a single leading 1 and inserting zeros is not valid sign extension; it changes the negative weight of the leading bit without compensating through the new high bits.

Original paper, page 25 · Answer key