Solution Manual for Starting Out with Programming Logic and Design, 5th Edition

Preview Extract
Starting Out with Programming Logic and Design, 5th Edition Answers to Review Questions Chapter 2 Multiple Choice 1. C 2. B 3. D 4. B 5. A 6. C 7. C 8. A 9. B 10. D 11. B 12. A 13. C 14. A 15. D 16. B 17. B 18. C 19. D 20. A True or False 1. False 2. True 3. False 4. True 5. False 6. True 7. True 8. True 9. False 10. False ยฉ2016 Pearson Education, Inc. Hoboken, NJ. All Rights Reserved. Short Answer 1. Interview the customer 2. An informal language that has no syntax rules, and is not meant to be compiled or executed. Instead programmers use pseudocode to create models or โ€œmock-upsโ€ of programs. 3. (1) Input is received. (2) Some process is performed. (3) Output is produced. 4. The term user-friendly is commonly used in the software business to describe programs that are easy to use. 5. The variableโ€™s name and data type. 6. It depends on the language being used. Each language has its own way of handling uninitialized variables. Some languages assign a default value such as 0 to uninitialized variables. In many languages, however, uninitialized variables hold unpredictable values. This is because those languages set aside a place in memory for the variable, but do not alter the contents of that place in memory. As a result, an uninitialized variable holds the value that happens to be stored in its memory location. Programmers typically refer to unpredictable values such this as “garbage.” Algorithm Workbench 1. Display “Enter your height.” Input height 2. Display “Enter your favorite color.” Input color 3. a) Set b = a + 2 b) Set a = b * 4 c) Set b = a / 3.14 d) Set a = b โ€“ 8 4. a) 12 b) 4 c) 2 d) 6 5. Declare Real cost 6. Declare Integer total = 0 7. Set count = 27 8. Set total = 10 + 14 ยฉ2016 Pearson Education, Inc. Hoboken, NJ. All Rights Reserved. 9. Set due = downPayment โ€“ total 10. Set totalFee = subtotal * 0.15 11. 11 12. 5 Debugging Exercises 1. The variable name is enclosed in quotes. This is an error because the variableโ€™s name will be displayed instead of the variableโ€™s value. 2. The first character of the variable name begins with a number. This is an error because most programming languages do not allow variable names to begin with numbers. 3. The expression is missing parentheses. This is an error because, as the order of operations dictates, the division will occur before the addition and the result will be incorrect. 4. The variable is being used before it has been declared. This is an error because most programming languages do not allow variables to be used before they are declared. 5. The variables are being used in a calculation before they have been initialized. This is an error because uninitialized variables often contain unknown values, which will cause the result to be incorrect. 6. The assignment statement is not in the correct format. This is an error because all programming languages require that you write the name of the variable that is receiving the value on the left side of the = operator. 7. A named constant cannot be assigned a value with a Set statement. This is an error because the program attempts to change the value of a named constant. ยฉ2016 Pearson Education, Inc. Hoboken, NJ. All Rights Reserved.

Document Preview (3 of 356 Pages)

User generated content is uploaded by users for the purposes of learning and should be used following SchloarOn's honor code & terms of service.
You are viewing preview pages of the document. Purchase to get full access instantly.

Shop by Category See All


Shopping Cart (0)

Your bag is empty

Don't miss out on great deals! Start shopping or Sign in to view products added.

Shop What's New Sign in