Number representations are
familiar to most CS majors, so this simply assignment is really just a tune-up
on information that you probably already know. However, if you’re not familiar
with binary and hex, please check in the text pp. 160-168.
1. Convert 247 into a 16-bit
two's complement binary number. Give the answer in hexadecimal.
2. Convert -504 into a
16-bit two's complement binary number. Give the answer in hexadecimal.
3. What decimal number does
this two's complement binary number represent
1111 1111 1111 1111 1111 1111 1001 1011 ?
6. What binary number does
this 32-bit two's complement hexadecimal number represent: 0fff ffff?
What decimal number does it represent? (you can use an expression of the form 2^x
+ y for the decimal number if you find it convenient)?
7. What binary number does this 32-bit two's
complement hexadecimal number represent: 8000 0000 ?
What decimal number does it represent? (you can use an expression of the form 2^x
+ y for the decimal number if you find it convenient)?
8. Assume an 8-bit register
and a 2's complement representation of integers.
·
What are the largest
positive number and the smallest negative number that you can represent (give
representations in 2's complement and their values in decimal).
·
Give examples of adding
two positive numbers with and without overflow and of subtracting a negative
number from a positive number with and without overflow. Show the 2's
complement representation of the operands and the result in a manner similar to
what is done in the book pp 161.
·
How do you test if a
number is not negative? How do you test if a number is not positive?
·
How do you test for
overflow?