Programming Logic & Design - Chap. 5 Looping Review Questions

¡Supera tus tareas y exámenes ahora con Quizwiz!

Typically, the value added to an accumulator variable is_______________. Select one: a. different in each iteration b. the same for each iteration c. 1 d. 0

a. different in each iteration

Most programmers use a for loop _______________. Select one: a. when they know the exact number of times a loop will repeat b. when a loop must repeat many times c. when a loop will not repeat d. for every loop they write

a. when they know the exact number of times a loop will repeat

Which of the following is an indefinite loop? Select one: 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 the value to control the loop c. both of the above d. none of the above

b. a loop that follows a prompt that asks a user how many repetitions to make and uses the value to control the loop

Adding 1 to a variable is also called _______________ it. Select one: a. digesting b. incrementing c. resetting d. decrementing

b. incrementing

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

b. validate data

Which of the following is not a step that must occur with every correctly working loop? Select one: a. Compare the loop control value to a sentinel during each iteration. b. Initialize a loop control variable before the loop starts. c. Set the loop control value equal to a sentinel during each iteration. d. Allow the loop control variable to be altered during each iteration.

c. Set the loop control value equal to a sentinel during each iteration.

A do-while loop _______________. Select one: a. is a type of pretest loop b. is not structured, and therefore obsolete c. can be replaced by a sequence and a while loop d. has a body that might never execute

c. can be replaced by a sequence and a while loop

Overriding a users entered value by setting it to a predetermined value is known as ____________________. Select one: a. validating b. accumulating c. forcing d. pushing

c. forcing

When two loops are nested, the loop that is contained by the other is the _______________loop. Select one: a. captive b. unstructured c. inner d. outer

c. inner

The statements executed within a loop are known collectively as the _______________. Select one: a. sentinels b. loop controls c. loop body d. sequences

c. loop body

A report that lists only totals, with no details about individual records, is a(n) _______________ report. Select one: a. accumulator b. final c. summary d. group

c. summary

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

c. the number of times an event has occurred

Typically, the value added to a counter variable is _______________. Select one: a. 0 b. different in each iteration c. the same for each iteration d. 1

d. 1

A variable might hold an incorrect value even when it is _______________. Select one: a. the correct data type b. within a required range c. a constant coded by the programmer d. all of the above

d. all of the above

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

d. loop

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

d. none of the above

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

d. none of the above

Which of the following is a definite loop? Select one: 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

d. none of the above


Conjuntos de estudio relacionados

Mastering Biology Test #2 (Ch 7)

View Set