Deck 5: Looping
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Match between columns
Question
Match between columns
Question
Question
Question
Question
Match between columns
Question
Question
Question
Question
Match between columns
Question
Question
Match between columns
Question
Question
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/60
Play
Full screen (f)
Deck 5: Looping
1
You can either increment or decrement the loop control variable.
True
2
Every high-level computer programming language contains a while statement.
True
3
The loop control variable is initialized after entering the loop.
False
4
Both the while loop and the for loop are examples of pretest loops.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
5
It is the programmer's responsibility to initialize all variables that must start with a specific value.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
6
A mistake programmers often make with loops is that they ____.
A)initialize the loop control variable prior to entering the loop body
B)increment the loop control variable inside of the loop body
C)include statements inside the loop that belong outside the loop
D)enclose the inner loop entirely within the outer loop in a nested loop
A)initialize the loop control variable prior to entering the loop body
B)increment the loop control variable inside of the loop body
C)include statements inside the loop that belong outside the loop
D)enclose the inner loop entirely within the outer loop in a nested loop
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
7
A loop within another loop is known as a(n)____ loop.
A)indefinite
B)infinite
C)nested
D)hidden
A)indefinite
B)infinite
C)nested
D)hidden
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
8
An indefinite loop is a loop that never stops.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
9
Forgetting to initialize and alter the loop control variable are common mistakes that programmers sometimes make.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
10
Usually, when you create nested loops, each loop has its own ____.
A)sentinel value
B)goto statement
C)entrance condition
D)loop control variable
A)sentinel value
B)goto statement
C)entrance condition
D)loop control variable
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
11
Once your logic enters the body of a structured loop, ____.
A)the entire loop must execute
B)the loop can be terminated with a break statement
C)the loop will execute indefinitely
D)a decision statement will be evaluated
A)the entire loop must execute
B)the loop can be terminated with a break statement
C)the loop will execute indefinitely
D)a decision statement will be evaluated
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
12
When one loop appears inside another, the loop that contains the other loop is called the ____ loop.
A)indefinite
B)definite
C)inner
D)outer
A)indefinite
B)definite
C)inner
D)outer
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
13
The safest action is to assign the value 1 to accumulators before using them.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
14
The first step in a while loop is typically to ____.
A)compare the loop control variable to a constant value
B)initialize the loop control variable
C)increment the loop control variable
D)execute the body of the loop
A)compare the loop control variable to a constant value
B)initialize the loop control variable
C)increment the loop control variable
D)execute the body of the loop
Unlock Deck
Unlock for access to all 60 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)accumulator
B)key
C)index
D)counter
A)accumulator
B)key
C)index
D)counter
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
16
A(n)____ loop executes a predetermined number of times.
A)terminal
B)definite
C)indefinite
D)infinite
A)terminal
B)definite
C)indefinite
D)infinite
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
17
When one loop appears inside another is is called an indented loop.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
18
Use a counter or a(n)____ to control a loop's repetitions.
A)sentinel variable
B)end value
C)sentinel value
D)end statement
A)sentinel variable
B)end value
C)sentinel value
D)end statement
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
19
In some cases, a loop control variable does not have to be initialized.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
20
Many loop control variable values are altered by ____, or adding to them.
A)incrementing
B)decrementing
C)accumulating
D)deprecating
A)incrementing
B)decrementing
C)accumulating
D)deprecating
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
21
In a ____, the loop body might never execute because the question controlling the loop might be false the first time it is asked.
A)summary report
B)pretest loop
C)posttest loop
D)loop control
A)summary report
B)pretest loop
C)posttest loop
D)loop control
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
22
The ____ loop provides three actions in one compact statement.
A)for
B)while
C)do until
D)repeat
A)for
B)while
C)do until
D)repeat
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
23
You usually use the for loop with ____ loops.
A)indefinite
B)definite
C)inner
D)outer
A)indefinite
B)definite
C)inner
D)outer
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
24
____ is a technique with which you try to prepare for all possible errors before they occur.
A)Incrementing
B)Stub
C)Nested loop
D)Defensive programming
A)Incrementing
B)Stub
C)Nested loop
D)Defensive programming
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
25
____________________ can ensure that a value is the correct data type or that it falls within an acceptable range.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
26
The ____ loop is particularly useful when processing arrays.
A)for
B)while
C)infinite
D)nested
A)for
B)while
C)infinite
D)nested
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
27
Programmers use the term ____ to describe programs that are well designed and easy to understand and maintain.
A)industrial
B)intractable
C)well behaved
D)elegant
A)industrial
B)intractable
C)well behaved
D)elegant
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
28
The amount by which a for loop control variable changes is often called a ____ value.
A)group
B)key
C)step
D)sentinel
A)group
B)key
C)step
D)sentinel
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
29
____ a data item means you override incorrect data by setting the variable to a specific value.
A)Flexing
B)Tracing
C)Forcing
D)Blanking
A)Flexing
B)Tracing
C)Forcing
D)Blanking
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
30
A(n)____ is very similar to a counter that you use to count loop iterations, except that you usually add a value other than one to this type of variable.
A)transaction
B)total
C)validator
D)accumulator
A)transaction
B)total
C)validator
D)accumulator
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
31
In a for statement, a loop control variable is initialized, tested, and ____________________.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
32
A mistake programmers often make with loops is that they ____.
A)neglect to initialize the loop control variable prior to entering the loop body
B)increment the loop control variable inside of the loop body
C)validate data to ensure values are the correct data type or that they fall within an acceptable range
D)enclose the inner loop entirely within the outer loop in a nested loop
A)neglect to initialize the loop control variable prior to entering the loop body
B)increment the loop control variable inside of the loop body
C)validate data to ensure values are the correct data type or that they fall within an acceptable range
D)enclose the inner loop entirely within the outer loop in a nested loop
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
33
To add to a variable is to ____________________ the variable.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
34
In a ____, the loop body executes at least one time because the loop control variable is not tested until after one iteration.
A)nested loop
B)pretest loop
C)posttest loop
D)loop control
A)nested loop
B)pretest loop
C)posttest loop
D)loop control
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
35
Business reports that list only totals, with no individual item details, are called ____.
A)detail reports
B)summary reports
C)transaction reports
D)control-break reports
A)detail reports
B)summary reports
C)transaction reports
D)control-break reports
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
36
____________________ are frequently used to accumulate totals and to validate data.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
37
Loops are frequently used to ____; that is, to make sure it is meaningful and useful.
A)validate data
B)restructure data
C)simulate data
D)corroborate data
A)validate data
B)restructure data
C)simulate data
D)corroborate data
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
38
A comparison is correct only when the correct ____ and operator are used.
A)expression
B)operands
C)statements
D)index
A)expression
B)operands
C)statements
D)index
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
39
Programmers employ the acronym ____ to mean that if your input is incorrect, your output is worthless.
A)IBOW
B)GIGO
C)IIOW
D)GIGS
A)IBOW
B)GIGO
C)IIOW
D)GIGS
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
40
A posttest loop is sometimes called a ____________________ loop.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
41
What is a step value?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
42
Match between columns
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
43
Match between columns
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
44
What are the tasks performed by the for count = 0 to 3 statement?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
45
Explain when it would be appropriate to write an indefinite loop.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
46
What is the difference between a definite loop and an indefinite loop?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
47
Match between columns
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
48
How might user data be validated?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
49
When are you required to use a for statement, and what are the advantages of for statements?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
50
What are the three steps that should occur in every loop?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
51
Match between columns
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
52
What are common mistakes made by programmers in coding loops?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
53
Match between columns
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
54
What is an accumulator?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
55
What is an advantage of using fewer instructions?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
56
Match between columns
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
57
Match between columns
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
58
Match between columns
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
59
Match between columns
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
60
Match between columns
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck