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
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
Play
Full screen (f)
Deck 6: The Repetition Structure
1
The For...Next loop is represented in a flowchart by a hexagon.
True
2
A posttest loop structure is always executed at least once.
True
3
The Do...Loop statement cannot be used to code a pretest loop.
False
4
The startvalue in a For...Next loop structure may be omitted.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
Updating is also called incrementing.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
An accumulator is a numeric variable used for counting something.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
A counter is always incremented by a constant value.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
The stepvalue in a For...Next loop structure must be an integer.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
The Exit Do statement will cause a premature exit from a Do...Loop structure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
The For...Next loop structure is used when the instructions within the loop are to be executed a precise number of times.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
Every program contains the sequence programming structure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
The repetition programming structure is used to make decisions in a program.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
The Exit For statement is used to exit the For...Next routine when the code is finished executing.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
In a pretest loop, the evaluation of a condition occurs after the instructions within the loop are processed.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
In either pretest or posttest loops, the controlling condition is evaluated with each repetition.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
Of the two loop types, pretest and posttest, the posttest is the more commonly used structure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
The process of updating an accumulator or counter is called incrementing.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
An accumulator is incremented by a value that varies.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
The Do...Loop statement executes exactly the same whether using the While or the Until clause.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
The stepvalue in a For...Next loop structure must be positive.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Consider the following Visual Basic .NET code: Dim unitsReceived as Integer, totalCost as Single, cost as String totalCost=0 unitsReceived=0 cost = InputBox("Enter item cost (without $ or comma), click Cancel when finished", "Data Entry") Do While cost "" unitsReceived = unitsReceived + 1 totalCost = totalCost + val(cost) cost = InputBox("Enter item cost (without $ or comma), click Cancel when finished", "Data Entry") Loop The above code represents a ____ loop example.
A) posttest
B) firsttest
C) pretest
D) secondarytest
A) posttest
B) firsttest
C) pretest
D) secondarytest
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
The condition used in the Do...Loop statement must evaluate to an Integer value.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
In the 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 50 flashcards in this deck.
Unlock Deck
k this deck
24
Typically, you enter the SelectAll method in a text box control's ____ event.
A) Closing
B) Enter
C) Click
D) Load
A) Closing
B) Enter
C) Click
D) Load
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
In a For...Next loop structure, which of the following may be omitted when coding?
A) startvalue
B) endvalue
C) stepvalue
D) counter
A) startvalue
B) endvalue
C) stepvalue
D) counter
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
The first action performed by the For...Next loop structure is to ____.
A) test to determine if the loop is to be performed
B) initialize the counter variable
C) change the counter variable by the stepvalue
D) add the startvalue to the stepvalue
A) test to determine if the loop is to be performed
B) initialize the counter variable
C) change the counter variable by the stepvalue
D) add the startvalue to the stepvalue
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
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 50 flashcards in this deck.
Unlock Deck
k this deck
28
A form's ____ event is triggered when a form is about to be closed.
A) Closing
B) Exit
C) ShutDown
D) End
A) Closing
B) Exit
C) ShutDown
D) End
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
When focus is directed to a TextBox that currently has text, the text can be selected with which of the following code?
A) textbox .SelectAll( )
B) textbox .HighlightText()
C) textbox .Select()
D) textbox .Text()
A) textbox .SelectAll( )
B) textbox .HighlightText()
C) textbox .Select()
D) textbox .Text()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
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 50 flashcards in this deck.
Unlock Deck
k this deck
31
The condition in the Do...Loop statement can contain variables, constants, properties, methods, and operators.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
You can close a form using the Close button on its title bar.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
Which statement cancels the closing event triggered by clicking the close button?
A) e.Cancel = True
B) e.Ignore = True
C) e.Cancel = False
D) e.Exit = False
A) e.Cancel = True
B) e.Ignore = True
C) e.Cancel = False
D) e.Exit = False
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
A text box control's ____ event occurs when the user tabs to the control, and when the Focus method is used to send the focus to the control.
A) Enter
B) Tab
C) Focus
D) Text
A) Enter
B) Tab
C) Focus
D) Text
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
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) secondary, primary
C) minor, major
D) dependent, independent
A) inner, outer
B) secondary, primary
C) minor, major
D) dependent, independent
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
If the user clicks the Cancel button in a dialog box or the Close button on the dialog box's title bar, the value returned is ____.
A) an empty string
B) a blank character
C) the numeric value zero
D) the numeric value one
A) an empty string
B) a blank character
C) the numeric value zero
D) the numeric value one
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
You can think of the second hand of a clock as being the outer loop and the minute hand as being the inner loop.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
Consider the following Visual Basic .NET code: Dim unitsReceived as Integer, totalCost as Single, cost as String totalCost=0 unitsReceived=0 cost = InputBox("Enter item cost (without $ or comma), click Cancel when finished", "Data Entry") Do While cost "" unitsReceived = unitsReceived + 1 totalCost = totalCost + val(cost) cost = InputBox("Enter item cost (without $ or comma), click Cancel when finished", "Data Entry") Loop Which instruction represents initialization?
A) totalCost = totalCost + val(cost)
B) unitsReceived=0
C) unitsReceived = unitsReceived + 1
D) cost = InputBox("Enter item cost (without $ or comma), click Cancel when finished", "Data Entry")
A) totalCost = totalCost + val(cost)
B) unitsReceived=0
C) unitsReceived = unitsReceived + 1
D) cost = InputBox("Enter item cost (without $ or comma), click Cancel when finished", "Data Entry")
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
The symbol used to identify a For...Next loop 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 50 flashcards in this deck.
Unlock Deck
k this deck
40
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 50 flashcards in this deck.
Unlock Deck
k this deck
41
A ____ structure is 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 50 flashcards in this deck.
Unlock Deck
k this deck
42
You can close a form using the ____ statement in code.
A) Me.Exit()
B) Me.End()
C) Me.Remove()
D) Me.Close()
A) Me.Exit()
B) Me.End()
C) Me.Remove()
D) Me.Close()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
The Closing procedure can prevent the form from being closed by setting the Cancel property of the procedure's e parameter to ____.
A) True
B) False
C) "Continue"
D) " " (the empty string)
A) True
B) False
C) "Continue"
D) " " (the empty string)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
Which of the following values or variables can be omitted when coding a For...Next loop?
A) counter
B) endvalue
C) stepvalue
D) beginvalue
A) counter
B) endvalue
C) stepvalue
D) beginvalue
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
According to the following code how many times will the loop be executed? Dim startNum, stopNum, stepNum, num As Integer startNum = 1 stopNum = 8 stepNum = 2 For num = startNum To stopNum Step stepNum . . Next num
A) 1
B) 2
C) 3
D) 4
A) 1
B) 2
C) 3
D) 4
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
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 50 flashcards in this deck.
Unlock Deck
k this deck
48
If the stepvalue is omitted when coding a For...Next statement, at execution time the stepvalue is ____.
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 50 flashcards in this deck.
Unlock Deck
k this deck
49
According to the following code when the loop terminates what value is in num? Dim startNum, stopNum, stepNum, num As Integer startNum = 1 stopNum = 8 stepNum = 2 For num = startNum To stopNum Step stepNum . . Next num
A) 5
B) 7
C) 8
D) 9
A) 5
B) 7
C) 8
D) 9
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck