Community resourceWorksheet

J277 2.1.2 From problems to algorithms

Part 3 of 3 · J277 2.1.1-2.1.2 · Computational thinking and algorithms

Moving between a written problem, OCR Exam Reference Language and runnable Python.

Students will:

  • describe an algorithm as precise, ordered and finite steps
  • read Exam Reference Language and explain the logic
  • move between pseudocode and Python for the same algorithm
  • implement a described algorithm in Python
  • check an algorithm against its stated purpose

Inside: 5 explanation cells, 2 runnable Python tasks, 4 multiple-choice questions, 1 fill-in-the-blanks cell and 2 written answers. 17 marks, about 45 minutes.

Series: J277 2.1.1-2.1.2 · Computational thinking and algorithms, part 3 of 3.

Shared by Coding PathwayVerified teacher

  • 14 cells
  • About 45 minutes
  • CC BY-SA 4.0
  • Shared 17 Aug 2026
  • Updated 9 Sept 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

From problems to algorithms

An algorithm is a sequence of steps that can be followed to solve a problem. An algorithm should be precise, ordered and finite. You will move between a written problem, OCR-style pseudocode and runnable Python.

OCR may present algorithms in Exam Reference Language or a high-level language. You need to interpret the logic, not memorise a second programming language.

Multiple choice1 mark

Which description is the best algorithm for finding the larger of two entered numbers?

  • AInput both numbers, compare them, then output the greater value
  • BLook at the numbers and decide
  • CUse some code
  • DOutput a number

The same logic in three representations

This flowchart represents a decision about a score:

Flowchart that outputs Pass for scores of at least 50 and Review otherwise Start, input score, test whether score is at least 50. The true branch outputs Pass and the false branch outputs Review. Both paths then reach End. Start Input score score ≥ 50? decision True False Output “Pass” Output “Review” End Rounded box: start or end Parallelogram: input or output Diamond: decision Arrow: order

Trace the arrows from Start. A decision has labelled outcomes, and only the matching path is followed. The flowchart, pseudocode and Python below all express the same algorithm.

OCR-style pseudocode:

score = input("Enter score")
if score >= 50 then
    print("Pass")
else
    print("Review")
endif

Python uses a colon and indentation instead of then and endif. Run the Python version below and change the value of score to test both paths.

Multiple choice1 mark

Trace the flowchart with score = 49. Which output is reached?

  • APass
  • BReview
  • CBoth outputs
  • DNo output
Worked example
score = 64
if score >= 50:
    print("Pass")
else:
    print("Review")

Process and subprogram symbols

The first flowchart used input/output, decision and terminal symbols. OCR also provides separate symbols for an ordinary process and a call to a subprogram:

Process and subprogram flowchart symbols A plain rectangle represents a process such as calculating a total. A rectangle with an additional vertical line near each side represents a call to a named subprogram such as CalculateTotal. Process total = price × quantity work performed here Subprogram CalculateTotal use a separately defined algorithm The additional vertical lines distinguish a subprogram call from an ordinary process.

Use a process rectangle when the calculation or assignment is written inside the flowchart. Use the double-edged subprogram symbol when the flowchart calls a separately defined procedure or function.

Multiple choice1 mark

A flowchart calls a separately defined subprogram named CalculateTotal. Which symbol should contain that name?

  • AA decision diamond
  • BAn input/output parallelogram
  • CA rectangle with an additional vertical line near each side
  • DA rounded terminal symbol
Fill in the blanks3 marks
An algorithm should have steps in a clear label 1, use label 2 instructions and eventually label 3.
  • random
  • finish
  • hardware
  • order
  • precise
Written answer4 marks

Write a numbered algorithm that inputs the length and width of a rectangle, calculates its area and outputs the result.

Use one action per step. Name both inputs, the calculation and the output.

Students type their answer here.

Supported practice: implement the rectangle algorithm

Now express the algorithm you have just described as runnable Python. The supplied rectangle has a length of 8 and a width of 5.

Write statements that multiply length by width, store the result in area, and display it. The supplied values should produce 40. The checks will also use a different rectangle, so calculate from the variables rather than typing 40 directly.

Coding task2 marks
length = 8
width = 5

# 1. Calculate length multiplied by width and store it in area.
# 2. Display area.
Multiple choice1 mark

A program divides a total cost by the number of participants. It fails when zero participants are entered. What is the best refinement?

  • ARemove all inputs
  • BMake the algorithm longer without changing it
  • CChange every variable name
  • DAdd a suitable check or decision for zero
Written answer4 marks

A student writes: 'Input age. Work out the answer. Display it.' Explain two reasons why this is not yet a useful algorithm for calculating a ticket price.

Identify missing or vague information and explain the effect of each problem.

Students type their answer here.

Exam habit

Check an algorithm by tracing representative values and boundary values. Ask: are all required inputs used, is every decision precise, can every valid case reach an output, and does the algorithm finish? In Python or OCR Exam Reference Language, use programming operators such as * for multiplication rather than an informal letter x.