Question 2.2. (TCO 5) What (if anything) is wrong with the following loop?
| Question 2.2. (TCO 5) What (if anything) is wrong with the following loop? int x=3 ; while (x <10) { Console.WriteLine(x); x = x + 3; } (Points : 3) The loop body will never execute. It is an infinite loop. The loop control variable is not initialized. Nothing. |
| Question 3.3. (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 |
| Question 4.4. (TCOs 5 and 8) Which of the following pseudocode loops will print all the integers starting at 10 and counting down to 1. (Points : 5) num = 10 while num >= 1 print num num = num – 1 end while num = 1 while num <= 10 print num num = num – 1 end while num = 10 while num >= 1 print num end while num = 10 while num >= 10 print num num = num – 1 end while |
| Question 5. ATTACHMENT PREVIEW Download attachmentStep |