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: Pseudocode

All topicsPractise exam questions
Knowledge organiser

Designing, creating and refining algorithms

2.1.2c

Complete, write or refine an algorithm

What you need to know

Pseudocode is a simplified, informal way of describing an algorithm that is closer to human language than programming code, but structured like code. OCR uses its own Exam Reference Language as pseudocode in exams. You need to be able to write, read, complete, correct, and refine algorithms written in pseudocode, including using sequence, selection, and iteration.

Key points

  • Pseudocode is not a real programming language but follows a structured format similar to code.
  • OCR exams use the OCR Exam Reference Language as their pseudocode standard.
  • You should be able to write new algorithms and complete partially written ones in pseudocode.
  • You should be able to identify and correct errors in pseudocode algorithms.
  • Pseudocode uses keywords like if/then/else/endif, for/next, while/endwhile, do/until.
  • Nesting means placing one construct inside another, e.g. an if statement inside a loop.

Code examples

OCR Pseudocode: Selection and iteration
text
// Ask user for a number between 1 and 10
valid = false
while valid == false
    num = input("Enter a number 1-10: ")
    num = int(num)
    if num >= 1 AND num <= 10 then
        valid = true
    else
        print("Invalid, try again.")
    endif
endwhile
print("You entered: " + str(num))