AQA
GCSE
COMPUTER SCIENCE
Paper 1 Computational thinking and programming skills – Python
Friday 19 May 2023 Afternoon Time allowed: 2 hours
Materials
• There are no additional materials required for this paper.
• You must not use a calculator.
Instructions
• Use black ink or black ball-point pen. Use pencil only for drawing.
• Answer all questions.
• You must answer the questions in the spaces provided.
• If you need extra space for your answer(s), use the lined pages at the end of this book. Write the question number against your answer(s).
• Do all rough work in this book. Cross through any work you do not want to be marked.
• Questions that require a coded solution must be answered in Python.
• You should assume that all indexing in code starts at 0 unless stated otherwise.
Information
The total number of marks available for this paper is 90.
Advice
*Jun01* IB/G/Jun23/E11 8525/1B
Answer all questions.
box
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.
[2 marks]
. The variable x is assigned a value using the statement:
x LEN(state)
Using Figure 1, what is the value of x? Shade one lozenge.
[1 mark]
A 1
B 5
C 10
D 12
. What is the result of concatenating the contents of the variables city and
landmark in Figure 1? Shade one lozenge.
[1 mark]
box
A San Francisco Alcatraz Island
B San Francisco,Alcatraz Island
C San Francisco, Alcatraz Island
D San FranciscoAlcatraz Island
. The subroutine SUBSTRING extracts characters from a given string.
For example, SUBSTRING(3, 5, 'Computing') would return put
The variable y is assigned a value using the statement:
y SUBSTRING(4, 7, landmark)
Using Figure 1, what is the value of y? Shade one lozenge.
[1 mark]
A Alca
B Atra
C land
D traz
Question 1 continues on the next page
Turn over ►
Figure 1 has been included again below.
Figure 1
country 'United States of America'
state 'California'
city 'San Francisco'
landmark 'Alcatraz Island'
. 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? Shade one lozenge.
[1 mark]
box
A –1
B 3
C 4
D 5
Turn over for the next question
DO NOT WRITE ON THIS PAGE ANSWER IN THE SPACES PROVIDED
box
Turn over ►
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
Integer division is the number of times one integer divides into another, with the remainder ignored.
For example:
• 14 DIV 5 evaluates to 2
• 25 DIV 3 evaluates to 8
box
. Where is iteration first used in the algorithm in Figure 2?
Shade one lozenge.
[1 mark]
A Line number 2
B Line number 4
C Line number 6
D Line number 11
. In the algorithm in Figure 2, what will be output when the user input is 10?
Shade one lozenge.
[1 mark]
box
A 0
B 1
C 2
D 4
. In the algorithm in Figure 2, what is the largest possible value of the variable
counter when the user input is 36? Shade one lozenge.
[1 mark]
A 0
B 2
C 4
D 5
Explain one advantage of the structured approach to programming.
[2 marks]
*07*
Turn over ►
Figure 3 shows a program written in Python that calculates the area of a rectangle or the volume of a box from the user inputs.
Figure 3
box
def calculate(width, length, height):
if height == -1:
return width * length
else:
return width * length * height
numOne = int(input("Enter width: "))
numTwo = int(input("Enter length: "))
numThree = int(input("Enter height, –1 to ignore: "))
answer = calculate(numOne, numTwo, numThree)
if numThree == -1:
print(f"Area {answer}")
else:
print(f"Volume {answer}")
. Complete the trace table using the program in Figure 3.
[3 marks]
numOne numTwo numThree Final output
5 6 –1
10 4 0
3 5 10
. Describe one way that the program in Figure 3 could be made more robust.
[1 mark]
Figure 4 shows an algorithm presented as a flowchart.
Figure 4
Complete the trace table for the algorithm in Figure 4. You may not need to use all the rows in the table.
[3 marks]
box
Turn over ►
Figure 5 shows an algorithm represented using pseudo-code. The algorithm is for a simple authentication routine.
The pseudo-code uses a subroutine getPassword to check a username:
• If the username exists, the subroutine returns the password stored for that user.
• If the username does not exist, the subroutine returns an empty string.
Parts of the algorithm are missing and have been replaced with the labels to .
Figure 5
box
login False
REPEAT
username ''
WHILE username = ''
OUTPUT 'Enter username: '
username
ENDWHILE
password ''
WHILE password = ''
OUTPUT 'Enter password: '
password USERINPUT
ENDWHILE
storedPassword getPassword( )
IF storedPassword = THEN
OUTPUT ' '
ELSE
IF password = storedPassword THEN
login True
ELSE
OUTPUT 'Try again.'
ENDIF
ENDIF
UNTIL login = True
OUTPUT 'You are now logged in.'
Figure 6
-1 OUTPUT 0
username True SUBROUTINE
1 User not found ''
USERINPUT password Wrong password
State the items from Figure 6 that should be written in place of the labels in the algorithm in Figure 5.
box
You will not need to use all the items in Figure 6.
[4 marks]
Turn over for the next question
Turn over ►
A theme park charges £15 per person for a daily ticket. If there are six or more people in a group, the group is given a £5 discount.
Write a Python program to calculate the total charge for a group of people visiting the theme park.
The program must:
• get the user to enter the number of people in a group
• calculate the total charge by:
o charging £15 per person
o reducing the total charge by £5 if there are six or more people
• output the total charge.
You should use indentation as appropriate, meaningful variable name(s) and Python syntax in your answer.
box
The answer grid below contains vertical lines to help you indent your code.
[6 marks]
Figure 7 shows a merge sort being carried out on a list.
Figure 7
Explain how the merge sort algorithm works.
[4 marks]
box
Turn over ►
Figure 8 shows an algorithm, written using pseudo-code, that uses a RECORD data structure for storing information about a film.
Each record stores four pieces of information about a film:
• film title
• certificate (eg 12A, PG)
• year the film was made
• if the film is currently being shown at a cinema.
There are records for three films and these films are stored alphabetically in an array called filmCollection.
The pseudo-code outputs the title of the newest of the three films.
• Part of the algorithm has been replaced by the label .
Figure 8
box
RECORD Film
title : String
certificate : String
year : Integer
beingShown : Boolean
ENDRECORD
hulk Film('Hulk', '12A', 2005, False)
ironMan Film('Iron Man', '12A', 2008, False)
antMan Film('Ant-Man', '12A', 2015, False)
filmCollection [antMan, hulk, ironMan]
year 0
position 0
FOR i 0 TO
IF filmCollection[i].year year THEN
year filmCollection[i].year
position i
ENDIF
ENDFOR
OUTPUT filmCollection[position].title, ' is the newest film'
Content preview
AQA COMP PP1 2023
AQA
GCSE
COMPUTER SCIENCE
Paper 1 Computational thinking and programming skills – Python
Friday 19 May 2023 Afternoon Time allowed: 2 hours
Materials
There are no additional materials required for this paper. For Examiner’s Use
You must not use a calculator.
Questio Mark
Instructions n
Use black ink or black ball-point pen. Use pencil only for drawing. 1
Answer all questions. 2–3
You must answer the questions in the spaces provided.
4–5
If you need extra space for your answer(s), use the lined pages at
the end of this book. Write the question number against your 6–7
answer(s). 8–9
Do all rough work in this book. Cross through any work you do
10–11
not want to be marked.
Questions that require a coded solution must be answered in Python. 12
You should assume that all indexing in code starts at 0 unless stated otherwise.
13–14
15
Information 16
The total number of marks available for this paper is 90.
TOTAL
Advice
For the multiple-choice questions, completely fill in the lozenge alongside the appropriate answer.
CORRECT METHOD WRONG METHODS
If you want to change your answer you must cross out your original answer as shown.
If you wish to return to an answer previously crossed out, ring the answer you now wish to select as sho
*Jun23525101*
IB/G/Jun23/E11 8525/1B
, 2
Do not write
outside the
Answer all box
questions.
0 11 shows an algorithm, represented using pseudo-code, which assigns a
Figure
different value to four variables.
Figure 1
country 'United States of America'
state 'California'
city 'San Francisco'
landmark 'Alcatraz Island'
0 1 .1 Define the term algorithm.
[2 marks]
0 1 .2 The variable x is assigned a value using the statement:
x LEN(state)
Using Figure 1, what is the value
of x? Shade one lozenge.
[1 mark]
A 1
B 5
C 10
D 12
*02
IB/G/
* Jun23/8525/1B
, 3
Do not write
outside the
0 1 .3 What is the result of concatenating the contents of the variables box
city and
landmark in Figure
1? Shade one [1
mark]
lozenge.
A San Francisco Alcatraz Island
B San Francisco,Alcatraz Island
C San Francisco, Alcatraz Island
D San FranciscoAlcatraz Island
. The subroutine SUBSTRING extracts characters from a given
0 1 4
string.
For example, SUBSTRING(3, 5, 'Computing') would return
put
The variable y is assigned a value using the statement:
y SUBSTRING(4, 7, landmark)
Using Figure 1, what is the value
of y? Shade one lozenge. [1 mark]
A Alca
B Atra
C land
D traz
Question 1 continues on the next page
*03
IB/G/
* Jun23/8525/1B
, 4
Do not write
outside the
Turn over ►
*03
IB/G/
* Jun23/8525/1B