33. Which output results from the following pseudocode? x = 5 do x = x + 4 while x < 18 Put x to output:
Answer: C
The output results in 21.
After executing the pseudocode, the value of x increases from 5 to 21 through the loop, which adds 4 to x until it is no longer less than 18. Therefore, the final output is 21.
A) 9
Option A is incorrect because starting from an initial value of 5, the first iteration would increase x to 9 (5 + 4), but the loop continues until x is no longer less than 18. Thus, 9 is not a possible output.
B) 16
Option B is also incorrect. While the value of x becomes 16 after two iterations (5 + 4 + 4), the loop will perform another iteration since 16 is still less than 18. Therefore, 16 cannot be the final output.
C) 21
Option C is correct. The loop increments x by 4 repeatedly: first to 9, then to 13, and finally to 17. In the next iteration, x becomes 21 (17 + 4), which is outputted since it is now greater than 18, making 21 the final result.
D) 25
Option D is incorrect as well. Although 25 is greater than 21, the pseudocode does not allow x to reach this value within the specified condition of the loop. The maximum value reached by x before the condition fails is 21.
Conclusion
The correct output of 21 arises from the repeated addition of 4 to the initial value of 5 until the loop condition is no longer satisfied. All other options either represent intermediate values or exceed the logical flow of the pseudocode, confirming that 21 is the definitive and only correct result.