Deck 5: Repetition Structures

Full screen (f)
exit full mode
Question
How many times will the following loop iterate?
Set k = 1
Do
Display k
Set k = k + 1
Until k > 1

A)One
B)Two
C)Three
D)No iterations
E)Infinite
Use Space or
up arrow
down arrow
to flip the card.
Question
The following is an example of what type of loop?
For k = 7 To maxValue

A)Count-controlled
B)Condition-controlled
C)While
D)Do-while
E)Do-until
Question
What type of loop uses a Boolean expression to control the number of times that it repeats a statement or set of statements?

A)Count-controlled
B)Condition-controlled
C)While
D)Do-while
E)Do-until
Question
How many times will the following loop iterate?
Set k = 1
While k < = 5
Display k
End While

A)Three
B)Two
C)Five
D)No iterations
E)Infinite
Question
Which loop is specifically designed to initialize,test,and increment a counter variable?

A)Do-While
B)Do-Until
C)For
D)While
E)None of the above
Question
To ___________ a variable means to decrease its value.

A)Negate
B)Increment
C)Initialize
D)Decrement
E)Reference
Question
Which loop repeats a statement or set of statements as long as the Boolean expression is false?

A)Do-While
B)Do-Until
C)For
D)While
E)None of the above
Question
The statements that appear between the While and the End While clauses are called the ________________.

A)Statements
B)Loop
C)Body of the loop
D)Loop statements
E)While statements
Question
A loop that accumulates a total as it reads each number from a series is often said to keep a what?

A)Average
B)Maximum value
C)Running total
D)Accumulation
E)None of the above
Question
The conditions that control a loop repetition are Boolean expressions.
Question
The amount by which the counter variable is incremented in a For loop is known as what?

A)Incremental value
B)Step amount
C)Counter differential
D)Additive Index
E)None of the above
Question
In a count-controlled loop,the counter performs _______ action(s).

A)One
B)Two
C)Three
D)Four
E)Five
Question
The ___________ represents a special value that marks the end of a list of values.

A)Sentinel
B)Stop
C)End
D)Any of the above
E)None of the above
Question
Which of these are posttest loops?

A)While and Do-While
B)While and Do-Until
C)Do-While and Do-Until
D)Do-Until and For
E)Do-While and For
Question
How many times will the following loop iterate?
For j = 1 To 5 Step 2
Display j
End For

A)Three
B)Four
C)Five
D)No iterations
E)Infinite
Question
Which pair of loops causes a statement or set of statements to repeat as long as a condition is true?

A)While and Do-While
B)While and Do-Until
C)Do-While and Do-Until
D)Do-Until and For
E)Do-While and For
Question
Which loop statement does not contain an increment statement but automatically increments the counter at the end of each iteration?

A)Do-While
B)Do-Until
C)For
D)While
E)None of the above
Question
The While loop gets its name from the way it works: While a condition is false,do some task.
Question
How many times will the following loop iterate?
Set k = 1
While k > 5
Display k
End While

A)One
B)Two
C)Five
D)No iterations
E)Infinite
Question
Which structure causes a statement or set of statements to execute repeatedly?

A)Start Over
B)Sequence
C)Decision
D)Repetition
E)None of the above
Question
A condition-controlled loop can be used to iterate the body of the loop a specific number of times.
Question
A count-controlled loop uses a variable known as ________ to store the number of iterations that it has performed.
Question
The variable that is used to keep the running total in a loop is called a(n)_________________ in programming.
Question
The While and For loops are considered pretest loops because they test the condition before processing the statement(s)in the loop body.
Question
The While loop is known as a pretest loop,which means it tests its condition before performing an iteration.
Question
Any loop that can be written as a Do-While loop can also be written as a While loop.
Question
A ______________ structure is commonly known as a loop.
Question
In a For loop,the programmer should know the exact number of iterations the loop must perform before writing the code.
Question
A ____________ -controlled loop repeats a statement or set of statements a specific number of times.
Question
In a For loop a negative step value is used to __________ the counter variable.
Question
In the For statement,you can only use positive integers as step values.
Question
Modules can be called from statements in the body of any loop.
Question
The loop that iterates as long as a condition is false and then stops when the condition becomes true is called a __________ loop.
Question
A While loop repeats infinitely when there is no statement inside the loop body that makes the test condition false.
Question
In a count-controlled loop the test action compares the counter variable to the _________ value to determine if the loop iterates or terminates.
Question
The While loop will never execute if its condition is true to start with.
Question
The term __________ is used in the For loop if the counter needs to be incremented by a value other than one.
Question
When processing a long list of values with a loop,the program knows it has reached the end of the list when the _________ value is read.
Question
A(n)__________________ loop continues to repeat until the program is interrupted.
Question
A posttest loop does not perform any iteration if the Boolean expression is false to begin with.
Question
A structure that has a loop that is inside another loop is called a __________ loop
Question
The following loop will perform ______ iterations.
For start = 6 To 2 Step -3
Question
When the ________ loop executes,the condition is tested; if it is true,the loop body is executed,and then the loop starts over; if the condition is false,the loop terminates.
Question
An inner loop goes through all of its iterations for every single iteration of the ______ loop.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/44
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 5: Repetition Structures
1
How many times will the following loop iterate?
Set k = 1
Do
Display k
Set k = k + 1
Until k > 1

A)One
B)Two
C)Three
D)No iterations
E)Infinite
A
2
The following is an example of what type of loop?
For k = 7 To maxValue

A)Count-controlled
B)Condition-controlled
C)While
D)Do-while
E)Do-until
A
3
What type of loop uses a Boolean expression to control the number of times that it repeats a statement or set of statements?

A)Count-controlled
B)Condition-controlled
C)While
D)Do-while
E)Do-until
B
4
How many times will the following loop iterate?
Set k = 1
While k < = 5
Display k
End While

A)Three
B)Two
C)Five
D)No iterations
E)Infinite
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
5
Which loop is specifically designed to initialize,test,and increment a counter variable?

A)Do-While
B)Do-Until
C)For
D)While
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
6
To ___________ a variable means to decrease its value.

A)Negate
B)Increment
C)Initialize
D)Decrement
E)Reference
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
7
Which loop repeats a statement or set of statements as long as the Boolean expression is false?

A)Do-While
B)Do-Until
C)For
D)While
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
8
The statements that appear between the While and the End While clauses are called the ________________.

A)Statements
B)Loop
C)Body of the loop
D)Loop statements
E)While statements
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
9
A loop that accumulates a total as it reads each number from a series is often said to keep a what?

A)Average
B)Maximum value
C)Running total
D)Accumulation
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
10
The conditions that control a loop repetition are Boolean expressions.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
11
The amount by which the counter variable is incremented in a For loop is known as what?

A)Incremental value
B)Step amount
C)Counter differential
D)Additive Index
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
12
In a count-controlled loop,the counter performs _______ action(s).

A)One
B)Two
C)Three
D)Four
E)Five
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
13
The ___________ represents a special value that marks the end of a list of values.

A)Sentinel
B)Stop
C)End
D)Any of the above
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
14
Which of these are posttest loops?

A)While and Do-While
B)While and Do-Until
C)Do-While and Do-Until
D)Do-Until and For
E)Do-While and For
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
15
How many times will the following loop iterate?
For j = 1 To 5 Step 2
Display j
End For

A)Three
B)Four
C)Five
D)No iterations
E)Infinite
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
16
Which pair of loops causes a statement or set of statements to repeat as long as a condition is true?

A)While and Do-While
B)While and Do-Until
C)Do-While and Do-Until
D)Do-Until and For
E)Do-While and For
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
17
Which loop statement does not contain an increment statement but automatically increments the counter at the end of each iteration?

A)Do-While
B)Do-Until
C)For
D)While
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
18
The While loop gets its name from the way it works: While a condition is false,do some task.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
19
How many times will the following loop iterate?
Set k = 1
While k > 5
Display k
End While

A)One
B)Two
C)Five
D)No iterations
E)Infinite
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
20
Which structure causes a statement or set of statements to execute repeatedly?

A)Start Over
B)Sequence
C)Decision
D)Repetition
E)None of the above
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
21
A condition-controlled loop can be used to iterate the body of the loop a specific number of times.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
22
A count-controlled loop uses a variable known as ________ to store the number of iterations that it has performed.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
23
The variable that is used to keep the running total in a loop is called a(n)_________________ in programming.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
24
The While and For loops are considered pretest loops because they test the condition before processing the statement(s)in the loop body.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
25
The While loop is known as a pretest loop,which means it tests its condition before performing an iteration.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
26
Any loop that can be written as a Do-While loop can also be written as a While loop.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
27
A ______________ structure is commonly known as a loop.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
28
In a For loop,the programmer should know the exact number of iterations the loop must perform before writing the code.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
29
A ____________ -controlled loop repeats a statement or set of statements a specific number of times.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
30
In a For loop a negative step value is used to __________ the counter variable.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
31
In the For statement,you can only use positive integers as step values.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
32
Modules can be called from statements in the body of any loop.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
33
The loop that iterates as long as a condition is false and then stops when the condition becomes true is called a __________ loop.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
34
A While loop repeats infinitely when there is no statement inside the loop body that makes the test condition false.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
35
In a count-controlled loop the test action compares the counter variable to the _________ value to determine if the loop iterates or terminates.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
36
The While loop will never execute if its condition is true to start with.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
37
The term __________ is used in the For loop if the counter needs to be incremented by a value other than one.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
38
When processing a long list of values with a loop,the program knows it has reached the end of the list when the _________ value is read.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
39
A(n)__________________ loop continues to repeat until the program is interrupted.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
40
A posttest loop does not perform any iteration if the Boolean expression is false to begin with.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
41
A structure that has a loop that is inside another loop is called a __________ loop
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
42
The following loop will perform ______ iterations.
For start = 6 To 2 Step -3
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
43
When the ________ loop executes,the condition is tested; if it is true,the loop body is executed,and then the loop starts over; if the condition is false,the loop terminates.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
44
An inner loop goes through all of its iterations for every single iteration of the ______ loop.
Unlock Deck
Unlock for access to all 44 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 44 flashcards in this deck.