1. Write these numbers in two’s complement (8 bits, 7 bits + 1 sign bit):
+12
+7
+32
+18
2. Write these numbers in ones’ complement (8 bits, 7 bits + 1 sign bit):
-9
-15
-17
-26
-30
-39
3. Write these numbers in two’s complement (8 bits, 7 bits + 1 sign bit):
-10
-16
-19
-28
-31
-42
-52
-47
4. Add these numbers in two’s complement (8 bits, 7 bits + 1 sign bit). Show your carrying above the columns.
(+1)+(+9)
(+7)+(+12)
(+3)+(-4)
(+6)+(-9)
(+11)+(-19)
(+2)+(-18)
(-3)+(+6)
(-8)+(+12)
(-6)+(+4)
(-3)+(-7)
(-9)+(-4)
(-5)+(-18)
5. What are the advantages of using two’s complement over
just a sign bit? What are the disadvantages? (Name 2 advantages and 2
disadvantages)
6. What is the decimal equivalent of the largest signed binary integer that can be obtained with:
3 bits?
5 bits?
8 bits?
20 bits?
32 bits?
Derive a formula to determine the decimal equivalent of the largest signed binary integer that can be obtained with n bits.
You have done this question before, how is it different from when the number wasn’t a signed integer?
7. I read the following joke:
What is this?
Answer:
A computer scientist ordering 3 lunch specials.
My first thought was 01100 isn’t three in binary! How are they getting three? (think about today’s sign in two’s complement)
How should they have drawn the hand to make it unambiguous?
8. Show that twos complement works for subtraction as well as addition.