Ch02 Selected
Ch02 Selected
Selected Solutions
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
2.9 Avogadro's number (6.02 x 1023) requires 80 bits to be represented in two's complement
binary representation.
1
2 APPENDIX F. SELECTED SOLUTIONS
2.21 Overflow has occurred if both operands are positive and the result is negative, or if both
operands are negative and the result is positive.
2.23 Overflow has occurred in an unsigned addition when you get a carry out of the leftmost
bits.
2.25 Because their sum will be a number which if positive, will have a lower magnitude (less
positive) than the original positive number (because a negative number is being added
to it), and vice versa.
2.27 The problem here is that overflow has occurred as adding 2 positive numbers has
resulted in a negative number.
X Y X AND Y
0 0 0
0 1 0
1 0 0
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
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.55 (a) 63
(b) 4n – 1
(c) 310
(d) 222
(e) 11011.11
(f) 0100 0001 1101 1110 0000 0000 0000 0000
(g) 4(4^m)