AQA 7517 requires you to be able to use and describe the following string operations in pseudocode:
| Operation | AQA Pseudocode | Example | Result |
|---|---|---|---|
| Length | LEN(str) | LEN("Hello") | 5 |
| Substring | SUBSTRING(str, start, length) | SUBSTRING("Hello World", 6, 5) | "World" |
| Uppercase | UPPER(str) | UPPER("hello") | "HELLO" |
| Lowercase | LOWER(str) | LOWER("HELLO") | "hello" |
| Concatenation | & | "Hello" & " " & "World" | "Hello World" |
| Char to code | ASC(char) | ASC("A") | 65 |
| Code to char | CHR(code) | CHR(65) | "A" |
In AQA pseudocode, strings are typically 1-indexed — the first character has index 1. However, the exact indexing may vary and AQA exam questions will clarify when needed.
Example: For str ← "Computing", SUBSTRING(str, 1, 4) → "Comp"
Note: SUBSTRING(str, start, length) extracts length characters starting at position start.
Reversing a string — iterating backwards using SUBSTRING:
Checking for palindrome — comparing original with reversed version
Extracting digits — using SUBSTRING and checking if character is numeric
Converting case — using ASC/CHR arithmetic: uppercase letters A–Z are codes 65–90; lowercase a–z are 97–122. To convert: CHR(ASC(ch) + 32) converts uppercase to lowercase.
The & operator joins two strings together:
firstName & " " & surname — joins with a space between them
Note: when concatenating strings with numbers, you must convert numbers to string first (language-dependent).
AQA 7517 requires you to use RANDOM to generate random numbers in pseudocode:
RANDOM(lower, upper) — returns a random integer between lower and upper inclusive
Examples:
RANDOM(1, 6) — simulates a dice roll (1, 2, 3, 4, 5, or 6)RANDOM(0, 1) — returns 0 or 1 (simulates a coin flip)RANDOM(1, 52) — selects a random card from a deckComputer-generated "random" numbers are actually pseudo-random — produced by a deterministic algorithm (called a PRNG — pseudo-random number generator) seeded with a starting value. The same seed always produces the same sequence. For truly random behaviour, seeds are taken from unpredictable sources (system time, hardware noise).
.upper()) instead of AQA pseudocode functions (UPPER(str))8 questions · instantly marked · AQA 7517 standard
| Term | Definition |
|---|
10 questions · 10 minutes