AQA · GCSE · Computer Science · Higher
Finding substring position in pseudo-code
Figure 1 shows an algorithm, represented using pseudo-code. The algorithm assigns different values to two variables, then asks the user to input a letter.
| film ← "Godzilla vs. Kong" |
| year ← 2021 |
| OUTPUT "Please guess a letter" |
| letter ← USERINPUT |
Complete the pseudo-code statement to find the position of the first occurrence of the contents of letter in film and store this position in the variable location. You must use the POSITION subroutine in your answer.
Practice unavailable
This question can be viewed, but its original response format is not available for practice yet.
Write your answer first. You can study the marking guidance whenever you need it.
Study the marking See what earns credit and compare it with a full-mark answer.
Marking points
- 1 Calls POSITION with film first and letter second, without quotation marks.