Deck 6: The Repetition Structure

Full screen (f)
exit full mode
Question
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
Use Space or
up arrow
down arrow
to flip the card.
Question
The assignment statement that updates a counter or an accumulator is placed within the loop in a procedure.
Question
The symbol used to represent a loop condition on a flowchart is the ____ symbol.

A) diamond
B) rectangle
C) hexagon
D) parallelogram
Question
The repetition programming structure is used to make decisions in a program.
Question
A(n) ____ is a numeric variable used for adding together something.

A) counter
B) updater
C) incrementer
D) accumulator
Question
In either pretest or posttest loops, the controlling condition is evaluated with each repetition.
Question
Which of the following loop structures always executes at least once?

A) pretest
B) posttest
C) top-driven
D) selection
Question
The loop created by the For...Next statement is a ____ loop.

A) posttest
B) pretest
C) selection
D) sequential
Question
A counter is always incremented by a constant value.
Question
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?

A) decSubtotal =+ decPrice
B) decPrice =+ decSubtotal
C) decSubtotal += decPrice
D) decPrice += decSubtotal
Question
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
Question
In a Do...Loop statement, the keyword While indicates that the loop instructions should be processed while the condition is false.
Question
Like the condition in a selection structure, the condition in a loop must evaluate to either True or False.
Question
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
Question
The startValue in a For...Next loop structure may be omitted.
Question
____ means assigning a beginning value to a counter or an accumulator.

A) Introducing
B) Initializing
C) Incrementing
D) Updating
Question
In a pretest loop, the evaluation of the condition occurs after the instructions within the loop are processed.
Question
You can make a list box any size you want.
Question
A ____ structure is also referred to as a loop.

A) selection
B) sequence
C) repetition
D) recursion
Question
In a Do...Loop statement, a condition can be phrased as either a looping condition or a loop enter condition.
Question
You can delay program execution using the ____ method.

A) Delay
B) Rest
C) Sleep
D) Break
Question
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
Question
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
Question
Which of the following statements pauses program execution for 3 seconds?

A) System.Threading.Thread.Pause(300)
B) System.Threading.Thread.Sleep(300)
C) System.Threading.Thread.Pause(3000)
D) System.Threading.Thread.Sleep(3000)
Question
You should use a ____ control to provide keyboard access to a list box.

A) radio button
B) text
C) check box
D) label
Question
A(n) ____ read is used to prepare or set up a loop.

A) priming
B) initialization
C) preparation
D) set up
Question
Visual Basic's ____ class contains many methods that your applications can use to perform financial calculations.

A) Money
B) Monetary
C) Finance
D) Financial
Question
Adding increments of a negative number is referred to as ____.

A) decrementing
B) initializing
C) deprocessing
D) negating
Question
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
Question
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
Question
Case-Based Critical Thinking Questions Case 1 - XYZ Solutions
You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs.
The following code is not working properly. The message should display four times. What needs to be changed for the code to work properly?
Do While intCounter
MessageBox.Show("OK")
IntCounter = intCounter + 1
Loop

A) intCounter should be changed to intCounter = 5
B) intCounter should be changed to intCounter > 5
C) intCounter = 1 should be added before the Do statement
D) intCounter = 0 should be added before the Do statement
Question
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
Question
You use the ____ tool in the toolbox to add a list box to an interface.

A) LBox
B) ListBox
C) List
D) Box
Question
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
Question
Case-Based Critical Thinking Questions Case 1 - XYZ Solutions
You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs.
How many times will the message display based on the counter being initialized to 0?
IntCounter = 0
Do While intCounter
MessageBox.Show("OK")
IntCounter = intCounter + 1
Loop

A) zero
B) one
C) four
D) five
Question
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
Question
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
Question
A list box should contain a minimum of ____ item(s).

A) two
B) three
C) four
D) five
Question
Which of the following statements selects the "blue" item, which appears fourth in the lstColor control?

A) lstColor.SelectedIndex = 3
B) lstColor.SelectedIndex = 4
C) lstColor.SelectedItem = 3
D) lstColor.SelectedItem = 4
Question
A unique number called a(n) ____ identifies each item in a collection.

A) counter
B) index
C) accumulator
D) tracker
Question
Explain the purpose of priming and update reads in a program.
Question
What is a list box? Provide two of the Windows standards for its use on a form.
Question
What is an accumulator? What does it mean to initialize and update an accumulator in a program?
Question
Explain the difference between a pretest loop and a posttest loop.
Question
Case-Based Critical Thinking Questions Case 1 - XYZ Solutions
You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs.
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
Question
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.
Question
Write a counter-controlled loop that adds 5, 10, 15, 20, 25, and 30 to the lstMinutes control.
Question
Case-Based Critical Thinking Questions Case 1 - XYZ Solutions
You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs.
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
Question
'fill list boxes with values for men's pant sizes for
'pant waist and pant length
For intWaist As Double = 28 to 46
lstWaist.Items(intWaist.ToString("N0"))
Next intWaist
SelectedItem = "28"
For intLength As Integer = 26 to 36 Step .5
lstLength.Items.Add(dblLength.ToString("N1"))
Next dblLength
lstLength.SelectedIndex = "26"
Question
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.
Question
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.
Question
Problems - Correcting Logic and Code Errors
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
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%.
' displays bonus amounts using rates
' of 3% - 6% in increments of .5%
Dim dblSalary As Decimal
Dim decBonus As Decimal
TryParse(txtSalary.Text, decSalary)
lblBonus.Text = String.Empty
For decRate As Decimal = 0.03 To 0.06 Step 0.5
decBonus = decSalary + decRate
lblBonus.Text = lblBonus.Text & decRate.ToString("P1") & " " & decBonus.ToString("C2") & ControlChars.NewLine
Next decRate
Question
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?
Question
Explain the difference between a looping condition and a loop exit condition.
Question
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.
Question
What is the Refresh method? Write the syntax for this method.
Question
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.
Question
Case-Based Critical Thinking Questions Case 1 - XYZ Solutions
You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs.
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?
IntCounter = 1
Do Until intCounter
MessageBox.Show(intCounter)
IntCounter += 1
Loop

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 .
Question
What is a counter? What does it mean to initialize and update a counter in a program?
Question
Explain the difference between using the keywords While and Until within a Do...Loop statement.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/60
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 6: The Repetition Structure
1
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
B
2
The assignment statement that updates a counter or an accumulator is placed within the loop in a procedure.
True
3
The symbol used to represent a loop condition on a flowchart is the ____ symbol.

A) diamond
B) rectangle
C) hexagon
D) parallelogram
A
4
The repetition programming structure is used to make decisions in a program.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
5
A(n) ____ is a numeric variable used for adding together something.

A) counter
B) updater
C) incrementer
D) accumulator
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
6
In either pretest or posttest loops, the controlling condition is evaluated with each repetition.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following loop structures always executes at least once?

A) pretest
B) posttest
C) top-driven
D) selection
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
8
The loop created by the For...Next statement is a ____ loop.

A) posttest
B) pretest
C) selection
D) sequential
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
9
A counter is always incremented by a constant value.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
10
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?

A) decSubtotal =+ decPrice
B) decPrice =+ decSubtotal
C) decSubtotal += decPrice
D) decPrice += decSubtotal
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
11
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
12
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 60 flashcards in this deck.
Unlock Deck
k this deck
13
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 60 flashcards in this deck.
Unlock Deck
k this deck
14
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
15
The startValue in a For...Next loop structure may be omitted.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
16
____ means assigning a beginning value to a counter or an accumulator.

A) Introducing
B) Initializing
C) Incrementing
D) Updating
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
17
In a pretest loop, the evaluation of the condition occurs after the instructions within the loop are processed.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
18
You can make a list box any size you want.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
19
A ____ structure is also referred to as a loop.

A) selection
B) sequence
C) repetition
D) recursion
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
20
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 60 flashcards in this deck.
Unlock Deck
k this deck
21
You can delay program execution using the ____ method.

A) Delay
B) Rest
C) Sleep
D) Break
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
22
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
23
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
24
Which of the following statements pauses program execution for 3 seconds?

A) System.Threading.Thread.Pause(300)
B) System.Threading.Thread.Sleep(300)
C) System.Threading.Thread.Pause(3000)
D) System.Threading.Thread.Sleep(3000)
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
25
You should use a ____ control to provide keyboard access to a list box.

A) radio button
B) text
C) check box
D) label
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
26
A(n) ____ read is used to prepare or set up a loop.

A) priming
B) initialization
C) preparation
D) set up
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
27
Visual Basic's ____ class contains many methods that your applications can use to perform financial calculations.

A) Money
B) Monetary
C) Finance
D) Financial
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
28
Adding increments of a negative number is referred to as ____.

A) decrementing
B) initializing
C) deprocessing
D) negating
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
29
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
30
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
31
Case-Based Critical Thinking Questions Case 1 - XYZ Solutions
You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs.
The following code is not working properly. The message should display four times. What needs to be changed for the code to work properly?
Do While intCounter
MessageBox.Show("OK")
IntCounter = intCounter + 1
Loop

A) intCounter should be changed to intCounter = 5
B) intCounter should be changed to intCounter > 5
C) intCounter = 1 should be added before the Do statement
D) intCounter = 0 should be added before the Do statement
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
32
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
33
You use the ____ tool in the toolbox to add a list box to an interface.

A) LBox
B) ListBox
C) List
D) Box
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
34
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
35
Case-Based Critical Thinking Questions Case 1 - XYZ Solutions
You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs.
How many times will the message display based on the counter being initialized to 0?
IntCounter = 0
Do While intCounter
MessageBox.Show("OK")
IntCounter = intCounter + 1
Loop

A) zero
B) one
C) four
D) five
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
36
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
37
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
38
A list box should contain a minimum of ____ item(s).

A) two
B) three
C) four
D) five
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
39
Which of the following statements selects the "blue" item, which appears fourth in the lstColor control?

A) lstColor.SelectedIndex = 3
B) lstColor.SelectedIndex = 4
C) lstColor.SelectedItem = 3
D) lstColor.SelectedItem = 4
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
40
A unique number called a(n) ____ identifies each item in a collection.

A) counter
B) index
C) accumulator
D) tracker
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
41
Explain the purpose of priming and update reads in a program.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
42
What is a list box? Provide two of the Windows standards for its use on a form.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
43
What is an accumulator? What does it mean to initialize and update an accumulator in a program?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
44
Explain the difference between a pretest loop and a posttest loop.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
45
Case-Based Critical Thinking Questions Case 1 - XYZ Solutions
You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs.
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
46
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 60 flashcards in this deck.
Unlock Deck
k this deck
47
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 60 flashcards in this deck.
Unlock Deck
k this deck
48
Case-Based Critical Thinking Questions Case 1 - XYZ Solutions
You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs.
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
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
49
'fill list boxes with values for men's pant sizes for
'pant waist and pant length
For intWaist As Double = 28 to 46
lstWaist.Items(intWaist.ToString("N0"))
Next intWaist
SelectedItem = "28"
For intLength As Integer = 26 to 36 Step .5
lstLength.Items.Add(dblLength.ToString("N1"))
Next dblLength
lstLength.SelectedIndex = "26"
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
50
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 60 flashcards in this deck.
Unlock Deck
k this deck
51
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 60 flashcards in this deck.
Unlock Deck
k this deck
52
Problems - Correcting Logic and Code Errors
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
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%.
' displays bonus amounts using rates
' of 3% - 6% in increments of .5%
Dim dblSalary As Decimal
Dim decBonus As Decimal
TryParse(txtSalary.Text, decSalary)
lblBonus.Text = String.Empty
For decRate As Decimal = 0.03 To 0.06 Step 0.5
decBonus = decSalary + decRate
lblBonus.Text = lblBonus.Text & decRate.ToString("P1") & " " & decBonus.ToString("C2") & ControlChars.NewLine
Next decRate
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
53
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 60 flashcards in this deck.
Unlock Deck
k this deck
54
Explain the difference between a looping condition and a loop exit condition.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
55
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 60 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 60 flashcards in this deck.
Unlock Deck
k this deck
57
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 60 flashcards in this deck.
Unlock Deck
k this deck
58
Case-Based Critical Thinking Questions Case 1 - XYZ Solutions
You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs.
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?
IntCounter = 1
Do Until intCounter
MessageBox.Show(intCounter)
IntCounter += 1
Loop

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 60 flashcards in this deck.
Unlock Deck
k this deck
59
What is a counter? What does it mean to initialize and update a counter in a program?
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
60
Explain the difference between using the keywords While and Until within a Do...Loop statement.
Unlock Deck
Unlock for access to all 60 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 60 flashcards in this deck.