1. (TCO 5) Which piece of pseudocode represents updating the loop control variab
ID: 671712 • Letter: 1
Question
1. (TCO 5) Which piece of pseudocode represents updating the loop control variable? rep = 1
rep = rep + 1
while rep < 5
print rep
int x ;
while (x <10)
{
Console.WriteLine(x);
x = x + 2;
} (Points : 3) The loop body will never execute.
It is an infinite loop.
The loop control variable is not initialized.
Nothing.
Explanation / Answer
1. In the following pseudocode loop control variable is rep but increment is outside the loop. Thus, the value of rep will never increase and each time it will print 2.
Loop control statement should be written inside the while loop. So that value of rep increases and display the result properly.
2. In the given pseudocode, x variable is not initialized. Thus, the main problem is loop control variable is not initialized.
3. num < 1 || num > 10
Explanation:
4. option 1.
Explanation:
5. Pseudocode steps for the given flowchart:
Output:
9
7
16
Explanation:
Iteration 1:
Iteration 2:
Iteration 3:
Thus, output becomes 9, 7, 16.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.