COMPUTER SCIENCE CAFÉ
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
  • WORKBOOKS
  • BLOCKY GAMES
  • GCSE
    • CAMBRIDGE GCSE
  • IB
  • A LEVEL
  • LEARN TO CODE
  • ROBOTICS ENGINEERING
  • MORE
    • CLASS PROJECTS
    • Classroom Discussions
    • Useful Links
    • SUBSCRIBE
    • ABOUT US
    • CONTACT US
    • PRIVACY POLICY
PSEUDOCODE
​
GCSE PSEUDOCODE
Picture
This section aims to provide a quick reference guide for Pseudocode at GCSE level. Please note that the exact structure expected by the awarding body may change.
Picture
ASSIGN VARIABLES
variableName ← value
EXAMPLE: userName ← "Bob
INPUT AND OUTPUT
OUTPUT "This will print to the screen"

OUTPUT "Please enter your name"
INPUT userName
OUTPUT "Welcome back " ,userName ​
CONDITIONALS
IF
IF condition
    THEN
        statements
    ELSE
        statements
ENDIF
​
EXAMPLE:
IF variableName = "Bob"
    THEN
        OUTPUT "Welcome back Bob"
    ELSE
       OUTPUT "User not recognised"
ENDIF
CASE OF
CASE OF <identifier>
    <value 1> : <statement>
    <value 2> : <statement>
    OTHERWISE: <statement>
ENDCASE

EXAMPLE:
OUTPUT "Please select 1, 2 or 3"
​INPUT x
CASE OF x
    1 : OUTPUT "You selected 1"
    2: OUTPUT "You selected 2"
    3: OUTPUT "You selected 3"
    OTHERWISE: OUTPUT "Invalid selection was made"
ENDCASE
LOOPS
REPEAT UNTIL LOOPS
REPEAT
    <Statements>
UNTIL <condition>

EXAMPLE:
​REPEAT
    OUTPUT "Please enter your password"
    INPUT Password
UNTIL Password = "Qwerty"
WHILE LOOPS
WHILE <condition> DO
    <statements>
ENDWHILE

​EXAMPLE:
​password ← ​" "
WHILE password  != "Qwerty" DO
    OUTPUT "Please enter your password"
    INPUT password
ENDWHILE
FOR LOOPS
FOR <identifier> ← <value1> TO <value2>
    <statements>
NEXT <identifier>

EXAMPLE:
FOR index  ← 1 TO 10
    OUTPUT "Loop number ", index
​NEXT index
ARRAYS
EXAMPLE OF CREATING AN ARRAY:
DECLARE <identifier> : ARRAY[<1>:<n>] OF <data type>
DECLARE myList : ARRAY [1:10] OF STRING

EXAMPLE OF ASSIGNING A VALUE TO THE ARRAY
myList[1] ← "Bob"

EXAMPLE OF APPENDING A VALUE TO THE ARRAY
APPEND myList ← "Bob"

EXAMPLE OF REMOVING A VALUE FROM THE ARRAY
DELETE myList[1]


FIND THE LENGTH OF AN ARRAY
OUTPUT LEN(myList)
Picture
  1. What is the purpose of using pseudocode in the programming process?
  2. Can you provide an example of a simple pseudocode algorithm for finding the average of two numbers?
  3. Explain the difference between an algorithm written in pseudocode and one written in a programming language.
  4. How can using pseudocode make the process of writing a program easier?
  5. Coding Challenge 1: Write a pseudocode algorithm to find the largest number in an array of integers.
  6. Coding Challenge 2: Write a pseudocode algorithm to determine if a given string is a palindrome.
Picture
USEFUL RESOURCES
IB Pseudocode Coding Practice - Practice Pseudocode online with challenges and solutions
IB Pseudocode quick reference - Pseudocode guide on github
Picture
SUGGESTIONS
We would love to hear from you
SUBSCRIBE 
To enjoy more benefits
We hope you find this site useful. If you notice any errors or would like to contribute material then please contact us.