CH 03
CH 03
Data Storage
(Solutions to Odd-Numbered Problems)
Review Questions
1. We discussed five data types: number, text, audio, image, and video.
3. In the bitmap graphic method each pixel is represented by a bit pattern.
5. The three steps are sampling, quantization, and encoding.
7. In both representations, the upper half of the range represents the negative num-
bers. However, the wrapping is different as shown in Figure S3.7. In addition,
there are two zeros in sign-and-magnitude but only one in two’s complement.
Figure S3.7
Wrapping
Minimum −0 +0 Maximum
Wrapping in sign-and-magnitude representation
Wrapping
Minimum 0 Maximum
Wrapping in two’s complement representation
9. In both systems, the leftmost bit represents the sign. If the leftmost bit is 0, the
number is positive; if it is 1, the number is negative.
1
SECTION 2
Multiple-Choice Questions
11. c 13. d 15. b 17. a 19. a 21. d
23. c 25. d 27. b
Exercises
29. 102 = 100 if zero is allowed. 92 = 81 if zero is not allowed.
31. 2n = 8 → n =3 or log28 = 3
33. 2n = 900 → n ≈ 10 or log2900 = 9.81 → 10. With n = 10 we can uniquely assign
210 = 1024 bit pattern. Then 1024 − 900 = 124 patterns are unassigned. These
unassigned patterns are not sufficient for extra 300 employees. If the company
hires 300 new employees, it is needed to increase the number of bits to 11.
35. 256 level can be represented by 8 bits because 28 = 256. Therefore, the number of
bits per seconds is
37.
a. 41 = 32 + 8 +1 = (0000 0000 0010 1001)2
b. 411 = 256 + 128 + 16 + 8 + 2 + 1 = (0000 0001 1001 1011)2
c. 1234 = 1024 + 128 + 64 + 16 + 2 = (0000 0100 1101 0010)2
d. 342 = 256 + 64 + 16 + 4 + 2 = (0000 0001 0101 0110)2
39.
a. 102 =
Convert 102 to binary 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0
b. −179 =
Convert 179 to binary 0 0 0 0 0 0 0 0 1 0 1 1 0 0 1 1
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
Apply two’s complement operation 1 1 1 1 1 1 1 1 0 1 0 0 1 1 0 1
c. 534 =
Convert 534 to binary 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0
41.
a. 0111 0111 =
Leftmost bit is 0. The sign is + 0 1 1 1 0 1 1 1
Integer changed to decimal 119
Sign is added + 119
b. 1111 1100 =
Leftmost bit is 1. The sign is − 1 1 1 1 1 1 0 0
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
Apply two’s complement operation 0 0 0 0 0 1 0 0
Integer changed to decimal 4
Sign is added −4
c. 0111 0100 =
Leftmost bit is 0. The sign is + 0 1 1 1 0 1 0 0
Integer changed to decimal 116
Sign is added + 116
d. 1100 1110 =
Leftmost bit is 1. The sign is − 1 1 0 0 1 1 1 0
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
Apply two’s complement operation 0 0 1 1 0 0 1 0
Integer changed to decimal 50
Sign is added −50
43.
a. 01110111 → 10001001 → 01110111
b. 11111100 → 00000100 → 11111100
c. 01110100 → 10001100 → 01110100
d. 11001110 → 00110010 → 11001110
45. Answers are shown with space between the three parts for clarity
a. S = 1,
E = 0 + 127 = 127 = (01111111)2,
M = 10001 (plus 18 zero added at the right to make the number of bits 23)
→ 1 01111111 10001000000000000000000
b. S = 0,
E = 3 + 127 = 130 = (10000010)2,
M = 111111 (plus 17 zero added at the right)
→ 0 10000010 11111100000000000000000
c. S = 0
E = −4 + 127 = 123 = (01111011)2,
SECTION 4
b. −107 = − (64 + 32 + 8 + 2 + 1) =
− 64 32 0 8 0 2 1
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
1 1 1 0 1 0 1 1 = 1110 1011
c. −5 = − (4+1) = 10000101
− 0 0 0 0 4 0 1
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
1 0 0 0 0 1 0 1 = 1000 0101
SECTION 5
d. 154 creates overflow because 154 is not in the range −127 to +127
51.
a. (01110111)2 =
Leftmost bit is 0. The sign is + 0 1 1 1 0 1 1 1
Integer changed to decimal 119
Sign is added +119
b. (11111100)2 =
Leftmost bit is 1. The sign is − 1 1 1 1 1 1 0 0
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
Apply one’s complement operation 0 0 0 0 0 0 1 1
Integer changed to decimal 3
Sign is added −3
c. (01110100)2 =
Leftmost bit is 0. The sign is + 0 1 1 1 0 1 0 0
Integer changed to decimal 116
Sign is added +116
d. (11001110)2 =
Leftmost bit is 1. The sign is − 1 1 0 0 1 1 1 0
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
Apply one’s complement operation 0 0 1 1 0 0 0 1
Integer changed to decimal 49
Sign is added −49
53.
a. (01110111)2
b. (11111100)2
c. (01110100)2
d. (11001110)2
55.
a. +234 → 234
b. +560 → Overflow because 560 is not in the range −499 to 499
c. −125 → 874
d. −111 → 888
57.
a. +234 → 234
b. +560 → Overflow because 560 is not in the range −500 to 499
c. −125 → 874 + 1 = 875
d. −111 → 888 + 1 = 889
59.
a. (+B14)16 → (B14)16
b. (+FE1)16 → Overflow because it is not in the range (−7FF)16 to (7FF)16
c. (−1A)16 = (−01A)16 → (FE5)16
d. (−1E2)16 → (E1D)16
61.
a. (+B14)16 → (B14)16
b. (+FE1)16 → Overflow because it is not in the range (−800)16 to (7FF)16
c. (−1A)16 = (−01A)16 → (FE5 +1)16 = (FE6)16
d. (−1E2)16 → (E1D +1)16 = (E1E)16