Following an algorithm step by step

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Following an algorithm step by step

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Your algorithm says: 1. Start with 5. 2. Add 3. 3. Double the answer. What do you do first?
A Start with 5, then add 3, then double it
B Double the answer first because it is the biggest step
2. Which is the best way to follow an algorithm?
A Skip steps that look easy
B Do each step exactly as written
3. An algorithm says: 1. Set score to 0. 2. Add 2 to score. 3. Add 2 to score. What is score at the end?
A 4
B 2
4. Why do we write down each value on paper as we follow an algorithm?
A To guess what the answer will be before we start
B To keep track of how the values change at each step
5. A step says: 'Take 2 steps forward.' You are not sure what it means, so what should you do?
A Take exactly 2 steps forward as it says
B Take 3 steps forward because it seems better

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1Step 1: SET total TO 0 AStart by giving a value to track. Write total = 0 on paper before moving to Step 2.
2Step 3: ADD 5 to total (total was 2) BGuessing instead of working it out. The partner should act out the step and say the real new value of score.
3Follow the steps in order, one at a time, and never skip ahead CDo exactly what the step says: 2 + 5 = 7, so write down that total is now 7.
4After the last step, check that your final result is correct DSkipping a step. Every step must be carried out in order, even if it seems unimportant.
5Skipping Step 2 because it looks boring, then doing Step 3 EStep 1, then Step 2, then Step 3, then Step 4
6Step: ADD 4 to score. Partner guesses the answer without working out score FFinal answer: total = 7. Does it match the goal?

Definitions

follow an algorithm

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
SET count ← 2 ADD 3 to count SHOW _____
2.
SET score ← 5 ADD 4 to score // score is now _
3.
SET x ← 10 SUBTRACT 3 from x // check: x should be _
4.
SET steps ← 0 REPEAT 3 TIMES: ADD 4 to steps // steps is now __
5.
SET total ← 1 ___ 2 to total // check: total is 3

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A SET total TO 0
B ADD 5 TO total
C ADD 3 TO score
D SHOW total
Question 2
A START with count = 3
B ADD 1 to count
C ADD 1 to count
D count is now 4
Question 3
A SET a TO 4
B SET b TO 6
C SET c TO a + b
D SHOW a (answer 10)
Question 4
A 1. Write down start: 10
B 2. Subtract 3: write 6
C 3. Subtract 2: write 5
D 4. Check the last number: 5
Question 5
A Partner reads step 1 aloud
B You do step 1 exactly
C Partner reads step 4 aloud
D You do step 2 exactly

Answer Key

Following an algorithm step by step
Section A: Quick Questions
Q1
A — Start with 5, then add 3, then double it
Q2
B — Do each step exactly as written
Q3
A — 4
Q4
B — To keep track of how the values change at each step
Q5
A — Take exactly 2 steps forward as it says
Section B: Match the Pairs
Q1
Step 1: SET total TO 0 → Start by giving a value to track. Write total = 0 on paper before moving to Step 2.
Q2
Step 3: ADD 5 to total (total was 2) → Do exactly what the step says: 2 + 5 = 7, so write down that total is now 7.
Q3
Follow the steps in order, one at a time, and never skip ahead → Step 1, then Step 2, then Step 3, then Step 4
Q4
After the last step, check that your final result is correct → Final answer: total = 7. Does it match the goal?
Q5
Skipping Step 2 because it looks boring, then doing Step 3 → Skipping a step. Every step must be carried out in order, even if it seems unimportant.
Q6
Step: ADD 4 to score. Partner guesses the answer without working out score → Guessing instead of working it out. The partner should act out the step and say the real new value of score.
Section C: Definitions
Q1
follow an algorithm — To carry out each step exactly as written, in order, without skipping steps or guessing. You can track values on paper, check the final result, or act it out with a partner.
Section D: Fill in the Blanks
Q1
SET count ← 2 ADD 3 to count SHOW count
Q2
SET score ← 5 ADD 4 to score // score is now 9
Q3
SET x ← 10 SUBTRACT 3 from x // check: x should be 7
Q4
SET steps ← 0 REPEAT 3 TIMES: ADD 4 to steps // steps is now 12
Q5
SET total ← 1 ADD 2 to total // check: total is 3
Section E: Spot the Error
Q1
C — The algorithm only made a variable called total. Step 3 must add to total, not to score, which was never set up. It should be ADD 3 TO total.
Q2
A — Starting at 3 and adding 1 twice gives 5, but the last line says 4. The start must be count = 2 so the steps give the right result.
Q3
D — The answer 10 is stored in c (4 + 6). Showing a would print 4. The last step should be SHOW c.
Q4
B — 10 minus 3 is 7, not 6. When tracking values on paper you must work out each step exactly. It should say write 7.
Q5
C — Steps must be done in order without skipping. After step 1 comes step 2. The line should be Partner reads step 2 aloud.