Section 6.4
Review Questions
Converting 2's complement numbers
How does 2's complement relate to 1's complement?
87 is 1010111, after padding out to 8 bits. Find the 2's complement representation of -87.
How do 2's complement and sign-magnitude compare? Are the bit patterns similar in any way whatsoever?
What is -1 in 128-bit 2's complement? (Obviously, there is a very quick shortcut!)
What is -2 in 128-bit 2's complement? (Use a similar shortcut).
What do 2's complement and sign-magnitude have in common?
Suppose we are working with 16 bits. How many total different bit patterns are there? (This corresponds to the total number of
unsigned
binary numbers.)
Now how many signed numbers are there?
How many negative numbers are there? (Be careful!!! This is a trick question!)
How many positive numbers are there? (Again, be careful! 0 is not a positive number!)
Suppose someone gave you a 2's complement number that was obviously negative (had a 1 in the first bit). For example, 1101010000101110101. How would you go about finding the decimal equivalent of it? State the algorithm, don't just do it for this example.
Here's an 8-bit string of 1's and 0's.
01000001
Is this the ASCII value 'A'? Is it the decimal number 65? Is it a 2's complement number?