Class 6 Computer Science — What is an algorithm?
Follow an algorithm step by step to find what it produces, and explain why changing the order of the steps changes the answer.
Name: ________________________
1.Some steps just do something. Others ask a question first and go one way or the other. Sort each step.
Groups: Just does something · Asks a question first
- If the box is empty, fill it
- Add 5 to the total
- Show the answer on the screen
- If the answer is right, say well done
- If the total is over 20, stop
- Double the number
2.Which of these describes an algorithm best?
- a) Another name for the keyboard
- b) A picture of what a program will look like
- c) A machine that runs inside the computer
- d) A list of clear steps, in order, that finishes the job
3.Another algorithm says: start with 4, then add 3, then double it. What number do you end with?
4.Put these steps in the order a computer runs them to add two numbers and show the total.
- Show the total on the screen
- Read the two numbers
- Add the two numbers together
5.An algorithm says: start with 12, then halve it, then halve it. What number do you end with?
6.Match each short algorithm to the number it ends with.
- Start with 3, then double it
- Start with 3, then add 4
- Start with 10, then halve it
- Start with 4, then double it
- Start with 4, then multiply it by 3
- 8
- 7
- 5
- 6
- 12
7.Why must every algorithm come to an end?
- a) Because the screen would run out of room
- b) Because every algorithm must have exactly five steps
- c) Because computers can only hold ten steps at a time
- d) Because a set of steps that never finishes never gives an answer
8.An algorithm says: start with 20, then halve it, then take away 3. What number do you end with?
Answer key — Class 6 Computer Science — What is an algorithm?
- 1. Add 5 to the total → Just does something; If the total is over 20, stop → Asks a question first; Show the answer on the screen → Just does something; If the box is empty, fill it → Asks a question first; Double the number → Just does something; If the answer is right, say well done → Asks a question first
- 2. d) A list of clear steps, in order, that finishes the job
- 3. 14
- 4. 1. Read the two numbers 2. Add the two numbers together 3. Show the total on the screen
- 5. 3
- 6. Start with 3, then double it → 6; Start with 3, then add 4 → 7; Start with 10, then halve it → 5; Start with 4, then double it → 8; Start with 4, then multiply it by 3 → 12
- 7. d) Because a set of steps that never finishes never gives an answer
- 8. 7