Completing Algorithms

Computer Science: OCR A Level, topic 8.1.3

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 try 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 this table to keep track of the value of each variable, and carefully follow through the code until the end.
  • Finally, the trace table should include your answer.

Test yourself on Completing Algorithms

  • Trace Tables

Practise this topic for free