计算机科学与导论第三章答案.pdf
《计算机科学与导论第三章答案.pdf》由会员分享,可在线阅读,更多相关《计算机科学与导论第三章答案.pdf(11页珍藏版)》请在装配图网上搜索。
CHAPTER 3 Data Storage (Solutions to Review Questions and Problems) Review Questions Q3-1. We discussed five data types: numbers, text, audio, images, and video. Q3-2. If the length of the bit pattern is L bits, the number of symbols that can be rep- resented by the bit pattern is 2 L . Q3-3. In the bitmap graphic method each pixel is represented by a bit pattern. Q3-4. In vector graphic method, the size of the file is smaller and the image can be easily rescaled. However, vector graphic can not be used to represent the details of colors in a photo. Q3-5. The three steps are sampling, quantization, and encoding. Q3-6. Representations are the same except that the representable range of positive integers in unsigned method is twice the other methods. Q3-7. In both representations, the upper half of the range represents the negative numbers. However, the wrapping is different as shown in Figure Q3.7. In addition, there are two zeros in sign-and-magnitude but only one in twos complement. Figure Q3.7 Wrapping for two number representations Wrapping in sign-and-magnitude representation Minimum -0+0 Maximum Minimum 0 Maximum Wrapping Wrapping 1 Wrapping in twos complement representation 2 Q3-8. In the signed-and-magnitude representation, there are two zeros. In twos complement representation there is only one zero. In the excess representa- tion, zero is represented by a positive number (bias) such as +127 and +1023. Q3-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. Q3-10. a. Normalization is necessary to make calculations easier. b. Mantissa is the bit sequence to the right of the decimal point after normal- ization. c. The computer stores the sign of the number, the exponent, and the mantissa. Problems P3-1. 2 5 = 32 patterns. P3-2. 10 2 = 100 if zero is allowed. 9 2 = 81 if zero is not allowed. P3-3. a. If zero is allowed, (10 2 for numbers) (26 3 for letters) = 1757600. b. If zero is not allowed, (9 2 for numbers) (26 3 for letters) = 1423656. P3-4. 2 n = 8 n =3 or log 2 8 = 3. P3-5. 2 n = 7 n 3 or log 2 7 = 2.81 3. P3-6. 2 n = 900 n 10 or log 2 900 = 9.81 10. With n = 10 we can uniquely assign 2 10 = 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. P3-7. 2 4 10 = 6 are wasted. P3-8. 256 level can be represented by 8 bits because 2 8 = 256. Therefore, the num- ber of bits per seconds is (8000 sample/ sec) (8 bits / sample) = 64,000 bits /seconds P3-9. a. 23 = 16 + 4 + 2 +1 = (0000 1011) 2 b. 121 = 64 + 32 + 16 + 8 +1 = (0111 1001) 2 c. 34 = 32 +2 = (0010 0010) 2 . d. Overflow occurs because 342 255. 3 P3-10. 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 . P3-11. a. The number 12 = b. Overflow occurs because 145 is not in the range 128 to +127. c. The number 56 = d. Overflow occurs because 142 is not in the range 128 to +127. P3-12. a. The number 102 = b. The number 179 = c. The number 534 = d. Over flow because 62,056 is not in the range (32768, +32767). P3-13. a. 0110 1011 = 64 + 32 + 8 + 2 +1 = 107. b. 1001 0100 = 128 + 16 + 4 = 148. c. 0000 0110 = 4 + 2 = 6. Convert 12 to binary 0 0 0 0 1 1 0 0 Apply twos complement operation 1 1 1 1 0 1 0 0 Convert 56 to binary 0 0 1 1 1 0 0 0 Convert 102 to binary 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 Convert 179 to binary 0 0 0 0 0 0 0 0 1 0 1 1 0 0 1 1 Apply twos complement 1 1 1 1 1 1 1 1 0 1 0 0 1 1 0 1 Convert 534 to binary 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 d. 0101 0000 = 64 + 16 = 80. 4 P3-14. a. 0111 0111 = b. 1111 1100 = c. 0111 0100 = d. 1100 1110 = P3-15. We change the sign of the number by applying the twos complement opera- tion. a. 01110111 10001001 b. 11111100 00000100 c. 01110111 10001001 d. 11001110 00110010 P3-16. a. 01110111 10001001 01110111 b. 11111100 00000100 11111100 c. 01110100 10001100 01110100 Leftmost bit is 0. The sign is + 0 1 1 1 0 1 1 1 Integer changed to decimal 119 Sign is added + 119 Leftmost bit is 1. The sign is 1 1 1 1 1 1 0 0 Apply twos complement operation 0 0 0 0 0 1 0 0 Integer changed to decimal 4 Sign is added 4 Leftmost bit is 0. The sign is + 0 1 1 1 0 1 0 0 Integer changed to decimal 116 Sign is added + 116 Leftmost bit is 1. The sign is 1 1 0 0 1 1 1 0 Apply twos complement operation 0 0 1 1 0 0 1 0 Integer changed to decimal 50 Sign is added 50 d. 11001110 00110010 11001110 5 P3-17. a. b. c. d. P3-18. 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 , M = 01110011 (plus 15 zero added at the right) 0 01111011 01110011000000000000000 d. S = 1 E = 5 + 127 = 122 = (01111010) 2 , M = 01101000 (plus 15 zero added at the right) 1 01111010 01101000000000000000000 P3-19. Answers are shown with spaces between the three parts for clarity: a. S = 1 = 0 + 1023 = 1023 = (01111111111) 2 , M = 10001 (plus 47 zero added at the right) 1 01111111111 1000100000000000000000000000000000000000000000000000 b. S = 0 E = 3 + 1023 = 1026 = (10000000010) 2 M = 111111 (plus 46 zero added at the right) 010000000010 1111110000000000000000000000000000000000000000000000 1.10001 = 2 0 1.10001 2 3 111.1111 = 2 5 1.111111 2 2 101.110011 = 2 0 1.01001100 2 5 101101.00000110011000 = 2 0 1.0110100000110011000 c. S = 0 E = 4 + 1023 = 1019 = (01111111011) 2 6 M = 01110011 (plus 44 zero added at the right) 0 01111111011 0111001100000000000000000000000000000000000000000000 d. S = 1 E = 5 + 1023 = (01111111010) 2 M = 01101000 (plus 44 zero added at the right) 101111111010 0110100000000000000000000000000000000000000000000000 P3-20. Answers are shown with spaces between the three parts for clarity: a. 7.1875 = (111.0011) 2 = 2 2 1.110011 S = 0 E = 2 + 127 = 129 = (10000001) 2 M = 110011 (plus 17 zero at the right) 0 10000001 11001100000000000000000 b. 12.640625 = (1100.101001) 2 = 2 3 1.100101001 S = 1 E = 3 + 127 = 130 = (10000010) 2 M = 100101001 (plus 14 zero at the right) 1 10000010 10010100100000000000000 c. 11.40625 = (1011.01101) 2 = 2 3 1.01101101 S = 0 E = 3 + 127 = 130 = (10000010) 2 M = 01101101 (plus 15 zero at the right) 0 10000010 01101101000000000000000 d. 0.375 = 0.011 = 2 2 1.1 S = 1 E = 2 + 127 =125 = (01111101) 2 M = 1 (plus 22 zero at the right) 1 01111101 10000000000000000000000 P3-21. a. (01110111) 2 = b. (11111100) 2 = 0 1 1 1 0 1 1 1 + 64 32 16 0 4 2 1 +119 1 1 1 1 1 1 0 0 64 32 16 8 4 2 1 124 7 c. (01110100) 2 = d. (11001110) 2 = P3-22. a. 53 = 32 + 16 + 4 + 1 = b. 107 = (64 + 32 + 8 + 2 + 1) = c. 5 = (4+1) = 10000101 d. 154 creates overflow because 154 is not in the range 127 to +127. P3-23. a. (53) 16 = b. (107) 16 = 0 1 1 1 0 1 0 0 + 64 32 16 0 4 0 0 +116 1 1 0 0 1 1 1 0 64 0 0 8 4 2 0 78 + 0 32 16 0 4 0 1 0 0 1 1 0 1 0 1 = 0011 0101 64 32 0 8 0 2 1 1 1 1 0 1 0 1 1 = 1110 1011 0 0 0 0 4 0 1 1 0 0 0 0 1 0 1 = 1000 0101 Convert 53 to binary 0 1 0 1 0 0 1 1 Convert 107 to binary 0 1 1 0 1 0 1 1 Apply ones complement operation 1 0 0 1 0 1 0 0 8 c. (5) 16 = d. (154) 16 = Overflow because 154 is not in the range of 127 to 127 P3-24. a. (01110111) 2 = b. (11111100) 2 = c. (01110100) 2 = d. (11001110) 2 = P3-25. a. 01110111 10001000 01110111 b. 11111100 00000011 11111100 Convert 5 to binary 0 0 0 0 0 1 0 1 Apply ones complement operation 1 1 1 1 1 0 1 0 Leftmost bit is 0. The sign is plus 0 1 1 1 0 1 1 1 Integer changed to decimal 119 Sign is added +119 Leftmost bit is 1. The sign is minus 1 1 1 1 1 1 0 0 Apply ones complement operation 0 0 0 0 0 0 1 1 Integer changed to decimal 3 Sign is added 3 Leftmost bit is 0. The sign is plus 0 1 1 1 0 1 0 0 Integer changed to decimal 116 Sign is added +116 Leftmost bit is 1. The sign is minus 1 1 0 0 1 1 1 0 Apply ones complement operation 0 0 1 1 0 0 0 1 Integer changed to decimal 49 Sign is added 49 c. 01110100 10001011 01110100 d. 11001110 00110001 11001110 9 P3-26. a. (01110111) 2 b. (11111100) 2 c. (01110100) 2 d. (11001110) 2 P3-27. a. With 3 digits we can express 10 3 = 1000 integers, 500 for positives and 500 negatives. Then we can represent numbers in the range of 499 to 499. b. The first digit determine the sign of the number. The number is positive if the first digit is 0 to 4 and negative if the first digit is 5 to 9. c. We have two zeros, one positive and one negative. d. +0 = 000 and 0 = 999. P3-28. a. +234 234. b. +560 Overflow because 560 is not in the range 499 to 499. c. 125 874. d. 111 888. Ones complement = 10001000 Twos complement = 10001001 +1 10001001 Ones complement = 00000011 Twos complement = 00000100 +1 00000100 Ones complement = 10001011 Twos complement = 10001100 +1 10001100 Ones complement = 00110001 Twos complement = 00110010 +1 00110010 10 P3-29. a. With 3 digits we can represent 10 3 = 1000 integers, 500 for zero and posi- tives and 500 for negatives. Then we can represent numbers in the range of 500 to 499. b. The first digit determine the sign of the number. The number is zero or pos- itive if the first digit is 0 to 4 and negative if the first digit is 5 to 9. c. No, there is only one representation for zero (0 = 000). d. NA. P3-30. 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. P3-31. a. With 3 digits we can represent 16 3 = 4096 integers, 2048 for positives and 2048 for negatives. Then we can represent numbers in the range of ( 7FF) 16 to (7FF) 16 . b. The fifteens complement of a positive number is itself. To find the fifteen complement of negative numbers, we subtract each digit from 15. c. We have two zeros, a positive zero and a negative zero. d. +0 = (000) 16 and 0 = (EEE) 16 . P3-32. 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 . P3-33. a. With 3 digits we can represent 16 3 = 4096 integers, 2048 for zero and posi- tives and 2048 for negatives. Then we can represent numbers in the range of (800) 16 to (7FF) 16 . b. If the number is positive, the complement of the number is itself. If the number is negative we find the fifteens complement and add 1 to it. c. No, there is only one zero, (000) 16 . d. NA. 11 P3-34. a. (+B14) 16 (B14) 16 . b. (+FE1) 16 Overflow occurs 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 .- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机科学 导论 第三 答案
装配图网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文