The 4-bit two’s complement value 1011 is sign-extended to 8 bits. What is the result?
Correct answer B. 11111011
Sign extension copies the sign bit into all new high-order positions, so 1011 (-5) becomes 11111011, which is still -5. Padding with zeros (00001011) would turn it into +11, which is zero extension and is only correct for unsigned values. 10001011 is how a sign-magnitude number would be widened. Sign extension is what instructions use when loading a signed byte into a wider register.
Answer checked How we write and check questions
Discussion