Make your own free website on Tripod.com

Answers Chapter 1

Exercise 1.1: 128+64+32+16+8+4 = 252

Exercise 1.2: 257 = 256+1 = 100000001 binary

257/2 = 128 remains 1 --> 1
128/2 = 64 remains 0 --> 0
64/2 = 32 remains 0 --> 0
32/2 = 16 remains 0 --> 0
16/2 = 8 remains 0 --> 0
8/2 = 4 remains 0 --> 0
4/2 = 2 remains 0 --> 0
2/2 = 1 remains 0 --> 0
1/2 = 0 remains 1 --> 1

Exercise 1.3:
19/2 = 9 remains 1 --> 1
9/2 = 4 remains 1 --> 1
4/2 = 2 remains 0 --> 0
2/2 = 1 remains 0 --> 0
1/2 = 0 remains 1 --> 1

"19" decimal is "10011" binary

"10011" binary is: = 20 + 21 + 24 = 1 + 2 + 16 = 19

Exercise 1.4:

101
1010

1111   = 20 + 21 + 22 + 23
= 15

Exercise 1.5: 10000. No, it needs 5 bits.

Exercise 1.6: 10000101

Exercise 1.7: 11111001

Exercise 1.8: 01111111

127/2 = 63 remains 1 --> 1
63/2 = 31 remains 1 --> 1
31/2 = 15 remains 1 --> 1
15/2 = 7 remains 1 --> 1
7/2 = 3 remains 1 --> 1
3/2 = 1 remains 1 --> 1
1/2 = 0 remains 1 --> 1

Exercise 1.9: "+128" is 10000000

one's complement of 10000000 is  01111111
                     adding 1  +        1
                              ------------
                         -128  = 10000000

Exercise 1.10: Largest number in 7 bits is 28-1, which is 127. Smallest number in one's complement is -(28-1), which is -127. The smallest two's complement is even 1 smaller: -(28-1 + 1), which is -128.

Exercise 1.11: 20 is 00010100

20/2 is 10 remainder 0 --> 0
10/2 is 5 remainder 0 --> 0
5/2 is 2 remainder 1 --> 1
2/2 is 1 remainder 0 --> 0
1/2 is 0 remainder 1 --> 1

one's complement of 00010100 is  11101011
                     adding 1  +        1
                              ------------
                          -20  = 11101100
one's complement of 11101100 is  00010011
                     adding 1  +        1
                              ------------
                           20  = 00010100

which is the same as before:

22 + 24   = 4 + 16
= 20

Exercise 1.12:

  10111111 [ -65]              11111010 [ -6 ]
+ 11000001 [ -63]            + 11111001 [ -7 ]
------------------           ------------------
= 00000000 V:  0  C:  1      = 11110011 V:  0  C:  1 
x CORRECT    ERROR           x CORRECT    ERROR

  00010000 [ 16 ]              01111110 [ 126]
+ 01000000 [ 64 ]            + 00101010 [  42]
------------------           ------------------
= 01010000 V:  0  C:  0      = 10101000 V:  1  C:  0 
x CORRECT    ERROR             CORRECT  x ERROR

Exercise 1.13: No, because the result has a magnitude that is always less then 128, so that will always fit into seven bits.

Exercise 1.14:

largest number is + (215-1) = 32767
smallest number is  - (215-1 +1)  -32768

Exercise 1.15: largest negative number is - (223-1 +1) = -8388608

Exercise 1.16:

"29" is in packed BCD "00101001"
"91" is in packed BCD "10010001"

Exercise 1.17: No, because the four bits "1010" of the first BCD digit is not valid; it is one of the six unused bit combinations.

Exercise 1.18:

BCD:                        0000 0101 0001 0010 0011 0001 0010 0011
23123 in binary:            0101 1010 0101 0011
-23123 in two's complement: 1010 0101 1010 1101

23123/2 is 11561 remains 1 --> 1
11561/2 is 5780 remains 1 --> 1
5780/2 is 2890 remains 0 --> 0
2890/2 is 1445 remains 0 --> 0
1445/2 is 722 remains 1 --> 1
722/2 is 361 remains 0 --> 0
361/2 is 180 remains 1 --> 1
180/2 is 90 remains 0 --> 0
90/2 is 45 remains 0 --> 0
45/2 is 22 remains 1 --> 1
22/2 is 11 remains 0 --> 0
11/2 is 5 remains 1 --> 1
5/2 is 2 remains 1 --> 1
2/2 is 1 remains 0 --> 0
1/2 is 0 remains 1 --> 1

one's complement of 23123 is   1010 0101 1010 1100
                  adding 1   +                   1
                             ----------------------
                    -12123   = 1010 0101 1010 1101

Exercise 1.19:

"222" is 0000 0011 0000 0010 0010 0010
"111" is 0000 0011 0000 0001 0001 0001

222 × 111 is 24642

"24642" is 0000 0101 0000 0010 0100 0110 0100 0010

Exercise 1.20: BCD needs 32 bits, two's complement needs 16 bits.

BCD "9999" is               0000 0100 0000 1001 1001 1001 1001 1001
two's complement "9999" is  0010 0111 0000 1111

9999/2 is 4999 remains 1 --> 1
4999/2 is 2499 remains 1 --> 1
2499/2 is 1249 remains 1 --> 1
1249/2 is 624 remains 1 --> 1
624/2 is 312 remains 0 --> 0
312/2 is 156 remains 0 --> 0
156/2 is 78 remains 0 --> 0
78/2 is 39 remains 0 --> 0
39/2 is 19 remains 1 --> 1
19/2 is 9 remains 1 --> 1
9/2 is 4 remains 1 --> 1
4/2 is 2 remains 0 --> 0
2/2 is 1 remains 0 --> 0
1/2 is 0 remains 1 --> 1

Exercise 1.21: 7 decimal digits.

largest positive number is 223-1: 8,388,607
largest negative number is -223: -8,388,608

Exercise 1.22:

"0" in even parity is "0 0110000"
"1" ,, ,, ,, ,, is "1 0110001"
"2" ,, ,, ,, ,, is "1 0110010"
"3" ,, ,, ,, ,, is "0 0110011"
"4" ,, ,, ,, ,, is "1 0110100"
"5" ,, ,, ,, ,, is "0 0110101"
"6" ,, ,, ,, ,, is "0 0110110"
"7" ,, ,, ,, ,, is "1 0110111"
"8" ,, ,, ,, ,, is "1 0111000"
"9" ,, ,, ,, ,, is "0 0111001"

Exercise 1.23:

"A" in even parity is "0 1000001"
"B" ,, ,, ,, ,, is "0 1000010"
"C" ,, ,, ,, ,, is "1 1000011"
"D" ,, ,, ,, ,, is "0 1000100"
"E" ,, ,, ,, ,, is "1 1000101"
"F" ,, ,, ,, ,, is "1 1000110"

Exercise 1.24:

"A" in non-parity ASCII is "0 1000001"
"?" ,, ,, ,, ,, is "0 0111111"
"3" ,, ,, ,, ,, is "0 0110011"
"b" ,, ,, ,, ,, is "0 1100010"

Exercise 1.25: "1010 1010" binary is hexadecimal "AA".

Exercise 1.26: "FA" hexadecimal is binary "1111 1010"

Exercise 1.27: "01 000 001" binary is octal "101".

Exercise 1.28: Addition and subtraction is simple.

Exercise 1.29:

1024 is 210, which is in direct binary
in signed binary 00000100 00000000
in two's complement

Exercise 1.30: The V-bit is the overflow bit, which shows if a signed number has changed sign after an operation unintentionally. In practice, the overflow should only be acted upon in two's complement representation, and can be ignored in direct (unsigned) binary representation.

Exercise 1.31:

+16 in two's complement is 00010000
+17 in two's complement is 00010001
+18 in two's complement is 00010010
-16 in one's complement is 11101111
-16 in two's complement is 11110000
-17 in one's complement is 11101110
-17 in two's complement is 11101111
-18 in one's complement is 11101101
-18 in two's complement is 11101110

Exercise 1.32: 4D 45 53 53 41 47 45

M 4D
E 45
S 53
S 53
A 41
G 47
E 45