Jessica Frank

Coming Soon…

Review Questions
1. The structure that allows you to write one set of instructions that operates on multiple, separate sets of data is the _____.
a. sequence
b. selection
c. loop
d. case

2. The loop that frequently appears in a program’s mainline logic _____.
a. always depends on whether a variable equals 0
b. works correctly based on the same logic as other loops
c. is an unstructured loop
d. is an example of an infinite loop

3. Which of the following is not a step that must occur with every correctly-working loop?
a. Initialize a loop control variable before the loop starts.
b. Set the loop control value equal to a sentinel during each iteration.
c. Compare the loop control value to a sentinel during each iteration.
d. Alter the loop control variable during each iteration.

4. The statements executed within a loop are known collectively as the _____.
a. loop body
b. loop controls
c. sequences
d. sentinels

5. A counter keeps track of _____.
a. the number of times an event has occurred
b. the number of machine cycles required by a segment of a program
c. the number of loop structures within a program
d. the number of times software has been revised

6. Adding 1 to a variable is also called _____ it.
a. digesting
b. resetting
c. decrementing
d. incrementing

7. Which of the following is a definite loop?
a. a loop that executes as long as a user continues to enter valid data
b. a loop that executes 1,000 times
c. both of the above
d. none of the above

8. Which of the following is an indefinite loop?
a. a loop that executes exactly 10 times
b. a loop that follows a prompt that asks a user how many repetitions to make and uses that value to control the loop
c. both of the above
d. none of the above

9. When you decrement a variable, you _____.
a. set it to 0
b. reduce it by one-tenth
c. subtract 1 from it
d. remove it from a program

10. When two loops are nested, the loop that is contained by the other is the _____ loop.
a. captive
b. unstructured
c. inner
d. outer

11. When loops are nested, _____.
a. they typically share a loop control variable
b. one must end before the other begins
c. both must be the same type—definite or indefinite
d. none of the above

12. Most programmers use a for loop _____.
a. for every loop they write
b. when a loop will not repeat
c. when they do not know the exact number of times a loop will repeat
d. when they know the exact number of times a loop will repeat

13. A report that lists no details about individual records, but totals only, is a(n) _____ report.
a. accumulator
b. final
c. summary
d. detailless

14. Typically, the value added to a counter variable is _____.
a. 0
b. 1
c. 10
d. 100

15. Typically, the value added to an accumulator variable is _____.
a. 0
b. 1
c. the same for each iteration
d. different in each iteration

16. After an accumulator or counter variable is displayed at the end of a program, it is best to _____.
a. delete the variable from the program
b. reset the variable to 0
c. subtract 1 from the variable
d. none of the above

17. When you _____, you make sure data items are the correct type and fall within the correct range.
a. validate data
b. employ offensive programming
c. use object orientation
d. count loop iterations

18. Overriding a user’s entered value by setting it to a predetermined value is known as ______.
a. forcing
b. accumulating
c. validating
d. pushing

19. To ensure that a user’s entry is the correct data type, frequently you ______.
a. prompt the user, asking if the user is sure the type is correct
b. use a method built into the programming language
c. include a statement at the beginning of the program that lists the data types allowed
d. all of the above

20. Variables might hold incorrect values even when they are _____.
a. the correct data type
b. within a required range
c. coded by the programmer rather than input by a user
d. all of the above

Author:

Leave a Reply