All free lessons / Computing / Computing thinker: algorithms that work

Computing · FSCE

Computing thinker: algorithms that work

A free preview from the LearnAhead Learning Library — the same lesson registered students learn from.

In this lesson: Explain how a simple algorithm works by tracing it, detect and correct errors in algorithms and programs, and solve problems by decomposing them into smaller parts.

The idea

FSCE computing questions test computational thinking: solving problems the way a computer scientist would. The core tool is the algorithm — an exact list of steps that achieves a goal. Programs use sequence (steps in order), selection (IF... THEN... ELSE: choosing by a condition) and repetition (loops). To explain an algorithm, trace it: follow the steps one by one, keeping track of every value as it changes, until you can say exactly what it does.

Debugging is tracing with a purpose. Run the steps, compare what actually happens with what should happen, and the first step where the two part company is where the bug lives. Fix that step — and only that step — then trace again. The second big skill is decomposition: breaking a big problem into smaller parts that can each be solved and tested, like splitting 'make a game' into movement, scoring, timing and sounds. Around these sit networks and data: computers join networks to share information, the internet is a network of networks, websites live on servers, and search engines find pages by matching your words against an index.

The questions only use computing taught at school up to the end of Year 5 — simple programs, loops and conditions, networks and staying safe online — and any code you need is printed in the question in plain steps, never in a language you must already know.

Worked example

A program should make a floor robot draw a square. It is written as: REPEAT 4 [ move forward 10 steps; turn right 60 degrees ]. When it runs, the robot's path does not join up into a square. What is the bug? A: The loop should repeat 6 times. B: The turn should be 90 degrees, not 60. C: The robot should move forward 4 steps instead of 10. D: The program is missing a sound effect.

  1. Trace the shape the brief asks for: a square has 4 equal sides and 4 corners, and at each corner the robot must turn through 90 degrees to head along the next side.
  2. The program turns only 60 degrees at each corner, so every side sets off in the wrong direction and the path cannot close into a square.
  3. A (repeat 6) would fit a six-sided shape, not the square in the brief. C confuses the number of sides with the length of a side — the 10 steps can stay. D changes nothing about the path.

Answer: B — a square's corners need a 90-degree turn; at 60 degrees the path cannot close into a square.

Worked example: breaking a problem down

Ask of any plan: could I build and test this piece on its own? If yes for every piece, the problem has been decomposed.

Worked example

A team is going to program a quiz game. Which plan best decomposes the problem? A: Write the whole game as one long program, then test it all at the end. B: Split it into parts — asking questions, checking answers, keeping score and timing — and build and test each part. C: Start by choosing the background music and colours. D: Copy a finished game and change its title.

  1. Decomposition means breaking one big problem into smaller sub-problems, each small enough to solve and test separately.
  2. B names four real sub-problems of a quiz game, each buildable on its own. A is the opposite of decomposition — everything at once, tested last. C lists decorations, not parts of the problem. D solves nothing.

Answer: B — it splits the game into parts (questions, checking, score, timing) that can each be built and tested on their own.

Worked example: networks and the internet

Network questions are won with one picture: many computers connected, servers holding the content, devices asking and receiving. Test every statement against that picture.

Worked example

Which statement about the internet is correct? A: The internet is one very large computer that stores every website. B: A website's pages are stored on a server, and your device asks for them across a network of networks. C: A search engine visits every page on the internet at the moment you press search. D: If you delete a shortcut to a website on your computer, the website is deleted for everyone.

  1. B matches how the web works: servers store pages; your device sends a request and the page travels back across connected networks.
  2. A fails: there is no single internet computer — that is the point of a network of networks. C fails on timing: a search engine searches an index it built earlier, which is why results arrive instantly. D fails: a shortcut is only a pointer on your machine; deleting it touches nothing on the server.

Answer: B — pages are stored on servers and requested across the internet, which is a network of networks.

Watch out

Quick check

Try these on your own first — then reveal each answer.

1. A program runs these steps in order: score = 3; score = score + 2; score = score x 2. What is the final value of score?

2. A program says: IF it is raining THEN take an umbrella ELSE take sunglasses. It is not raining. What does the program tell you to take?

3. A program must make a sprite clap exactly 5 times, but it is written as: REPEAT 3 [ clap ]. What is the smallest single change that fixes it?

Was this lesson helpful?

Practise this concept

Reading is the first step — the concept sticks when your child answers questions on it. Registered students practise graded questions for this lesson, with instant marking and worked explanations, and the lesson is marked complete in their progress.