These questions follow Algorithms in Everyday Life — and the literal-minded robot from The Sandwich Robot is watching.

Questions

  1. Write instructions for making toast that would survive the most literal reading possible. Aim for six to eight numbered steps.
  2. Match each description to a term — algorithm, variable, loop, condition: (a) a named box holding a value, (b) a precise list of steps, (c) a test that picks a path, (d) a repeat.
  3. Predict the output. Trace the spoken algorithm “start at 1; while it is 20 or less, double it; say the number” — then as code:
    number = 1
    while number <= 20:
        number = number * 2
    print(number)
  4. Find the bug in this hot-chocolate algorithm: (1) drink, (2) stir, (3) add cocoa to the mug, (4) pour in hot milk. Give an order that works, and name what kind of error this is.
  5. A program finds locker 23 by checking locker 1, then 2, then 3, and so on. The lockers are numbered in order. Describe a better algorithm, and say roughly how much work it saves.
  6. Challenge. Write a plain-language algorithm for finding the biggest of three numbers — precise enough to need no judgement.

Answers

Curriculum connection

C1.2

describe simple algorithms that are encountered in everyday situations

Link to original

C1.1

use appropriate terminology to describe programming concepts and algorithms

Link to original