ch02
ch02
2 Chapter 2 Solutions
2.1 The answer is 2n
2.2 For 26 characters, we need at least 5 bits. For 52 characters, we need at least 6 bits.
2.6 100000.
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 -8
1001 -7
1010 -6
1011 -5
1100 -4
1101 -3
1110 -2
1111 -1
1
2
2.9 Avogadro’s number (6.02 x 1023 ) requires 80 bits to be represented in two’s complement
binary representation.
(a) -6
(b) 90
(c) -2
(d) 14803
2.12 It is a multiple of 4.
X Y X AND Y
0 0 0
0 1 0
1 0 0
1 1 1
4
X Y X OR Y
0 0 0
0 1 1
1 0 1
1 1 1
2.35 The masks are used to set bits (by ORing a 1) and to clear bits (by ANDing a 0).
2.37 [(n AND m AND (NOT s)) OR ((NOT n) AND (NOT m) AND s)] AND 1000
2.40 (a) 2
(b) -17
(c) Positive infinity. NOTE: This was not explained in the text.
(d) -3.125
2.42 The ASCII values are being added, rather than the integer values. (ASCII ”5” is 53 in decimal,
and ASCII ”8” is 56 in decimal, adding to 109, which is ASCII ”m”.)
(d) xD4
2.49 (a) x2939
(b) x6E36
(c) x46F4
(d) xF1A8
(e) The results must be wrong. In (3), the sum of two negative numbers produced a positive
result. In (4), the sum of two positive numbers produced a negative result. We call such
additions OVERFLOW.
2.50 (a) x5468
(b) xBBFD
(c) xFFFF
(d) x32A3
2.51 (a) x644B
(b) x4428E800
(c) x48656C6C6F
2.52 Refer to the table below.
x434F4D50 x55544552
Unsigned Binary 1,129,270,608 1,431,586,130
1’s Complement 1,129,270,608 1,431,586,130
2’s Complement 1,129,270,608 1,431,586,130
IEEE 754 floating point 207.302001953125 14,587,137,097,728
ASCII String COMP UTER
2.53 Refer to the table below:
A B Q1 Q2
0 0 1 0
0 1 1 1
1 0 1 1
1 1 0 1
Q2 = A OR B
2.54 Refer to the table below:
X Y Z Q1 Q2
0 0 0 0 1
0 0 1 0 1
0 1 0 0 1
0 1 1 0 1
1 0 0 1 1
1 0 1 1 1
1 1 0 1 1
1 1 1 0 0
F.2. CHAPTER 2 SOLUTIONS 7
2.55 (a) 63
(b) 4n - 1
(c) 310
(d) 222
(e) 11011.11
(f) 0100 0001 1101 1110 0000 0000 0000 0000
(g) 44m