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.
Answer options
A
1 BEGIN
B
2 SET candy count <- 0
C
3 END WHILE
D
4 DECLARE candy_count
E
5 WHILE candy_count<=100
F
6 candy count <- candy_count+2
G
7 END
H
1423657
I
1 4 5 2 3 6 7
J
1 4 2 5 6 3 7
K
1243657
Correct answer: 1 4 2 5 6 3 7
Explanation
The correct sequence is: 1-BEGIN, 4-DECLARE candy_count, 2-SET candy_count<-0, 5-WHILE candy_count<=100, 6-candy_count+2, 3-END WHILE, 7-END, i.e. '1425637'. The source explanation confirms '1425637'. Option index 9 ('1 4 2 5 6 3 7') matches this order: declare before initialise, initialise before loop, update inside loop, end while, then END.