Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1SUBSTRING(Word, 1, 1) | ASUBSTRING(Word, 1, 3) | |
| 2Word[0] | BReturns the first character of Word, because Cambridge pseudocode numbers the first character as position 1 | |
| 3With one-based numbering, the first three letters of Word start at position 1 | CStarting at 0 is wrong in Cambridge pseudocode, where the first character is position 1. The start should be 1. | |
| 4The same call returns different characters under each numbering rule. With Word ← "CAT", this call gives "C" if counting from 1 but "A" if counting from 0 | DGets the first character in a language that counts positions from 0, such as Python | |
| 5FirstLetter ← SUBSTRING(Name, 0, 1) | EThe answer does not state whether positions start at 0 or 1, so the result is ambiguous. State the numbering used in an exam answer. | |
| 6// Takes the 2nd letter: SUBSTRING(Word, 2, 1) with no numbering stated | FSUBSTRING(Word, 2, 1) |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
SUBSTRING(Word, 1, 1) — Position 1 is the first character in Cambridge pseudocode, so this returns the first letter. Some languages count from 0 instead, so state which numbering you use.First ← SUBSTRING(Word, 1, 1)Word ← "CODE"
OUTPUT SUBSTRING(Word, 1, 2)Word ← "CODE"
Second ← SUBSTRING(Word, 2, 1)Word ← "CODE"
Last ← SUBSTRING(Word, 4, 1)// Python counts from 0, Cambridge from 1