The specification requires you to use a given character encoding table to convert in both directions.
Character → code
Look the character up and read off its code. If it is not listed, use the sequence rule.
Given 'A' = 65, find 'K'.
'K' is the 11th letter, so 65 + 10 = 75.
Code → character
Find the code and read off the character, or count from the nearest anchor.
Given 'a' = 97, what is code 104?
104 − 97 = 7, so it is 7 letters after 'a': a, b, c, d, e, f, g, h. Code 104 is 'h'.
Encoding a whole word
Encode Hi! given 'A'=65, 'a'=97, '!'=33.
| Character | Working | Code |
|---|
H | 65 + 7 (8th letter) | 72 |
i | 97 + 8 (9th letter) | 105 |
! | given | 33 |
Hi! = 72, 105, 33 — three characters, three bytes.
Converting to binary
Character codes are stored in binary (3.3.2):
| Character | Code | Binary (8-bit) |
|---|
H | 72 | 01001000 |
i | 105 | 01101001 |
! | 33 | 00100001 |
The counting trap
Count carefully from the anchor. 'C' is the 3rd letter, so its code is 65 + 2 = 67, not 65 + 3. The offset is (position − 1), because 'A' at position 1 is the anchor itself with offset 0.
A quick check: count the letters between the anchor and your target on your fingers. 'A' to 'C' is two steps.
AQA tip. Always show the calculation rather than just the answer. "'A' = 65, 'K' is 10 letters later, so 65 + 10 = 75" demonstrates the sequence rule, which is the skill being assessed — and it earns method marks if the arithmetic slips.