To find the two's complement of β18 in 8 bits, we first write +18 as binary: 00010010β. We then invert the bits to obtain the one's complement 11101101β and add 1 to get 11101110β. This 8-bit pattern uniquely represents β18 in two's complement form. Hence, 11101110β is the correct encoding.
Option A:
Option A correctly follows the two's complement procedure: write the positive magnitude, invert all bits, and add one. The resulting pattern 11101110β yields β18 when interpreted as a signed 8-bit integer. Thus, this option matches both the algorithm and the value.
Option B:
Option B, 11101101β, is only the one's complement of +18 and does not include the final +1 step. In two's complement arithmetic, stopping at the one's complement gives the wrong numeric value. Therefore, this pattern does not represent β18.
Option C:
Option C, 11110010β, corresponds to a different negative number when decoded as two's complement (β14). It arises from using an incorrect starting magnitude or misapplying the inversion and addition process.
Option D:
Option D, 10010010β, resembles the sign-magnitude representation of β18, with the sign bit set and remaining bits for magnitude. However, two's complement is not sign-magnitude, so this pattern is not correct in that coding system.
Comment Your Answer
Please login to comment your answer.
Sign In
Sign Up
Answers commented by others
No answers commented yet. Be the first to comment!