(TCO 5) Your program asks the user to enter a number between 1 and 5. Which is the correct condition for the following validation loop?
(TCO 5) Your program asks the user to enter a number between 1 and 5. Which is the correct condition for the
following validation loop?
int num;
Console.Write(“Please enter a number between 1 and 5:”);
num = Convert.ToInt32(Console.ReadLine());
while (_____________________________)
{
Console.WriteLine(“invalid, please reenter a number between 1 and 5: “);
num = Convert.ToInt32(Console.ReadLine());
}(Points : 3)
num < 1 || num > 5
num < 1 && num > 5
num >= 1 && num <= 5
num >= 1 || num <= 5
(TCO 5) Failure to update the loop control variable within the loop body creates which of the following?(Points : 3)
A.) A counter-controlled loop.B.) An infinite loop.
C.) An event-controlled loop.
D.) None of the above
(TCO 5) What (if anything) is wrong with the following loop?
int x = 1; while (x <10) { Console.WriteLine(x); }(Points : 3) |
A.)The loop body will never execute.B.)It is an infinite loop.C.)The loop control variable is not initialized.D.)Nothing.
(TCOs 5 and 8) Which of the following pseudocode loops will print the even integers from 10 to 20.(Points : 5) |
A.) num = 10
while num <= 20
print num
end while
B.) num = 10
while num <= 20
end while
C.) num = 10
while num <= 20
print num
num = num + 2
end while
D.) num = 20
while num <= 20
print num
num = num + 2
end while
(TCO 5) Your program asks the user to enter a number between 1 and 5. Which is the correct condition for the following validation loop?
int num; Console.Write(“Please enter a number between 1 and 5:”); num = Convert.ToInt32(Console.ReadLine()); while (_____________________________) { Console.WriteLine(“invalid, please reenter a number between 1 and 5: “); num = Convert.ToInt32(Console.ReadLine()); }(Points : 3) |