FC0-U61 · Question #864
Given the following pseudocode: arduino Copy code WHILE X < 12 print "Counting" X += 1 If X=7, which of the following is the number of times the message will be displayed?
The correct answer is B. Seven. In the given pseudocode, the message "Counting" is printed in a loop while X is less than 12. The variable X starts incrementing by 1 each time through the loop. If X starts at 0, the loop will run and display the message 7 times before X reaches 7. The loop starts with X = 0. Fo
Question
Given the following pseudocode:
arduino Copy code WHILE X < 12 print "Counting" X += 1 If X=7, which of the following is the number of times the message will be displayed?
Options
- AFive
- BSeven
- CEleven
- DTwelve
How the community answered
(41 responses)- A2% (1)
- B80% (33)
- C12% (5)
- D5% (2)
Explanation
In the given pseudocode, the message "Counting" is printed in a loop while X is less than 12. The variable X starts incrementing by 1 each time through the loop. If X starts at 0, the loop will run and display the message 7 times before X reaches 7. The loop starts with X = 0. For X values from 0 to 6, the message is printed, making a total of 7 times before X becomes 7 and the loop
Topics
Community Discussion
No community discussion yet for this question.