Pseudocode (SQA National 5 Computing Science): Revision Note

Exam code: X816 75

Robert Hampton

Written by: Robert Hampton

Reviewed by: James Woodhouse

Updated on

Pseudocode

What is pseudocode?

  • Pseudocode is a text-based way of describing the steps in an algorithm

  • It uses short English statements to show what the program should do, without using the full syntax of a programming language

  • Pseudocode is structured and logical, helping you plan your solution before coding it

Example

  • A website wants a program that asks users to enter their age

  • If they are 18 or over, they are allowed to enter the site

  • If they are under 18, they are shown a suitable message

RECEIVE age FROM KEYBOARD
IF age >= 18 THEN
    SEND "Welcome to the site" TO DISPLAY
ELSE
    SEND "Sorry, this site is for users aged 18 and over" TO DISPLAY
END IF
  • The program asks the user to enter their age

  • The value entered is stored in a variable called age

  • The IF statement checks whether the user is 18 or older

  • If the condition is true, the message “Welcome to the site” is displayed

  • If the condition is false, the message “Sorry, this site is for users aged 18 and over” is displayed

  • The program then ends after showing the correct message

Examiner Tips and Tricks

  • Do not use real code syntax like print() or input()

  • Use SQA pseudocode keywords such as:

    • RECEIVE ... FROM KEYBOARD

    • SEND ... TO DISPLAY

  • Indent your code inside IF, REPEAT, and WHILE blocks to make it clear

  • Write pseudocode, not English sentences, keep it structured and consistent

Example (refined version)

  • The website now wants the program to ask for the user’s first name and use it to greet them

RECEIVE firstName FROM KEYBOARD
RECEIVE age FROM KEYBOARD
IF age >= 18 THEN
    SEND "Welcome to the site " & firstName TO DISPLAY
ELSE
    SEND "Sorry, this site is for users aged 18 and over" TO DISPLAY
END IF
  • The program first asks for the user’s first name and stores it in firstName

  • It then asks for the user’s age and stores it in age

  • The IF condition checks whether the age entered is 18 or more

  • If it is, the program joins (“concatenates”) the text “Welcome to the site” with the user’s name and displays it, for example:

    • Welcome to the site Sarah

  • If the age is under 18, the program displays the same rejection message as before

  • The program then ends

Examiner Tips and Tricks

  • If you’re asked to design an algorithm, use pseudocode by default

  • Only use flowcharts if the question specifically asks for one or if you find it easier to show logic visually

  • Clarity is more important than fancy formatting

Unlock more, it's free!

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

the (exam) results speak for themselves:

Robert Hampton

Author: Robert Hampton

Expertise: Computer Science Content Creator

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.

James Woodhouse

Reviewer: James Woodhouse

Expertise: Computer Science & English Subject Lead

James graduated from the University of Sunderland with a degree in ICT and Computing education. He has over 14 years of experience both teaching and leading in Computer Science, specialising in teaching GCSE and A-level. James has held various leadership roles, including Head of Computer Science and coordinator positions for Key Stage 3 and Key Stage 4. James has a keen interest in networking security and technologies aimed at preventing security breaches.