How do 2's complement and sign-magnitude compare? Are the bit patterns
similar in any way whatsoever?
answer...
not at all, totally dissimilar
What is -1 in 128-bit 2's complement? (Obviously, there is a very quick
shortcut!)
answer...
128 1's
What is -2 in 128-bit 2's complement? (Use a similar shortcut).
answer...
127 1's followed by a 0 (1111........110)
What do 2's complement and sign-magnitude have in common?
answer...
they both have a 1 in the first bit, often called the sign bit
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.)
answer...
216 = 65536
Now how many signed numbers are there?
answer...
65536
How many negative numbers are there? (Be careful!!! This is a trick
question!)
answer...
half that, precisely 32768
How many positive numbers are there? (Again, be careful! 0 is not a
positive number!)
answer...
about half that, but precisely 32767 (1 less than # of negatives,
because 0 uses one of the bit patterns)
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.
answer...
flip the bits and add 1, then convert that binary number to decimal
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?
answer...
It could be any of these things; it depends upon how you (or the
computer) interpret it at run-time.