Chapter 6 Quiz 1 (VB)
Do Until Loop -
Posttest loop
Which of the following statements are true? [Check all that apply]
The Do While loop is known as a pretest loop because it will test the condition before each iteration. The statements in a Do Until loop must execute at least one time.
Which of the following is a control structure that causes a statement or a group of statements to repeat?
a loop
Visual Basic contains which of the following loop control structures?
all of these the Do Until loop the Do While loop the For loop
For count As Integer = 1 To 5 lstOutput.Items.Add(count) Next
count - counter variable 1 - initial value 5 - terminating value The Next statement increments the value of count.
num = CDbl(InputBox(prompt)) Do While num >= 0 count += 1 sum += num num = CDbl(InputBox(prompt))
count is a counter variable sum is an accumulator variable -1 is called a sentinel value
Each repetition of a loop is known as a(n)
iteration
variable - after do while
loop control variable
Do While Loop -
pretest loop- the condition is tested beforeeach iteration.
In the following Do While loop, the variable number is referred to as what? Do While number < 5 sum = sum + number number = number + 1 Next
the pretest