GATE / CS ARCHIVE

GATE CSE 2002 / QUESTION 1.16

Purpose of sign extension

Digital Logic · Number Systems & Computer Arithmetic · Full GATE CSE 2002 paper

GATE 2002, Q1.16 1 mark · MCQ
Report issue

Number Systems & Computer Arithmetic

Question 1.16, GATE 2002: In which operation is sign extension a step?
(A) Floating-point multiplication; (B) Signed 16-bit integer addition; (C) Arithmetic left shift; (D) Conversion of a signed integer from one size to another.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

Step 1: Compare zero extension with sign extension.

Step 2: For a positive number, the sign bit is zero, so sign extension simply adds leading zeros. For a negative number, adding leading ones preserves the signed interpretation: 10001 has unsigned value 17−32=−15, and 11110001 has unsigned value 241−256=−15. Zero-extending 10001 would instead yield+17.

Conclusion: When a signed two’s-complement integer is widened, copy its sign bit into the new high-order positions. This preserves the numerical value; for example 10001₂ (5-bit−15) becomes 11110001₂ (8-bit−15). This is the size-conversion operation in D.

Original paper, page 2