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

Term 1 review

Week 11 · Review: Term 1 · 3 lessons
1

Algorithms, bugs and repeats

Computing 2: Units 1–4, pp. 8–65
GoalReview precise algorithms, programs, bugs and repeat blocks with new questions.
New words
algorithm · a precise set of steps in the right orderbug · a mistake in an algorithm or a programrepeat · to do something again
Explanation

An algorithm is a set of precise steps in the right order. A program is an algorithm that is changed into code, block by block. A bug is a mistake, and debugging means finding and fixing it. A repeat block runs the blocks inside it again and again. Blocks outside the repeat block run only once. Trace a program step by step to see what it does.

2112Yes!
Worked examples
Not precisePrecise
Water the plantsFill the can with water
Pour some water on each plant
Precise or not? “Water the plants” is not precise. “Fill the can, then pour water on each plant” says exactly what to do.
AfterAcrossUpHops
right 2200
round 1211
round 2222
Trace the program above. The character moves right 2. Then it goes up 1 and hops 1, two times. It ends 2 across and 2 up, and it has hopped 2 times. Last it says Yes! once.
StepWith a bugFixed
1Zip the bagPut in the books
2Put in the booksPut in the lunchbox
3Put in the lunchboxZip the bag
Find the bug: an algorithm for packing a school bag says 1 Zip the bag. 2 Put in the books. 3 Put in the lunchbox. The zip step must go last.
Class activity

Partner programs: write a program for your partner on six paper cards: start, walk 2 steps, a repeat card with the number 3, clap, stop. Put the clap card inside the repeat card. Your partner follows the cards exactly. Then swap two cards by mistake so that the program has a bug. Can your partner find it and fix it? Finish by saying why a precise algorithm matters.

Practice
1
The algorithm says: start on tap, move up 4, hop 2, stop. Which block does not match?
32
2
Use a repeat block for right 3, right 3, right 3, right 3. How far does the character go?
3
Which algorithm is more precise? A: Draw some flowers. B: Draw 3 red flowers.
4
How many times does the say block run, and how many times does the hop block run?
Hi!14