Seneca

Complete the Algorithm

Computer Science: KS3, topic 1.2.7

Completing Algorithms

Some exam questions will ask you to state the output of an algorithm.

Interpreting the algorithm

Interpreting the algorithm

  • The first step for this type of question is to identify what the algorithm does.
  • If you can interpret the algorithm, then it will be much easier to follow it.
Trace tables

Trace tables

  • You can draw a table with a column for each variable in the algorithm.
  • Use the table to keep track of the value of each variable.
  • Carefully follow through the code until the end.
  • Finally, the trace table should include your answer.

Test yourself on Complete the Algorithm

  • Trace Tables

  • What do the columns in a trace table represent?

  • Pick the true statement in each pair.

  • Why should you look at what an algorithm does before using a trace table?

Practise this topic for free