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

Test as you go

Week 25 · Unit 10: Be a storyteller · 3 lessons
3

Spot the mismatch

Computing 2: Unit 10, pp. 134–148
GoalCompare an algorithm with a program and find the blocks that do not match.
New words
match · to be the samemismatch · two things that should be the same but are notdebug · to find and fix errors
Explanation

A program should match its algorithm. Read the algorithm step by step. Read the blocks in the same order. Look at each block and each number. If a block is different from the step, that is an error. Change the block so that it matches. Then test again.

StepInstruction
1Start on tap
2Move up 4
3Hop 2
4Stop
Worked examples
43
Here is a program for the algorithm above. The hop block says 3, but the step says 2. The red outline shows the error. Change 3 to 2.
32
The algorithm is: start on bump, turn right 3, hop 1, stop. This program has two errors. The first block is a tap, and the hop says 2. Fix them one at a time, and test after each fix.
After you fix an error, test again. Sometimes a fix shows another error, or the program is right at last.
Class activity

Mistake detectives (pairs): each of you writes an algorithm of four steps and makes the block cards for it. Secretly change one card so that it does not match, for example a different number. Swap. The detective puts the algorithm next to the cards, checks step by step, finds the mismatch and fixes it.

Practice
1
The algorithm is: start on green flag, move left 2, say “Yes!”, stop. Which block does not match?
2Yes!
2
The algorithm says hop 3. The block says hop 5. What do you change?
3
The algorithm is: start on tap, move up 1, hop 2, say “Hi!”, stop. Which block is missing?
1?Hi!
4
Why should you test again after you fix an error?