advertisement

Prelude to Programming 6th edition Elizabeth Drake Test Bank for Prelude to Programming Chapter 2 MULTIPLE CHOICE 1. How many digits are there in the binary system? a. 9 b. 10 c. 0 1 d. 2 ANS: D 2. A normalized binary number consists of three parts. These are: a. sign, exponent, mantissa b. integer part, decimal point, fractional part c. sign, real part, imaginary part d. sign, integer, mantissa ANS: A 3. Given the decimal number 43, the base is: 4 10 a. b. 3 c. d. 64 ANS: A 4. What is the decimal value of 01102? 4 6 a. b. c. 11 d. 110 ANS: B 5. What is the binary representation of 6210? a. 00111110 b. 00100010 c. 00100001 d. 11101000 ANS: A 6. a. Represent 3110 in hexadecimal notation. 1F FF F1 b. c. d. AF d. 3A16 ANS: A 7. Convert 001100112 to hexadecimal. 5A116 a. b. 3316 c. A316 ANS: B 8. In sign-and-magnitude format, what does 01112 represent? 8 +7 a. b. -7 c. d. 110 ANS: C © 2015 Pearson Education 1 Prelude to Programming 6th edition Elizabeth Drake 9. Convert 1710 to an 8-bit integer in sign-and-magnitude format: 100012 b. 100100012 c. 000100012 d. 1100012 a. ANS: C 10. Convert +1210 to a 4-bit integer in two’s complement format: 000011002 b. 100011002 c. 11002 a. d. 100112 ANS: C 11. Convert -1510 to a 4-bit integer in two’s complement format: a. 11112 b. 100012 c. 000012 d. 00012 ANS: D 12. The standard representation for storing positive, zero, and negative integers is: a. unsigned b. sign-and-magnitude c. one’s complement d. two’s complement ANS: D 13. Floating point numbers always have which of the following: a. An integer part b. A sign c. A fractional part d. All of these ANS: D 14. Convert the decimal fraction ½ to binary. 0.012 1.02 a. b. 0.12 c. d. .1102 ANS: B 15. Convert the decimal number 0.610 to a 4-bit binary number. 0.10102 c. 0.10012 a. 0.11002 b. d. 0.1112 ANS: C 16. Convert the decimal number 12.410 to a binary number, allocating 4 bits for the integer part and 4 bits for the fractional part. 1100.01002 a. b. 1010.0112 c. 1100.01102 d. None of these are correct ANS: C 17. Convert 5,689,00010 to exponential notation. © 2015 Pearson Education 2 Prelude to Programming 6th edition Elizabeth Drake a. 5689 X 103 b. 5689E+3 c. 5.6E+5 d. 5.689E+6 ANS: D 18. A single precision floating point number stored in a computer has three parts. They are: a. sign, binary point, mantissa b. sign, exponent, mantissa c. integer, binary point, fraction d. sign, integer, fraction ANS: B 19. Convert +610 to binary using the Excess_127 system. 0110 X 10127 1.0000101E+7 a. b. c. 0000101 d. 10000101 ANS: D 20. Convert -1210 to binary using the Excess_127 system. 10001100 01110011 a. b. c. 0.1110011E-12 d. Cannot be done ANS: B TRUE/FALSE 1. True/False? There are 9 digits in the hexadecimal system. ANS: F 2. True/False: Any number can be used as a base for a number system. ANS: T 3. True/False: In a storage location of 8 bits, a sign-and-magnitude integer could be any integer from 0 to 15, inclusive. ANS: F 4. True/False: The range of integers that can be stored in one’s complement format is exactly double the range that can be stored in sign-and-magnitude format. ANS: F © 2015 Pearson Education 3 Prelude to Programming 6th edition Elizabeth Drake 5. True/False: One problem with using one’s complement to store integers is that there are two ways to represent 0. ANS: T 6. True/False: It is impossible to store the fraction 0.5 in 6 bits as a binary number because 0.510 = 0.12. ANS: F 7. True/False: To store the binary number 101012 in an 8-bit location, simply add three zeros to get 101010002. ANS: F 8. True/False: A number system that uses 19 as a base would be impossible to create because the highest possible number system is 16. ANS: F 9. True/False: The result of adding the binary digits 1 + 1 is 10. ANS: T 10. True/False: In one’s complement format, the leftmost bit is saved for the sign where 1 indicates a negative number and 0 indicates a positive number. ANS: F 11. True/False: The smallest integer that can be represented by a sign-and-magnitude binary number is always 0. ANS: F 12. True/False: A double precision number always takes up 64 bits in the computer’s memory. ANS: T 13. True/False: The following two representations are equivalent: 1110010111010101010100112 and D5D55316 ANS: T 14. True/False: It is impossible to store 1610 in 4-bits because overflow will occur. ANS: T 15. True/False: The two’s complement representation of +6710 in 8-bits is 10000112. ANS: F SHORT ANSWER 1. Given the number 455, __________ is the base. ANS: 45 © 2015 Pearson Education 4 Prelude to Programming 6th edition Elizabeth Drake 2. (-23)0 = __________. ANS: 1 3. There are __________ digits in the binary system. ANS: two 4. The decimal value of A in the hexadecimal number 6A2 is __________. ANS: 160 5. A very long binary number, such as 1111000010101100111000102 may be converted to __________ notation to make it easier to read. ANS: hexadecimal 6. The one’s complement format is not often used because there are two ways to represent the value of __________ . ANS: zero 7. The unsigned form of an integer does not allow for __________ numbers. ANS: negative 8. The condition known as __________ occurs when you try to store an integer that is bigger than the maximum allowed by the number of bits you have. ANS: overflow 9. Given: |-56|. The __________ of this expression is 56. ANS: magnitude 10. A __________ separates the whole number and fractional parts of a binary floating point number. ANS: point or binary point © 2015 Pearson Education 5