31 free questions · No sign-up required to browse
AQA General Tier Exam-style past paper with complete mark schemes, hints, AI assistance and detailed explanations.
Figure 1 shows an algorithm, represented using pseudo-code, which assigns a different value to four variables.
Figure 1
country ← 'United States of America'
state ← 'California'
city ← 'San Francisco'
landmark ← 'Alcatraz Island'
Define the term algorithm.
The variable x is assigned a value using the statement:
x ← LEN(state)
Using Figure 1, what is the value of x?
What is the result of concatenating the contents of the variables city and landmark in Figure 1?
The subroutine POSITION finds the first position of a character in a string.
For example, POSITION('Computing', 'p') would return 3.
The variable z is assigned a value using the statement:
z ← POSITION(landmark, 't')
Using Figure 1, what value is assigned to z?
(Note: The paper states to assume 0-based indexing unless specified otherwise.)
Figure 2 shows an algorithm that uses integer division which has been represented using pseudo-code. Line numbers are included but are not part of the algorithm.
Figure 2
1 again ← True
2 WHILE again = True
3 a ← USERINPUT
4 IF a > 0 THEN
5 counter ← 0
6 WHILE a > 0
7 a ← a DIV 3
8 counter ← counter + 1
9 ENDWHILE
10 ELSE
11 again ← False
12 ENDIF
13 OUTPUT a
14 ENDWHILE
Where is iteration first used in the algorithm in Figure 2?
All 31 questions with worked answers, mark schemes, and AI tutoring.