Accenture Essentials Practice Question
It's Halloween. You go from house to house, tricking or treating. You get 2 candies from each house that you go to. You must return home once you collect 100 candies. Can you arrange the sequence for this loop activity.
1 BEGIN
2 SET candy count <- 0
3 END WHILE
4 DECLARE candy_count
5 WHILE candy_count<=100
6 candy count <- candy_count+2
7 ENDAnswer options
A
1 4 2 5 6 3 7
B
FOR loop
C
WHILE loop
D
DO-WHILE loop
Correct answer: 1 4 2 5 6 3 7
Explanation
The correct answer is: 1 4 2 5 6 3 7.