ExamYard Lectures

Program flowcharts, trace tables and dry runs

A Level Computer Science 9618 · Chapter 9, Algorithm design and problem-solving · 5-minute lecture

The teaching part (1 min) is free to watch. A free account opens the whole lecture: 5 practice questions, 2 real past-paper questions with the answers explained, the mistakes that lose marks, the full-marks tip, a one-card summary and a quick quiz.

What this lecture covers

  1. Drawing it and running it by hand
  2. Flowchart symbols
  3. Finding the smallest
Read the transcript of the teaching part

Last time

Before we start: last time, in Abstract data types, you learned these points. Here they are again on one card. Keep them in mind, because today builds on them.

Drawing it and running it by hand

Before you trust an algorithm, you can draw it as a flowchart, or run it by hand with a trace table. A flowchart shows the logic as a picture, with fixed shapes. A trace table shows what every variable holds as the algorithm runs. Both appear in nearly every Paper 2, and both are learned by following rules, not by guesswork.

Flowchart symbols

An oval is the start or end, labelled START or END. A rectangle is a process, such as an assignment or a calculation. A parallelogram is input or output. A diamond is a decision, with two exits labelled yes and no, or true and false. Arrows join the shapes and show the order. A loop is drawn as an arrow back to an earlier box.

Finding the smallest

Task: output the index of the smallest value in a 30-element array. Start. Set Min to 1, the index of the first element. Set I to 2. Decision: is I greater than 30? If yes, output Min and end. If no, decision: is Data[I] less than Data[Min]? If yes, set Min to I. Then I ← I + 1 and go back to the first decision. Every path must lead on. Label both exits of every diamond.

How often it comes up

How often Cambridge has asked each part, counted by ExamYard from every past paper in its question bank: Program flowcharts · Trace tables and dry runs.

The whole chapter: Flowcharts and Trace Tables.

Chapter 9: Algorithm design and problem-solving

Also for A Level Computer Science 9618

Which topics come up most in A Level Computer Science 9618 past papers, counted from every paper since 2004: Paper 1 topic frequency, Paper 2 topic frequency.