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

Loops in new clothes

Week 3 · 1.2 Iteration · 3 lessons
Answers are for parents and teachers.
1
Write FOR box ← 1 TO 3 / OUTPUT box / NEXT box in two other formats: one with END FOR and one with IN RANGE.
2
What numbers does the counter take in FOR n IN RANGE(6, 10)? How many times does the loop run?
3
Follow the flowchart when the user types 4, and again when the user types 1. What is output each time?
StartINPUT topk ← 2k <= top?yesOUTPUT kk ← k + 1noEnd
4
Draw a flowchart for this loop. Write down its output.
Pseudocode
1FOR plant ← 1 TO 3
2    OUTPUT "Water plant ", plant
3NEXT plant
5
The user types a limit. What happens in FOR n ← 1 TO limit when the limit is 0? Why is that a sensible way for a loop to behave?