Pseudocode & Flowcharts (OCR GCSE Computer Science)

Revision Note

Flashcards
Robert Hampton

Expertise

Computer Science Content Creator

  • When designing algorithms there are two main tools that can be used to describe them:
    • Pseudocode
    • Flowcharts

Exam Tip

Remember, in the exam you will be expected to create, interpret, correct and refine algorithms in either flowcharts, pseudocode or OCR exam reference language

Pseudocode

What is pseudocode?

  • Pseudocode is a text based tool that uses short English words/statements to describe an algorithm
  • Pseudocode is more structured than writing sentences in English, but is very flexible

Example

  • A casino would like a program that asks users to enter an age, if they are 18 or over they can enter the site, if not then they are given a suitable message
Pseudocode

INPUT age

IF age >= 18 THEN

OUTPUT "Welcome to the site"

ELSE

OUTPUT "Sorry, this site is for users 18 and over"

END IF

  • The casino would like the algorithm refined so that the user also enter their first name and this is used to greet the user when they access the site
Pseudocode

INPUT fname

INPUT age

IF age >= 18 THEN

OUTPUT ("Welcome to the site", fname)

ELSE

OUTPUT "Sorry, this site is for users 18 and over"

END IF

What is OCR exam reference language?

  • OCR exam reference language is the officially designed pseudocode that is seen in OCR based exams to describe algorithms
  • Pseudocode has no official syntax so to keep exams consistent OCR have developed their own

Examples

Function OCR exam reference language
OUTPUT print("Hello")
INPUT num = input("Enter a number")
SELECTION

if num == 2 then

...

elseif num < 4 then

...

endif

FOR LOOPS

for i = 1 to 10

...

next i

WHILE LOOPS

while (i != 11)

...

endwhile

Exam Tip

OCR exam reference language is so close to Python syntax that you can write algorithms in Python in both section A and B of the exam!

Worked example

flow-chart-question

Rewrite the flowchart as a pseudocode [4]
You must use either

  • Pseudocode or
  • OCR Exam Reference Language

Answer

Pseudocode OCR exam reference language

INPUT price

IF price < 50 THEN

OUTPUT "Great choice!"

ELSE

OUTPUT "Way too expensive"

END IF

price = input("Enter price")

if price < 50 then

print("Great choice!")

else

print("Way too expensive")

end if

Flowcharts

What is a flowchart?

  • Flowcharts are a visual tool that uses shapes to represent different functions to describe an algorithm
  • Flowcharts show the data that is input and output, the processes that take place and any decisions or repetition
  • Lines are used to show the flow of control

flow-chart-symbols

Example

Flowchart
flow-chart-1

  • The casino would like the algorithm refined so that the user also enter their first name and this is used to greet the user when they access the site
Flowchart
flow-chart-2-1

You've read 0 of your 0 free revision notes

Get unlimited access

to absolutely everything:

  • Downloadable PDFs
  • Unlimited Revision Notes
  • Topic Questions
  • Past Papers
  • Model Answers
  • Videos (Maths and Science)

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

Robert Hampton

Author: Robert Hampton

Rob has over 16 years' experience teaching Computer Science and ICT at KS3 & GCSE levels. Rob has demonstrated strong leadership as Head of Department since 2012 and previously supported teacher development as a Specialist Leader of Education, empowering departments to excel in Computer Science. Beyond his tech expertise, Robert embraces the virtual world as an avid gamer, conquering digital battlefields when he's not coding.