Revise Computingrevisecomputing.co.uk
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates

Knowledge organisers / Designing, creating and refining algorithms

Create, interpret, correct, complete, and refine algorithms using: Reference language/high-level programming language

All topicsPractise exam questions
Knowledge organiser

Designing, creating and refining algorithms

2.1.2e

Complete, write or refine an algorithm

What you need to know

In addition to pseudocode and flowcharts, you should be able to write and work with algorithms using a high-level programming language such as Python or the OCR Exam Reference Language. This means being able to write complete programs, fix bugs in existing code, and refine algorithms to improve their efficiency or correctness.

Key points

  • You can answer Section B exam questions using either the OCR Exam Reference Language or a high-level language like Python.
  • You should be able to translate between pseudocode, flowcharts, and program code.
  • Programs must use the correct syntax of the chosen language to avoid syntax errors.
  • Refining means improving an algorithm to make it more efficient, correct, or readable.
  • Minor syntax errors in exams are not heavily penalised, but logic must be correct.

Code examples

Python: A simple validated input loop
python
# Validated input in Python
age = int(input("Enter your age (0-120): "))
while age < 0 or age > 120:
    print("Invalid age, try again.")
    age = int(input("Enter your age (0-120): "))

print("Your age is " + str(age))