AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Again and again

Week 2 · 1.2 Iteration · 3 lessons
Answers are for parents and teachers.
1
How many times does each loop run? (a) FOR a ← 1 TO 5 (b) FOR b ← 0 TO 5 (c) FOR c ← 4 TO 9
2
Follow the algorithm. What is output?
Pseudocode
1OUTPUT "Ready"
2FOR t ← 3 TO 5
3    OUTPUT t - 1
4NEXT t
5OUTPUT "Go"
3
Write a FOR loop that outputs the numbers 20 to 25.
4
The loop should output 1, 2, 3 and 4, and then Done once. The line NEXT k is missing. Explain why this is a problem and rewrite the algorithm correctly.
Pseudocode
1FOR k ← 1 TO 4
2    OUTPUT k
3OUTPUT "Done"
5
Give one everyday example of a count-controlled loop and one of a condition-controlled loop. Why must every loop have a way to stop?