P.S: This is just a study guide. The questions may not appear exactly like this.
1. Which loop structure(s) are post-test?
• While
• Do…Loop While
• For
• Both A and C
2. What (if anything) is wrong with the following loop?
Dim X As Integer
While X < 10
Console.Writeline( X)
End While
• The loop body will never execute.
• It is an infinite loop.
• The loop control variable is not initialized.
• Nothing
3. Your program asks the user to enter a number between 10 and 100. What is the correct condition for the following validation loop?
Dim num As Integer
Console.Write(“Enter a number between 10 and 100: ”)
Num = Console.Readline()
While ________________________________
Console.Write( “Invalid, please reenter a number between 10 and 100: ”)
Num = Console.Readline()
End While
• num >= 10 AND num <= 100
• num >= 10 OR num <= 100
• num < 10 OR num > 100
• num < 10 AND num > 100
4. Write a loop in pseudocode or Visual Basic to print the integers from 10 to 100 counting by 10s.
5. (TCOs 5, 8) Write the pseudocode for the flowchart below, and list what the output will be if the input for num is 9.