Skip to main content
EnglandComputer ScienceSyllabus dot point

How do you design and present an algorithm using pseudocode and flowcharts?

Producing algorithms using pseudocode and flowcharts to solve a problem, identifying the inputs, processes and outputs, and interpreting, correcting and refining algorithms others have written.

An OCR J277 2.1.2 answer on designing algorithms with pseudocode and flowcharts: identifying inputs, processes and outputs, the OCR Exam Reference Language, the standard flowchart symbols, and interpreting, correcting and refining algorithms.

Generated by Claude Opus 4.811 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. Inputs, processes and outputs
  3. Pseudocode and the OCR Exam Reference Language
  4. Flowcharts
  5. Interpreting, correcting and refining
  6. Try this

What this dot point is asking

OCR wants you to design algorithms and present them in two forms, pseudocode and flowcharts, and to read, correct and refine algorithms written by others. You must identify the inputs, processes and outputs of a problem. Pseudocode in the exam is shown in the OCR Exam Reference Language, so you must recognise its notation. This is examined throughout Paper 2, including Section B.

Inputs, processes and outputs

For example, a program that works out the area of a rectangle has inputs (the length and width), a process (multiply length by width), and an output (the area). Naming them keeps the design focused.

Pseudocode and the OCR Exam Reference Language

A short ERL example that finds the largest of three numbers entered by the user:

a = int(input("First number: "))
b = int(input("Second number: "))
c = int(input("Third number: "))
largest = a
if b > largest then
  largest = b
endif
if c > largest then
  largest = c
endif
print("The largest is " + str(largest))

Flowcharts

The age-check algorithm as a flowchart:

flowchart TD A([Start]) --> B[/Input age/] B --> C{age >= 18?} C -->|Yes| D[/Output Adult/] C -->|No| E[/Output Child/] D --> F([Stop]) E --> F

Interpreting, correcting and refining

Refining an algorithm means improving it after it works, for example by making it handle invalid input, removing repeated code, or making it clearer. You are often asked to add validation or extend an algorithm to cover an extra case.

Try this

Q1. State the three things every algorithm can be described in terms of. [1 mark]

  • Cue. Inputs, processes and outputs.

Q2. Name the flowchart symbol used for a decision, and state its shape. [1 mark]

  • Cue. A decision, drawn as a diamond.

Q3. Write a pseudocode line that adds 1 to a variable called count. [1 mark]

  • Cue. count = count + 1.

Exam-style practice questions

Practice questions written in the style of OCR exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

OCR 20214 marksA program asks the user for their age, then prints whether they are an adult (18 or over) or a child. Write an algorithm for this, using pseudocode or a flowchart.
Show worked answer →

Award marks for correct input, a correct condition, and the right output for each branch. A pseudocode answer in the OCR Exam Reference Language:

age = input("Enter your age: ")
if age >= 18 then
  print("Adult")
else
  print("Child")
endif

Marks: input into a variable (1), a selection using if ... then ... else ... endif (1), the correct comparison >= 18 (1), and the correct output on each branch (1). A flowchart with a parallelogram input, a diamond decision testing age >= 18, and two output boxes earns the same marks. Casting the input with int(...) is good practice and never penalised.

OCR 20223 marksAn algorithm is meant to add up the numbers from 1 to 10 and print the total, but it contains an error. Identify the error in the algorithm below and write the corrected line. total = 0 for i = 1 to 10 total = i next i print(total)
Show worked answer →

The error is on the line inside the loop: total = i overwrites the total with the current value of i each time, so it ends up holding 10, not the running sum.

The corrected line is total = total + i, which adds the current number to the running total each time round the loop, giving the correct answer of 55.

Markers reward correctly identifying the faulty line and giving the correct replacement that accumulates the total. Just saying "it is wrong" without the fix does not gain the correction mark.

Related dot points

Sources & how we know this