Deck 6: The Repetition Structure
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
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/59
Play
Full screen (f)
Deck 6: The Repetition Structure
1
In a pretest loop,the evaluation of the condition occurs after the instructions within the loop are processed.
False
2
The loop created by the For...Next statement is a ____ loop.
A) posttest
B) pretest
C) selection
D) sequential
A) posttest
B) pretest
C) selection
D) sequential
B
3
To leave a Do...Loop structure earlier than its full completion,you must execute a(n)____ statement.
A) End Do
B) Bypass
C) Leave
D) Exit Do
A) End Do
B) Bypass
C) Leave
D) Exit Do
D
4
The startValue in a For...Next loop structure may be omitted.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
5
Programmers use a(n)____ when they need the computer to repeatedly process one or more program instructions until some condition is met,at which time the ____ ends.
A) list box
B) loop
C) index
D) counter
A) list box
B) loop
C) index
D) counter
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
6
A ____ structure is also referred to as a loop.
A) selection
B) sequence
C) repetition
D) recursion
A) selection
B) sequence
C) repetition
D) recursion
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
7
In a Do...Loop statement,a condition can be phrased as either a looping condition or a loop enter condition.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
8
You can make a list box any size you want.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
9
The repetition programming structure is used to make decisions in a program.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the following loop structures always executes at least once?
A) pretest
B) posttest
C) top-driven
D) selection
A) pretest
B) posttest
C) top-driven
D) selection
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
11
The assignment statement that updates a counter or an accumulator is placed within the loop in a procedure.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
12
In either pretest or posttest loops,the controlling condition is evaluated with each repetition.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
13
You can stop an endless loop by clicking Debug on the menu bar,and then clicking ____.
A) Stop Debugging
B) Cancel Debugging
C) Abort Debugging
D) End Debugging
A) Stop Debugging
B) Cancel Debugging
C) Abort Debugging
D) End Debugging
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
14
____ means assigning a beginning value to a counter or an accumulator.
A) Introducing
B) Initializing
C) Incrementing
D) Updating
A) Introducing
B) Initializing
C) Incrementing
D) Updating
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
15
A(n)____ read is used to prepare or set up a loop.
A) priming
B) initialization
C) preparation
D) set up
A) priming
B) initialization
C) preparation
D) set up
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
16
A(n)____ is a numeric variable used for adding together something.
A) counter
B) updater
C) incrementer
D) accumulator
A) counter
B) updater
C) incrementer
D) accumulator
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
17
A counter is always incremented by a constant value.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
18
Like the condition in a selection structure,the condition in a loop must evaluate to either True or False.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
19
In a Do...Loop statement,the keyword While indicates that the loop instructions should be processed while the condition is false.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
20
The symbol used to represent a loop condition on a flowchart is the ____ symbol.
A) diamond
B) rectangle
C) hexagon
D) parallelogram
A) diamond
B) rectangle
C) hexagon
D) parallelogram
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
21
You should use a ____ control to provide keyboard access to a list box.
A) radio button
B) text
C) check box
D) label
A) radio button
B) text
C) check box
D) label
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
22
How many times will the message display based on the counter being initialized to 0? 
A) zero
B) one
C) four
D) five

A) zero
B) one
C) four
D) five
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
23
In a nested repetition structure,one loop,referred to as the ____ loop,is placed entirely within another loop,called the ____ loop.
A) inner,outer
B) primary,secondary
C) minor,major
D) dependent,independent
A) inner,outer
B) primary,secondary
C) minor,major
D) dependent,independent
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
24
The number of choices the user can select from a list box is controlled by the list box's ____ property.
A) Selection
B) Display
C) Control
D) SelectionMode
A) Selection
B) Display
C) Control
D) SelectionMode
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
25
The ____ method ensures that any code appearing before it that affects the interface's appearance is processed.
A) Process
B) Affect
C) Apply
D) Refresh
A) Process
B) Affect
C) Apply
D) Refresh
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
26
You can delay program execution using the ____ method.
A) Delay
B) Rest
C) Sleep
D) Break
A) Delay
B) Rest
C) Sleep
D) Break
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
27
Which of the following statements selects the "blue" item,which appears fourth in the lstColor control? 

Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following statements adds the number stored in the decPrice variable to the number stored in the decSubtotal variable,and then assigns the result to the decSubtotal variable? 

Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
29
You can use a ____ to display a list of choices from which the user can select zero choices,one choice,or more than one choice.
A) list box
B) radio button group
C) check box
D) list
A) list box
B) radio button group
C) check box
D) list
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
30
You use the ____ tool in the toolbox to add a list box to an interface.
A) LBox
B) ListBox
C) List
D) Box
A) LBox
B) ListBox
C) List
D) Box
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
31
In a For...Next statement,if stepValue is positive,then startValue must be ____ endValue for the loop instructions to be processed.
A) less than
B) more than
C) less than or equal to
D) more than or equal to
A) less than
B) more than
C) less than or equal to
D) more than or equal to
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
32
A unique number called a(n)____ identifies each item in a collection.
A) counter
B) index
C) accumulator
D) tracker
A) counter
B) index
C) accumulator
D) tracker
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
33
If the stepValue is omitted when coding a For...Next statement,the stepValue is ____ at execution time.
A) -1
B) 0
C) 0.1
D) 1
A) -1
B) 0
C) 0.1
D) 1
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
34
If you have only two choices to offer the user,you should use two ____ rather than a list box.
A) check boxes
B) text boxes
C) combo boxes
D) radio buttons
A) check boxes
B) text boxes
C) combo boxes
D) radio buttons
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
35
The following code is not working properly.The message should display four times.What needs to be changed for the code to work properly? 

Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
36
Which of the following statements pauses program execution for 3 seconds? 

Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
37
Adding increments of a negative number is referred to as ____.
A) decrementing
B) initializing
C) deprocessing
D) negating
A) decrementing
B) initializing
C) deprocessing
D) negating
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
38
You can use either the SelectedItem or ____ property to determine whether an item is selected in a list box.
A) Selection
B) SelectedIndex
C) ItemChoice
D) Items
A) Selection
B) SelectedIndex
C) ItemChoice
D) Items
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
39
Each time either the user or a statement selects an item in a list box,the list box's SelectedValueChanged and ____ events occur.
A) SelectedItemChanged
B) SelectionChanged
C) SelectedIndexChanged
D) ItemChanged
A) SelectedItemChanged
B) SelectionChanged
C) SelectedIndexChanged
D) ItemChanged
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
40
A list box should contain a minimum of ____ item(s).
A) two
B) three
C) four
D) five
A) two
B) three
C) four
D) five
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
41
Write the assignment statements needed to increment the intCount counter by 1 and update the decBalance variable by the value stored in the decOrderAmount variable.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
42
Explain the difference between a pretest loop and a posttest loop.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
43
The strCode variable contains an uppercase letter.Write two different Do...Loop clauses that process the loop instructions as long as the value in the strCode variable is either A or B.Use the Until keyword in the first clause,and use the While keyword in the second clause.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
44
You changed the Do clause to the correct For clause in the previous problem.You also changed the Loop keyword to the Next keyword for the For...Next loop.What else needs to be changed about the Do loop?
A) The statement before the loop declaring the counter variable needs to be removed.
B) The statement within the loop incrementing the counter variable needs to be removed.
C) You need to add a step value to the For clause because the default step value is 0.
D) a and b
A) The statement before the loop declaring the counter variable needs to be removed.
B) The statement within the loop incrementing the counter variable needs to be removed.
C) You need to add a step value to the For clause because the default step value is 0.
D) a and b
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
45
What is a counter-controlled loop and when is it used in a program? What statement provides the most efficient way to write a counter-controlled loop?
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
46
Explain the difference between a looping condition and a loop exit condition.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
47
Write a pretest loop that adds together integers from 1 to 50.Use the intNumber variable (which contains the number 1)to keep track of the integers.Store the result in the intResult variable (which contains the number 0).Use the Do...Loop statement and the While keyword.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
48
Write a counter-controlled loop that adds 5,10,15,20,25,and 30 to the lstMinutes control.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
49
Write a pretest loop that adds together the integers 2,4,6,8,10,12,14,16,18,and 20.Use the intNum variable to keep track of the integers.Store the result in the intResult variable (which contains the number 0).Use the For...Next statement.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
50
Write two different Do...Loop clauses that stop the loop when the value in the intAmount is less than or equal to the value in the intLimit variable.Use the Until keyword in the first clause,and use the While keyword in the second clause.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
51
What is a counter? What does it mean to initialize and update a counter in a program?
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
52
What is a list box? Provide two of the Windows standards for its use on a form.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
53
Explain the difference between using the keywords While and Until within a Do...Loop statement.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
54
What is an accumulator? What does it mean to initialize and update an accumulator in a program?
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
55
The following code in a different program is not working properly.The message should display the value of the intCounter variable if the intCounter variable contains a balance that is less than or equal to 15.The message does not display.What mistake did the previous programmer make? 
A) The counter is not initialized.
B) The While keyword should be used instead of the Until keyword.
C) The counter is not incrementing.
D) intCounter += 1 should be changed to intCounter = intCounter + 1.

A) The counter is not initialized.
B) The While keyword should be used instead of the Until keyword.
C) The counter is not incrementing.
D) intCounter += 1 should be changed to intCounter = intCounter + 1.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
56
What is the Refresh method? Write the syntax for this method.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
57
Explain the purpose of priming and update reads in a program.
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
58
Your supervisor wants you to change the Do...Loop in the previous problem to a For...Next loop.He also wants the message to display only three times.Which of the following For clauses should you use?
A) For intCounter As Integer = 1 To 4
B) For intCounter As Integer = 1 To 3
C) For intCounter As Integer = 0 To 3
D) For intCounter = 1 To 3
A) For intCounter As Integer = 1 To 4
B) For intCounter As Integer = 1 To 3
C) For intCounter As Integer = 0 To 3
D) For intCounter = 1 To 3
Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck
59
An application allows the user to enter a salary amount.The application should then calculate and display the possible bonuses based on that salary,using bonus rates of 3-6% in increments of .5%.


Unlock Deck
Unlock for access to all 59 flashcards in this deck.
Unlock Deck
k this deck