BUIS305 Chapter 5

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

in a for loop, is the condition tested before or after the loop body is executed ?

Before

what are three steps found in every loop ?

Initialize, Test, and Update

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

a.

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

a.

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

a.

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

a.

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

b.

To ensure that a user's entry is the correct data type, frequently you ______. a. prompt the user to verify that 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 d. all of the above

b.

Typically, the value added to a counter variable is ______ a. 0 b. 1 c. 10 d. different in each iteration

b.

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

b.

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 1000 times c. both of the above d. none of the above

b.

A report that lists only totals, with no details about individuals record is a(n) ___ report. a. accumulator b.final c. summary d. detailees

c.

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

c.

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

c.

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

c.

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

d.

Adding 1 to a variable is also called ______ it a. Digesting b. Resetting c. Decrementing d. Incrementing

d.

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

d.

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

d.

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

d.

When loops are nested, ______ a. The 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

d.

Which of the following is a 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 the value to control the loop c. both of the above d. none of the above

d.


Ensembles d'études connexes

Quantitative Decision Making in Industry - Test 1

View Set

OS - Appetite/Satiety Regulation

View Set

English 12 test: regional voices

View Set

Behaviour Modification 1 an Introduction

View Set

Med-Surg:Cardiovascular and Hematology

View Set