You are viewing a free preview of this lesson.
Subscribe to unlock all 4 lessons in this course and every other course on LearningBro.
This lesson focuses on the practical programming skills tested on AQA GCSE Computer Science Paper 1. You will learn the AQA pseudocode conventions, the Python syntax examiners expect, how to complete trace tables step by step, how marks are awarded for code writing questions, and how to approach the most common programming question types.
AQA has its own pseudocode style that is used in exam questions. You must be able to read AQA pseudocode fluently, and you may choose to write your answers in pseudocode instead of Python. Here are the key conventions:
OUTPUT "Enter your name: "
name ← USERINPUT
OUTPUT "Hello, " + name
x ← 10
name ← "Alice"
isValid ← TRUE
IF age >= 18 THEN
OUTPUT "Adult"
ELSE IF age >= 13 THEN
OUTPUT "Teenager"
ELSE
OUTPUT "Child"
ENDIF
FOR i ← 1 TO 10
OUTPUT i
ENDFOR
WHILE answer ≠ "quit"
OUTPUT "Enter a command: "
answer ← USERINPUT
ENDWHILE
REPEAT
OUTPUT "Enter a positive number: "
num ← USERINPUT
UNTIL num > 0
Exam Tip: The REPEAT...UNTIL loop is ideal for input validation because the user must enter something before it can be checked.
SUBROUTINE calculateArea(length, width)
area ← length * width
RETURN area
ENDSUBROUTINE
result ← calculateArea(5, 3)
OUTPUT result
| Operation | Pseudocode | Meaning |
|---|---|---|
| Length | LENGTH("Hello") | Returns 5 |
| Substring | SUBSTRING(2, 4, "Hello") | Returns "llo" (position 2, length 4 — positions start at 0) |
| Concatenation | "Hello" + " " + "World" | Returns "Hello World" |
| Character at position | "Hello"[1] | Returns "e" (0-indexed) |
| Operator | Meaning | Example | Result |
|---|---|---|---|
| + | Addition | 7 + 3 | 10 |
| - | Subtraction | 7 - 3 | 4 |
| * | Multiplication | 7 * 3 | 21 |
| / | Real division | 7 / 2 | 3.5 |
| DIV | Integer division | 7 DIV 2 | 3 |
| MOD | Modulus (remainder) | 7 MOD 2 | 1 |
| ^ | Exponentiation | 2 ^ 3 | 8 |
| Operator | Meaning |
|---|---|
| AND | Both conditions must be TRUE |
| OR | At least one condition must be TRUE |
| NOT | Reverses the truth value |
When writing Python in the exam, examiners expect you to use correct, standard Python syntax. Here are the key constructs:
name = input("Enter your name: ")
age = int(input("Enter your age: "))
print("Hello,", name)
print(f"You are {age} years old")
Exam Tip: Remember that
input()always returns a string. If you need a number, you must cast it usingint()orfloat(). Forgetting to cast is one of the most common errors students make.
if age >= 18:
print("Adult")
elif age >= 13:
print("Teenager")
else:
print("Child")
for i in range(1, 11):
print(i)
range(1, 11) generates 1 to 10 (the end value is exclusive)range(5) generates 0 to 4range(0, 20, 2) generates 0, 2, 4, 6, ..., 18answer = ""
while answer != "quit":
answer = input("Enter a command: ")
def calculate_area(length, width):
area = length * width
return area
result = calculate_area(5, 3)
print(result)
text = "Computer Science"
print(len(text)) # 16
print(text[0]) # C
print(text[-1]) # e
print(text[0:8]) # Computer
print(text.upper()) # COMPUTER SCIENCE
print(text.lower()) # computer science
print(text.find("Science")) # 9
scores = [85, 92, 78, 90, 88]
print(scores[0]) # 85
print(len(scores)) # 5
scores.append(95) # adds 95 to end
scores[2] = 80 # changes 78 to 80
# Writing to a file
file = open("data.txt", "w")
file.write("Hello World\n")
file.close()
# Reading from a file
file = open("data.txt", "r")
contents = file.read()
file.close()
# Reading line by line
file = open("data.txt", "r")
for line in file:
print(line.strip())
file.close()
# Appending to a file
file = open("data.txt", "a")
file.write("New line\n")
file.close()
Exam Tip: File handling questions commonly ask you to read data from a file, process it (e.g., find the highest value), and output the result. Practise these scenarios.
Trace tables are a guaranteed question type on Paper 1. Here is the systematic approach:
Consider this pseudocode:
x ← 1
total ← 0
WHILE x <= 4
total ← total + x
x ← x + 1
ENDWHILE
OUTPUT total
Trace table:
| x | total | OUTPUT |
|---|---|---|
| 1 | 0 | |
| 1 | ||
| 2 | ||
| 3 | ||
| 3 | ||
| 6 | ||
| 4 | ||
| 10 | ||
| 5 | ||
| 10 |
Exam Tip: The WHILE condition
x <= 4is checked before each iteration. When x becomes 5, the condition is FALSE and the loop exits. The final value of total is 10 (which is 1+2+3+4).
| Mistake | How to Avoid It |
|---|---|
| Forgetting to initialise variables | Write starting values in the first row before tracing the loop |
| Updating the wrong variable | Read each line carefully — only change what is on the left of ← or = |
| Skipping iterations | Work through every single iteration — do not try to jump ahead |
| Incorrect loop termination | Check the condition at the right point (before for WHILE, after for REPEAT) |
| Forgetting the final output | Always check if there is an OUTPUT statement after the loop |
Understanding the mark scheme helps you maximise your score:
Subscribe to continue reading
Get full access to this lesson and all 4 lessons in this course.