Answer all questions. box
0 1 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.
Figure 1
film "Godzilla vs. Kong"
year 2021
OUTPUT "Please guess a letter"
letter USERINPUT
0 1 . 1 Which pseudo-code statement assigns the length of the string film to a variable
called value?
Shade one lozenge.
[1 mark]
A film LEN(value)
B film film + value
C value film
D value LEN(film)
0 1 . 2 The POSITION subroutine returns the position of the first occurrence of a character
in a string.
For example:
• POSITION("Godzilla vs. Kong", "o") would return 1
• POSITION("Godzilla vs. Kong", "z") would return 3
letter and film are variables used in the algorithm in Figure 1.
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.
Category | AQA PAPERS AND MARK SCHEME |
Comments | 0 |
Rating | |
Sales | 0 |