The answersDownload the PDF
Worksheet

F5.1 What an algorithm is

Algorithms · GCSE · OCR J277 2.1.2, AQA 8525 3.1.1, Edexcel 1CP2 1.2.1 · about 12 min

BugBotLab
NameClassDate

What this lesson is about

Inputs, processes and outputs; what makes an algorithm precise; programs implement algorithms.

Questions 5 marks in all

  1. [1 mark]What is an algorithm?

    1. AA set of step-by-step instructions to solve a problem
    2. BA program written in Python
    3. CA type of computer
    4. DA list of variables
  2. [1 mark]"Drive towards the wall and stop when close." What is wrong with this as an algorithm?

    1. AIt is ambiguous: towards and close are not precise
    2. BIt is too short
    3. CIt has no loop
    4. DNothing is wrong
  3. [1 mark]A program asks for a number of sides, works out the angle and drives the shape. Which are inputs?

    Tick every answer that is true.

    1. AThe number of sides
    2. BThe angle
    3. CThe shape driven
    4. DThe message printed
  4. [1 mark]What does it mean for an algorithm to be finite?

    1. AIt always finishes
    2. BIt uses few variables
    3. CIt only works on small numbers
    4. DIt has exactly one loop
  5. [1 mark]In which forms can an algorithm be written?

    Tick every answer that is true.

    1. AA flowchart
    2. BPseudocode
    3. CProgram code
    4. DA trace table

The task: any shape from an answer

Turn the shape algorithm into a program. Ask How many sides? , work out the corner angle, drive the shape with 20 cm sides, and print drew a shape with <n> sides. The task answers 5. Work the angle out; do not type it.

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()

# 1. Ask how many sides.
# 2. Work out the angle.
# 3. Repeat for each side: drive 20 cm, turn.
# 4. Say how many sides were drawn.

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/f5-1-what-an-algorithm-is/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Write an algorithm in plain English for making a cup of tea, precise enough for a robot. Swap with a partner and find the ambiguous steps.
  2. Write the inputs, processes and outputs for a program that tells you whether a number is even.
  3. Write an algorithm, then a program, that finds out whether a number is prime by trying divisors only up to its square root.