Deck 6: The Repetition Structure

ملء الشاشة (f)
exit full mode
سؤال
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
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The assignment statement that updates a counter or an accumulator is placed within the loop in a procedure.
سؤال
The symbol used to represent a loop condition on a flowchart is the ____ symbol.

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

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

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

A) posttest
B) pretest
C) selection
D) sequential
سؤال
A counter is always incremented by a constant value.
سؤال
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
سؤال
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
سؤال
In a Do...Loop statement, the keyword While indicates that the loop instructions should be processed while the condition is false.
سؤال
Like the condition in a selection structure, the condition in a loop must evaluate to either True or False.
سؤال
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
سؤال
The startValue in a For...Next loop structure may be omitted.
سؤال
____ means assigning a beginning value to a counter or an accumulator.

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

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

A) Delay
B) Rest
C) Sleep
D) Break
سؤال
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
سؤال
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
سؤال
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)
سؤال
You should use a ____ control to provide keyboard access to a list box.

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

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

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

A) decrementing
B) initializing
C) deprocessing
D) negating
سؤال
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
سؤال
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
سؤال
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
سؤال
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
سؤال
You use the ____ tool in the toolbox to add a list box to an interface.

A) LBox
B) ListBox
C) List
D) Box
سؤال
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
سؤال
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
سؤال
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
سؤال
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 list box should contain a minimum of ____ item(s).

A) two
B) three
C) four
D) five
سؤال
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
سؤال
A unique number called a(n) ____ identifies each item in a collection.

A) counter
B) index
C) accumulator
D) tracker
سؤال
Explain the purpose of priming and update reads in a program.
سؤال
What is a list box? Provide two of the Windows standards for its use on a form.
سؤال
What is an accumulator? What does it mean to initialize and update an accumulator in a program?
سؤال
Explain the difference between a pretest loop and a posttest loop.
سؤال
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
سؤال
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.
سؤال
Write a counter-controlled loop that adds 5, 10, 15, 20, 25, and 30 to the lstMinutes control.
سؤال
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
سؤال
'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"
سؤال
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.
سؤال
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.
سؤال
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
سؤال
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?
سؤال
Explain the difference between a looping condition and a loop exit condition.
سؤال
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.
سؤال
What is the Refresh method? Write the syntax for this method.
سؤال
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.
سؤال
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 .
سؤال
What is a counter? What does it mean to initialize and update a counter in a program?
سؤال
Explain the difference between using the keywords While and Until within a Do...Loop statement.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/60
auto play flashcards
العب
simple tutorial
ملء الشاشة (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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
5
A(n) ____ is a numeric variable used for adding together something.

A) counter
B) updater
C) incrementer
D) accumulator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
6
In either pretest or posttest loops, the controlling condition is evaluated with each repetition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which of the following loop structures always executes at least once?

A) pretest
B) posttest
C) top-driven
D) selection
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
8
The loop created by the For...Next statement is a ____ loop.

A) posttest
B) pretest
C) selection
D) sequential
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
9
A counter is always incremented by a constant value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
13
Like the condition in a selection structure, the condition in a loop must evaluate to either True or False.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
15
The startValue in a For...Next loop structure may be omitted.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
16
____ means assigning a beginning value to a counter or an accumulator.

A) Introducing
B) Initializing
C) Incrementing
D) Updating
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
17
In a pretest loop, the evaluation of the condition occurs after the instructions within the loop are processed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
18
You can make a list box any size you want.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
19
A ____ structure is also referred to as a loop.

A) selection
B) sequence
C) repetition
D) recursion
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
20
In a Do...Loop statement, a condition can be phrased as either a looping condition or a loop enter condition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
21
You can delay program execution using the ____ method.

A) Delay
B) Rest
C) Sleep
D) Break
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
28
Adding increments of a negative number is referred to as ____.

A) decrementing
B) initializing
C) deprocessing
D) negating
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
38
A list box should contain a minimum of ____ item(s).

A) two
B) three
C) four
D) five
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
40
A unique number called a(n) ____ identifies each item in a collection.

A) counter
B) index
C) accumulator
D) tracker
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
41
Explain the purpose of priming and update reads in a program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
42
What is a list box? Provide two of the Windows standards for its use on a form.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
43
What is an accumulator? What does it mean to initialize and update an accumulator in a program?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
44
Explain the difference between a pretest loop and a posttest loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
47
Write a counter-controlled loop that adds 5, 10, 15, 20, 25, and 30 to the lstMinutes control.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
54
Explain the difference between a looping condition and a loop exit condition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
56
What is the Refresh method? Write the syntax for this method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
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 .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
59
What is a counter? What does it mean to initialize and update a counter in a program?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
60
Explain the difference between using the keywords While and Until within a Do...Loop statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 60 في هذه المجموعة.