Deck 4: Looping

Full screen (f)
exit full mode
Question
A loop control variable's value is tested to control the loop's execution.
Use Space or
up arrow
down arrow
to flip the card.
Question
If you use the wrong comparison with the loop control variable, the body of the loop may never execute.
Question
You control a loop's repetitions by using either a counter or a(n) ____ value.

A)sentinel
C)end
B)standard
D)constant
Question
When the value of a loop control variable is not altered by arithmetic, but is instead altered by user input, this is known as a(n) ____ loop.

A)counted
C)indefinite
B)user-defined
D)definite
Question
You can use a while loop to execute a body of statements continuously as long as some condition continues to be false.
Question
In all structured loops, the ____ must provide either entry to, or exit from, the repeating structure.

A)loop-controlling statement
C)loop-controlling question
B)loop-directing question
D)loop-ending question
Question
Loops are frequently used to validate data.
Question
Program logic gets more complicated when you must use loops within loops, or ____ loops.

A)internal
C)stacked
B)grouped
D)nested
Question
If a data item is valid, this also means that it is correct.
Question
Reprompting for data validation of a user's input is only necessary once.
Question
A common mistake when programming with loops is neglecting to ____ the loop control variable.

A)reset
C)end
B)alter
D)output
Question
In all structured loops, the loop-controlling question provides the only entry to, or exit from, the repeating structure.
Question
The ____ variable is initialized before entering the loop.

A)loop-ending
C)interrupt control
B)ending control
D)loop control
Question
The body of a loop can contain only a limited number of statements.
Question
A(n) ____ is any numeric variable you use to count the number of times an event has occurred.

A)numerator
C)incremental value
B)counter
D)accumulator
Question
The decision that controls every loop is always based on a ____ comparison.

A)Boolean
C)standard
B)logical
D)regular
Question
In pseudocode, which statement is used to show the stopping point of a loop structure?

A)stop
C)endif
B)endwhile
D)exitwhile
Question
There is no benefit to changing a variable's value when it will never be used again during the current execution.
Question
A while loop can be used to code both definite and indefinite loops.
Question
When you write a loop, you must control the number of repetitions it performs; if you do not, you run the risk of creating a(n) ____ loop.

A)updating
C)infinite
B)eternal
D)long
Question
Loops are frequently used to ____ data; that is, to make sure it is meaningful and useful.

A)include
C)validate
B)declare
D)update
Question
The safest and clearest course of action is to assign the value ____ to accumulators before using them.

A)0
C)null
B)1
D)blank
Question
One appropriate action when invalid input data has been detected is to assign a(n) ____value and proceed.

A)error
C)decrement
B)random
D)default
Question
A(n) ____________________ loop has one entry point and one exit point.
Question
A loop for which the number of iterations is ____________________ is called a definite loop, or counted loop.
Question
Programmers use the term "____" to describe programs that are well designed, and easy to understand and maintain.

A)refined
C)stylish
B)graceful
D)elegant
Question
You usually use the for statement with ____ loops.

A)non-testing
C)definite
B)infinite
D)indefinite
Question
At the beginning of any method, it is the programmer's responsibility to ____ all variables that must start with a specific value.

A)internalize
C)clear
B)setup
D)initialize
Question
A(n) ____ is a number you use to increase a loop control variable on each pass through a loop.

A)step value
C)increment value
B)control value
D)step variable
Question
The value that signals a loop to stop is the ____________________ value.
Question
Most languages provide a built-in way to check whether entered data is ____.

A)numeric
C)alphanumeric
B)garbage
D)correct
Question
Programmers must be careful to use the correct ____ in the statement that controls a loop.

A)sequence
C)variable
B)comparison
D)identifier
Question
If a loop control variable is incremented by user input, it is a(n) ____________________ loop.
Question
A(n) ____________________ loop is a loop which has no end.
Question
Statements inside a loop that could be placed outside the loop make the loop ____.

A)more efficient
C)incorrect
B)cleaner
D)less efficient
Question
What is the correct data type of an accumulator variable used to store real estate sales totals?

A)string
C)text
B)numeric
D)character
Question
____ a data item means you override incorrect data by setting the variable to a specific value.

A)Forcing
C)Initializing
B)Incrementing
D)Terminating
Question
If you run the same application a second time, the variables might occupy different ____ from the ones they occupied during the first run.

A)virtual storage locations
C)virtual memory locations
B)physical memory locations
D)physical storage locations
Question
It is always a mistake to fail to initialize a loop's ____ variable.

A)operational
C)control
B)sequence
D)terminal
Question
The difference between an accumulator and a counter lies in the ____ that you add to the variable.

A)comments
C)value
B)updates
D)text
Question
____________________ reports show no individual item details.They show only totals.
Question
When one loop appears inside another, the loop that contains the other loop is the ____________________ loop.
Question
Setting a data item to a specific value to override incorrect input is called ____________________.
Question
Good ____________________ programs try to foresee all possible inconsistencies and errors.
Question
The amount by which a for loop control variable changes after the body executes is often called a(n) ____________________value.
Question
____________________ data can make parts of a program worthless.
Question
A(n) ____________________ is a variable used to gather or accumulate values.
Question
____________________ a user is a good way to ensure valid data, but it can be frustrating to a user if it continues indefinitely.
Question
A(n) ____________________ input is the first input that sets a loop control variable's first value before the loop begins.
Question
A(n) ____________________ loop can be used to code for definite and indefinite loops.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 4: Looping
1
A loop control variable's value is tested to control the loop's execution.
True
2
If you use the wrong comparison with the loop control variable, the body of the loop may never execute.
True
3
You control a loop's repetitions by using either a counter or a(n) ____ value.

A)sentinel
C)end
B)standard
D)constant
A
4
When the value of a loop control variable is not altered by arithmetic, but is instead altered by user input, this is known as a(n) ____ loop.

A)counted
C)indefinite
B)user-defined
D)definite
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
You can use a while loop to execute a body of statements continuously as long as some condition continues to be false.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
In all structured loops, the ____ must provide either entry to, or exit from, the repeating structure.

A)loop-controlling statement
C)loop-controlling question
B)loop-directing question
D)loop-ending question
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
Loops are frequently used to validate data.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
Program logic gets more complicated when you must use loops within loops, or ____ loops.

A)internal
C)stacked
B)grouped
D)nested
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
If a data item is valid, this also means that it is correct.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
Reprompting for data validation of a user's input is only necessary once.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
A common mistake when programming with loops is neglecting to ____ the loop control variable.

A)reset
C)end
B)alter
D)output
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
In all structured loops, the loop-controlling question provides the only entry to, or exit from, the repeating structure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
The ____ variable is initialized before entering the loop.

A)loop-ending
C)interrupt control
B)ending control
D)loop control
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
The body of a loop can contain only a limited number of statements.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
A(n) ____ is any numeric variable you use to count the number of times an event has occurred.

A)numerator
C)incremental value
B)counter
D)accumulator
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
The decision that controls every loop is always based on a ____ comparison.

A)Boolean
C)standard
B)logical
D)regular
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
In pseudocode, which statement is used to show the stopping point of a loop structure?

A)stop
C)endif
B)endwhile
D)exitwhile
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
There is no benefit to changing a variable's value when it will never be used again during the current execution.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
A while loop can be used to code both definite and indefinite loops.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
When you write a loop, you must control the number of repetitions it performs; if you do not, you run the risk of creating a(n) ____ loop.

A)updating
C)infinite
B)eternal
D)long
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Loops are frequently used to ____ data; that is, to make sure it is meaningful and useful.

A)include
C)validate
B)declare
D)update
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
The safest and clearest course of action is to assign the value ____ to accumulators before using them.

A)0
C)null
B)1
D)blank
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
One appropriate action when invalid input data has been detected is to assign a(n) ____value and proceed.

A)error
C)decrement
B)random
D)default
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
A(n) ____________________ loop has one entry point and one exit point.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
A loop for which the number of iterations is ____________________ is called a definite loop, or counted loop.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
Programmers use the term "____" to describe programs that are well designed, and easy to understand and maintain.

A)refined
C)stylish
B)graceful
D)elegant
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
You usually use the for statement with ____ loops.

A)non-testing
C)definite
B)infinite
D)indefinite
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
At the beginning of any method, it is the programmer's responsibility to ____ all variables that must start with a specific value.

A)internalize
C)clear
B)setup
D)initialize
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
A(n) ____ is a number you use to increase a loop control variable on each pass through a loop.

A)step value
C)increment value
B)control value
D)step variable
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
The value that signals a loop to stop is the ____________________ value.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
Most languages provide a built-in way to check whether entered data is ____.

A)numeric
C)alphanumeric
B)garbage
D)correct
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
Programmers must be careful to use the correct ____ in the statement that controls a loop.

A)sequence
C)variable
B)comparison
D)identifier
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
If a loop control variable is incremented by user input, it is a(n) ____________________ loop.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
A(n) ____________________ loop is a loop which has no end.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
Statements inside a loop that could be placed outside the loop make the loop ____.

A)more efficient
C)incorrect
B)cleaner
D)less efficient
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
What is the correct data type of an accumulator variable used to store real estate sales totals?

A)string
C)text
B)numeric
D)character
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
____ a data item means you override incorrect data by setting the variable to a specific value.

A)Forcing
C)Initializing
B)Incrementing
D)Terminating
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
If you run the same application a second time, the variables might occupy different ____ from the ones they occupied during the first run.

A)virtual storage locations
C)virtual memory locations
B)physical memory locations
D)physical storage locations
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
It is always a mistake to fail to initialize a loop's ____ variable.

A)operational
C)control
B)sequence
D)terminal
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
The difference between an accumulator and a counter lies in the ____ that you add to the variable.

A)comments
C)value
B)updates
D)text
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
____________________ reports show no individual item details.They show only totals.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
When one loop appears inside another, the loop that contains the other loop is the ____________________ loop.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
Setting a data item to a specific value to override incorrect input is called ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
Good ____________________ programs try to foresee all possible inconsistencies and errors.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
The amount by which a for loop control variable changes after the body executes is often called a(n) ____________________value.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
____________________ data can make parts of a program worthless.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
A(n) ____________________ is a variable used to gather or accumulate values.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
____________________ a user is a good way to ensure valid data, but it can be frustrating to a user if it continues indefinitely.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
A(n) ____________________ input is the first input that sets a loop control variable's first value before the loop begins.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
A(n) ____________________ loop can be used to code for definite and indefinite loops.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 50 flashcards in this deck.