Writing an algorithm as numbered steps

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

Writing an algorithm as numbered steps

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which is a well-written algorithm step?
A 2. Get the milk
B Milk
2. How many actions should one step have?
A As many actions as you can fit
B One action per step
3. Which list of steps is numbered correctly?
A 1. Get a bowl 1. Add cereal 1. Show the bowl
B 1. Get a bowl 2. Add cereal 3. Show the bowl
4. Which step starts with a command word?
A 3. Add the milk
B 3. The milk is added
5. Which step has only ONE action?
A 1. Get a cup
B 1. Get a cup and fill it and drink it

Match the Pairs

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

Left columnRight column
11. Get a bowl AStep 3 starts with the command word Show and tells the computer to display something
23. Show the score BStep 1 starts with the command word Get and tells you to do one action
3Each step has only one action, so every action gets its own numbered line CThe step numbers are out of order. They must go 1, 2, 3 in order.
4Steps are numbered 1, 2, 3 in order, and each one starts with a command word D1. Get the milk 2. Add the milk to the bowl
51. Get a cup and add water EThis step has two actions in one line. Split it into 1. Get a cup and 2. Add water.
61. Get a plate 3. Add toast 2. Show the plate F1. Get a cup 2. Add water 3. Show the cup

Definitions

1. Get a bowl

Fill in the Blanks

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

1.
1. ___ a bowl
2.
1. Get a bowl _. Add the cereal
3.
1. Get a cup 2. ___ water 3. Show the full cup
4.
1. Get a cup 2. Add water 3. ____ the full cup
5.
1. Get a bowl 2. Add milk _. Show the bowl

Spot the Error

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

Question 1
A 1. Get a bowl
B 2. Add the cereal
C 4. Add the milk
D 4. Show the breakfast
Question 2
A 1. A cup
B 2. Add water
C 3. Add a tea bag
D 4. Show the tea
Question 3
A 1. Get two slices of bread
B 2. Add butter and then add jam
C 3. Add jam
D 4. Show the sandwich
Question 4
A Get the player's score
B 2. Add 10 to the score
C 3. Show the score
Question 5
A 1. Get a bowl
B 2. Add the pasta
C 2. Add the sauce
D 4. Show the meal

Answer Key

Writing an algorithm as numbered steps
Section A: Quick Questions
Q1
A — 2. Get the milk
Q2
B — One action per step
Q3
B — 1. Get a bowl 2. Add cereal 3. Show the bowl
Q4
A — 3. Add the milk
Q5
A — 1. Get a cup
Section B: Match the Pairs
Q1
1. Get a bowl → Step 1 starts with the command word Get and tells you to do one action
Q2
3. Show the score → Step 3 starts with the command word Show and tells the computer to display something
Q3
Each step has only one action, so every action gets its own numbered line → 1. Get the milk 2. Add the milk to the bowl
Q4
Steps are numbered 1, 2, 3 in order, and each one starts with a command word → 1. Get a cup 2. Add water 3. Show the cup
Q5
1. Get a cup and add water → This step has two actions in one line. Split it into 1. Get a cup and 2. Add water.
Q6
1. Get a plate 3. Add toast 2. Show the plate → The step numbers are out of order. They must go 1, 2, 3 in order.
Section C: Definitions
Q1
1. Get a bowl — A written algorithm step. Each line has one number and one action, and starts with a command word like Get, Add or Show. Steps go 1, 2, 3 in order.
Section D: Fill in the Blanks
Q1
1. Get a bowl
Q2
1. Get a bowl 2. Add the cereal
Q3
1. Get a cup 2. Add water 3. Show the full cup
Q4
1. Get a cup 2. Add water 3. Show the full cup
Q5
1. Get a bowl 2. Add milk 3. Show the bowl
Section E: Spot the Error
Q1
C — The steps must be numbered 1, 2, 3 in order. This step skips from 2 to 4, so it should start with 3.
Q2
A — Every step must start with a command word. '1. A cup' does not tell the computer what to do. It should be '1. Get a cup'.
Q3
B — Each step should have only one action. This line has two actions, so it should be split. Step 2 should be just '2. Add butter'.
Q4
A — Each step needs a number at the start. This line is missing its number. It should be '1. Get the player's score'.
Q5
C — Two steps are numbered 2. Numbers must go 1, 2, 3, 4 with no repeats. This step should be numbered 3.