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.
-37%
Solution Manual for Starting Out with Programming Logic and Design, 5th Edition
$18.99 $29.99Save:$11.00(37%)
24/7 Live Chat
Instant Download
100% Confidential
Store
Liam Anderson
0 (0 Reviews)
Best Selling
The World Of Customer Service, 3rd Edition Test Bank
$18.99 $29.99Save:$11.00(37%)
Chemistry: Principles And Reactions, 7th Edition Test Bank
$18.99 $29.99Save:$11.00(37%)
Solution Manual for Designing the User Interface: Strategies for Effective Human-Computer Interaction, 6th Edition
$18.99 $29.99Save:$11.00(37%)
2023-2024 ATI Pediatrics Proctored Exam with Answers (139 Solved Questions)
$18.99 $29.99Save:$11.00(37%)
Data Structures and Other Objects Using C++ 4th Edition Solution Manual
$18.99 $29.99Save:$11.00(37%)
Test Bank for Hospitality Facilities Management and Design, 4th Edition
$18.99 $29.99Save:$11.00(37%)