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("Happy Days", 1, 5) | AReturns "Happy": 5 characters taken from position 1 | |
| 2SUBSTRING(Word, 3, 1) | BPart ← SUBSTRING(Name, 2, 4) | |
| 3Take the 4 characters of Name that begin at position 2 and store them in Part | CReturns one character: the character at position 3 of Word, as a string | |
| 4Output the first character of Name by extracting one character from the start | DOUTPUT SUBSTRING(Name, 1, 1) | |
| 5SUBSTRING("Happy Days", 5) | ESUBSTRING always returns a string, so it cannot be assigned to an INTEGER variable. | |
| 6Letter: INTEGER Letter ← SUBSTRING(Word, 1, 1) | FThe length argument is missing. SUBSTRING needs three arguments: the string, the start and the length. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
SUBSTRING(<string>, <start>, <length>) — Returns part of a string: length characters taken from the start position. SUBSTRING("Happy Days", 1, 5) gives "Happy". The result is always a string.Part ← SUBSTRING("Happy Days", 1, 5)OUTPUT SUBSTRING("Happy Days", 7, 4)Name ← "Happy Days"
Part ← SUBSTRING(Name, 1, 5)Letter ← SUBSTRING("Happy Days", 7, 1)DECLARE Part : STRING
Part ← SUBSTRING("Happy Days", 1, 5)