0% found this document useful (0 votes)
193 views76 pages

Paper 1 Computer Science QS

The document is the paper for the GCSE Computer Science exam. It contains instructions for students on how to complete the exam paper, which includes multiple choice and written answer questions testing computational thinking and programming skills in Python. The exam paper contains several coding tasks and questions about algorithms, data types, syntax errors and program efficiency.

Uploaded by

bassel adra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
193 views76 pages

Paper 1 Computer Science QS

The document is the paper for the GCSE Computer Science exam. It contains instructions for students on how to complete the exam paper, which includes multiple choice and written answer questions testing computational thinking and programming skills in Python. The exam paper contains several coding tasks and questions about algorithms, data types, syntax errors and program efficiency.

Uploaded by

bassel adra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

A

Surname

Other Names

Centre Number

Candidate Number

Candidate Signature
I declare this is my own work.

GCSE
COMPUTER SCIENCE
Paper 1 Computational thinking and programming
skills – Python
8525/1B

Time allowed: 2 hours

At the top of the page, write your surname and other


names, your centre number, your candidate number
and add your signature.

[Turn over]

*JUN2285251b01*
2

For this paper you must have:


• an insert.
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.

*02*
3

INFORMATION

The total number of marks available for this paper is 90.

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 shown.

DO NOT TURN OVER UNTIL TOLD TO DO SO

*03*
4

Answer ALL questions.

0 1
An algorithm, that uses the modulus operator, has been
represented using pseudo-code in FIGURE 1, provided
on page 2 of the insert.

• Line numbers are included but are not part of the


algorithm.

The modulus operator is used to calculate the


remainder after dividing one integer by another.

For example:
• 14 MOD 3 evaluates to 2
• 24 MOD 5 evaluates to 4

*04*
5

0 1 . 1
Shade ONE lozenge that shows the line number where
selection is FIRST used in the algorithm in FIGURE 1.
[1 mark]

A Line number 1

B Line number 2

C Line number 3

D Line number 4

[Turn over]

*05*
6

0 1 . 2
Shade ONE lozenge that shows the output from the
algorithm in FIGURE 1 when the user input is 4
[1 mark]

A 0

B 2

C 4

D 8

E 16

*06*
7

0 1 . 3
Shade ONE lozenge that shows the line number where
assignment is FIRST used in the algorithm in
FIGURE 1. [1 mark]

A Line number 1

B Line number 2

C Line number 3

D Line number 4

[Turn over]

*07*
8

0 1 . 4
Shade ONE lozenge that shows the line number that
contains a relational operator in the algorithm in
FIGURE 1. [1 mark]

A Line number 1

B Line number 2

C Line number 3

D Line number 4

*08*
9

0 1 . 5
Shade ONE lozenge to show which of the following is a
TRUE statement about the algorithm in FIGURE 1,
provided on page 2 of the insert. [1 mark]

A This algorithm uses a Boolean operator.

B This algorithm uses a named constant.

C This algorithm uses iteration.

D This algorithm uses the multiplication


operator.

[Turn over]

*09*
*10*

0 1 . 6

FIGURE 2, provided on page 2 of the insert, shows an implementation of the


algorithm in FIGURE 1 using the Python programming language.

• Line numbers are included but are not part of the program.

The program in FIGURE 2 needs to be changed so that it repeats five times using
DEFINITE (count controlled) iteration.

Shade ONE lozenge, on pages 10 to 12, next to the program that does this
correctly. [1 mark]

10
A for x in range(0, 5):
i = int(input("Enter a number: "))
if i % 2 == 0:
print(i * i)
else:
print(i)
*11*

B for x in range(0, 6):


i = int(input("Enter a number: "))
if i % 2 == 0:
print(i * i)
else:
print(i)

C x = 1
while x != 6:

11
i = int(input("Enter a number: "))
if i % 2 == 0:
print(i * i)
else:
print(i)
x = x + 1

[Turn over]
*12*

D x = 6
while x != 0:
i = int(input("Enter a number: "))
if i % 2 == 0:
print(i * i)
else:
print(i)
x = x – 1

12
6
BLANK PAGE
*13*

[Turn over]

13
14

0 2
FIGURE 3, provided on pages 4 and 5 of the insert,
shows an algorithm, represented using pseudo-code,
that calculates the delivery cost for an order from a
takeaway company.

0 2 . 1
Using FIGURE 3, complete the table. [2 marks]

Input value of Input value of


Output
orderTotal deliveryDistance

55.5 2

35.0 5

0 2 . 2
State how many possible values the result of the
comparison deliveryDistance ≤ 5 could have in
the algorithm shown in FIGURE 3. [1 mark]

*14*
15

0 2 . 3
State the most suitable data type for the following
variables used in FIGURE 3. [2 marks]

Variable identifier Data type

deliveryCost

messageOne

0 2 . 4
State ONE other common data type that you have NOT
given in your answer to Question 02.3. [1 mark]

[Turn over]

*15*
16

0 3
FIGURE 4, provided on page 6 of the insert, shows a
Python program that calculates car park charges.

The user inputs their car registration (eg MA19 GHJ)


and the length of the stay.

The program then outputs the charge.

• Line numbers are included but are not part of the


program.

0 3 . 1
Rewrite LINE 4 in FIGURE 4 to CONCATENATE the car
registration with the string " is not valid", and
store the result in the variable displayMessage.

Your answer must be written in Python. [1 mark]

*16*
17

0 3 . 2
The charge for parking for two or more hours is
changed to include an additional £2 fee.

Rewrite LINE 10 in FIGURE 4 to show this change.

Your answer must be written in Python. [1 mark]

[Turn over]
8

*17*
18

0 4
The two Python programs in FIGURE 5, provided on
pages 8 and 9 of the insert, output the value that is
equivalent to adding together the integers between 1
and an integer entered by the user.

For example, if the user entered the integer 5, both


programs would output 15

0 4 . 1
Shade ONE lozenge to indicate which of the statements
is true about the programs in FIGURE 5. [1 mark]

A Both programs are equally efficient.

B Program A is more efficient than Program B.

C Program B is more efficient than Program A.

*18*
19

0 4 . 2
Justify your answer for Question 04.1. [2 marks]

[Turn over]

*19*
20

0 5
A programmer has started to write a program using
Python. Their program is shown in FIGURE 6, provided
on page 10 of the insert.

The program should generate and output 10 numbers,


each of which is randomly selected from the numbers in
a data structure called numbers.

The program uses the random module.

For example, random.randrange(0, 8) would


generate a random integer between 0 and 7 inclusive.

One possible output from the finished program would


be 11, 14, 14, 42, 2, 56, 56, 14, 4, 2

• Line numbers are included but are not part of the


program.

*20*
21

0 5 . 1
The program shown in FIGURE 6 contains a syntax
error.

Shade TWO lozenges to indicate the statements that


are true about syntax errors. [2 marks]

A A syntax error can be found by testing


boundary values in a program.

B A syntax error is a mistake in the grammar


of the code.

C A syntax error is generally harder to spot


than a logic error.

D A syntax error will stop a program from


running.

E An example of a syntax error is trying to


access the fifth character in a string which
only contains four characters.

[Turn over]

*21*
22

0 5 . 2
The program shown in FIGURE 6 also contains a logic
error.

Identify the line number that contains the logic error,


and correct this line of the program.

Your corrected line must be written in Python.


[2 marks]

Line number

Corrected line

0 5 . 3

What type of data structure is the variable numbers?


[1 mark]

*22*
23

0 6
A program is being developed that allows users to rate
and review movies. A user will enter their rating (out of
10) and a written review for each movie they have
watched.

Computational thinking skills are used during the


development of the program.

0 6 . 1
Define the term ABSTRACTION. [1 mark]

[Turn over]

*23*
24

0 6 . 2
A user will be able to register, log in and log out of the
program. When registering, a new user will enter their
details, before confirming their email address.

DECOMPOSITION has been used to break the problem


down into smaller sub-problems.

FIGURE 7, provided on page 12 of the insert, represents


the design of the program.

Complete the decomposition of this program by stating


what should be written in boxes and . [2 marks]

*24*
25

BLANK PAGE

[Turn over]

*25*
26

0 7
Write a Python program to check if an email address
has been entered correctly by a user.

Your program must:


• get the user to input an email address
• get the user to input the email address a second
time
• output the message Match AND output the email
address if the email addresses entered are the
same
• output the message Do not match if the email
addresses entered are not the same.

You SHOULD use indentation as appropriate,


meaningful variable name(s) and Python syntax in your
answer.

The answer grid, on pages 27 to 31, contains vertical


lines to help you indent your code. [5 marks]

*26*
27

[Turn over]

*27*
28

*28*
29

[Turn over]

*29*
30

*30*
31

[Turn over] 8

*31*
32

0 8
Write a Python program that calculates the value of a
bonus payment for an employee based on how many
items they have sold and the number of years they have
been employed.

The program should:


• get the user to input the number of items sold
• get the user to input the number of years employed
• output the value of the bonus payment:
 if the years of employment is less than or equal to 2
AND the number of items sold is greater than 100,
then the bonus will be the number of items sold
multiplied by 2
 if the years of employment is greater than 2, then the
bonus will be the number of items sold multiplied
by 10
 otherwise, the bonus is 0

You SHOULD use indentation as appropriate,


meaningful variable name(s) and Python syntax in your
answer.

The answer grid, on pages 33 to 37, contains vertical


lines to help you indent your code. [7 marks]

*32*
33

[Turn over]

*33*
34

*34*
35

[Turn over]

*35*
36

*36*
37

[Turn over]

*37*
38

0 9
FIGURE 8, provided on page 13 of the insert, shows an
algorithm represented using pseudo-code.

• Line numbers are included but are not part of the


algorithm.

SUBSTRING returns part of a string.

For example, SUBSTRING(3, 5, 'programming')


will return the string 'gra'.

*38*
39

0 9 . 1
Shade ONE lozenge which shows the output of LINE 4
from the algorithm shown in FIGURE 8. [1 mark]

A F

B Freddie

C Lily

D S

E Sarah

[Turn over]

*39*
40

0 9 . 2
Shade ONE lozenge which shows the output of LINE 5
from the algorithm shown in FIGURE 8. [1 mark]

A 1

B 2

C 4

D 5

E 10

0 9 . 3
State the output of LINE 7 from the algorithm shown in
FIGURE 8. [1 mark]

*40*
41

0 9 . 4
Two extra lines are being added to the end of the
algorithm in FIGURE 8.

Fill in the gaps so the output from the new final line will
be the string 'Thomasrah'. [2 marks]

var  SUBSTRING( , , name1)

OUTPUT names[ ] + var

[Turn over]
12

*41*
42

1 0

FIGURE 9, provided on page 14 of the insert, shows a


subroutine represented using pseudo-code.

The DIV operator is used for integer division.

1 0 . 1

On the opposite page, complete the trace table for the


subroutine call calculate(50)

You may not need to use all the rows in the table.
[4 marks]

*42*
43

n a b OUTPUT

50

[Turn over]

*43*
44

1 0 . 2
State the value that will be output for the subroutine
call calculate(1) [1 mark]

1 0 . 3

The identifier for the variable b in FIGURE 9 was not


a good choice.

State a better identifier for this variable that makes


the algorithm easier to read and understand.
[1 mark]

*44*
45

BLANK PAGE

[Turn over]

*45*
46

1 0 . 4
A REPEAT…UNTIL iteration structure was used in
FIGURE 9.

FIGURE 10, provided on page 15 of the insert, shows


another subroutine called calculate that uses a
WHILE…ENDWHILE iteration structure.

One difference in the way the subroutines in FIGURE 9


and FIGURE 10 work is:
• the REPEAT…UNTIL iteration structure in FIGURE 9
loops until the condition is true
• the WHILE…ENDWHILE iteration structure in
FIGURE 10 loops until the condition is false.

Describe TWO other differences in the way the


subroutines in FIGURE 9 and FIGURE 10 work.
[2 marks]

*46*
47

[Turn over] 8

*47*
*48*

1 1 . 1

The size of a sound file is calculated using the following formula:

size (in bits) = sampling rate * sample resolution * seconds

To calculate the size IN BYTES, the number is divided by 8

The algorithm in FIGURE 12, represented using pseudo-code, should output the
size of a sound file in BYTES that has been sampled 100 times per second, with a
sample resolution of 16 bits and a recording length of 60 seconds.

48
A subroutine called getSize has been developed as part of the algorithm.

On the opposite page, complete FIGURE 12 by filling in the gaps using the items in
FIGURE 11, provided on page 16 of the insert.

You will not need to use all the items in FIGURE 11. [6 marks]
FIGURE 12
*49*

SUBROUTINE getSize( , , seconds)

 sampRate * res * seconds

size 

size

49
ENDSUBROUTINE

OUTPUT (100, 16, 60)

[Turn over]
50

1 1 . 2
A local variable called size has been used in
getSize.

Explain what is meant by a local variable in a


subroutine. [1 mark]

*50*
51

1 1 . 3
State THREE advantages of using subroutines.
[3 marks]

[Turn over] 10

*51*
52

1 2
FIGURE 13, provided on page 17 of the insert, shows an
algorithm represented in pseudo-code. A developer
wants to check the algorithm works correctly.

• Line numbers are included but are not part of the


algorithm.

1 2 . 1
On the opposite page, complete the trace table for the
algorithm shown in FIGURE 13.

Some values have already been entered. You may not


need to use all the rows in the table. [6 marks]

*52*
53

arr
i j temp
[0] [1] [2]
c b a

[Turn over]

*53*
54

1 2 . 2
State the purpose of the algorithm. [1 mark]

*54*
55

1 2 . 3

An earlier attempt at writing the algorithm in FIGURE 13


had different code for LINES 4 and 5.

LINES 4 and 5 of the pseudo-code were:

FOR i  0 TO 2
FOR j  0 TO 2

Explain why the algorithm did not work when the value
2 was used instead of the value 1 on these two lines.
[1 mark]

[Turn over]
8

*55*
56

1 3
A program is being developed in Python to simulate a
card game.

Throughout the game each player always has


100 cards. Each card displays a number.

Players take it in turns to swap one of their cards with


another random card from a set of cards until a player
has a run of five numbers in sequence within their
100 cards.

1 3 . 1
FIGURE 14 shows part of the program that will get a
player to enter the position of a card to swap.
FIGURE 14

position = int(input("Enter card position: "))

Extend the program in FIGURE 14. Your answer


must be written in Python.
The program should keep getting the user to enter
the card position until they enter a card position
that is between 1 and 100 inclusive.
You SHOULD use indentation as appropriate,
meaningful variable name(s) and Python syntax in
your answer.

*56*
57

The answer grid contains vertical lines to help you


indent your code. [4 marks]

[Turn over]

*57*
58

1 3 . 2
There are 500 cards within the game in total. Each
card is numbered from 1 to 250 and each number
appears twice in the whole set of cards.

The player’s 100 cards are always stored in numerical


order.

When a player has a valid run of five cards within


their 100 cards they have won the game.

A valid run:
• consists of five cards
• can start from any position in the player’s
100 cards
• the second card’s value is one more than the first
card’s value, the third card’s value is one more
than the second card’s value, the fourth card’s
value is one more than the third card’s value, and
the fifth card’s value is one more than the fourth
card’s value.

Below are examples of valid runs which means a


player has won.

VALID RUN EXAMPLE 1

*58*
59

VALID RUN EXAMPLE 2

Below are examples of invalid runs.

INVALID RUN EXAMPLE 1

INVALID RUN EXAMPLE 2

INVALID RUN EXAMPLE 3

[Turn over]

*59*
60

Write a Python program to check if a player has a valid


run of five cards within their 100 cards.

When writing your program you should assume:


• there is an array called cards that contains the
values of the player’s 100 cards
• cards[0] will contain the value of the first card and
cards[99] will contain the value of the last card
• the values in cards are already stored in numerical
order
• there is a Boolean variable called gameWon that has
a value of False.

Your program should set gameWon to True if there is


a valid run.

You SHOULD use indentation as appropriate, meaningful


variable name(s) and Python syntax in your answer.

The answer grid, on pages 61 to 64, contains vertical


lines to help you indent your code. [6 marks]

*60*
61

[Turn over]

*61*
62

*62*
63

[Turn over]

*63*
64

10
*64*
65

BLANK PAGE

[Turn over]

*65*
1 4
*66*

A program is being written to simulate a computer science revision game in the


style of bingo.

At the beginning of the game a bingo ticket is generated with nine different key
terms from computer science in a 3 x 3 grid. An example bingo ticket is provided
in FIGURE 15, provided on page 18 of the insert.

The player will then be prompted to answer a series of questions.

If an answer matches a key term on the player’s bingo ticket, then the key term will

66
be marked off automatically.
BLANK PAGE
*67*

[Turn over]

67
1 4 . 1
*68*

FIGURE 16 shows an incomplete Python program to create a bingo ticket for a


player.

The programmer has used a two-dimensional array called ticket to represent a


bingo ticket.

The program uses a subroutine called generateKeyTerm. When called, the


subroutine will return a random key term, eg "CPU", "ALU", "NOT gate" etc.

Complete the Python program in FIGURE 16, on the opposite page, by filling in the

68
five gaps.

• Line numbers are included but are not part of the program.

[4 marks]
FIGURE 16
*69*

1 ticket = [["","",""],
["","",""],
["","",""]]

2 i = 0
3 while i < 3:

69
4 j =
5 while j < 3:

6 ticket[ ][ ] = generateKeyTerm()

8
[Turn over]
70

1 4 . 2
Each time a player answers a question correctly the
ticket array is updated; if their answer is in the
ticket array then it is replaced with an
asterisk (*).
An example of the ticket array containing key
terms and asterisks is shown in FIGURE 17,
provided on page 19 of the insert.
Write a subroutine in Python called checkWinner
that will count the number of asterisks.
The subroutine should:
• take the ticket array as a parameter
• count the number of asterisks in the ticket
array
• output the word Bingo if there are nine asterisks
in the array
• output the total number of asterisks if there are
fewer than nine asterisks in the array.
You MUST write your own count routine and not use
any built-in count function that might be available in
Python.
You SHOULD use indentation as appropriate,
meaningful variable name(s) and Python syntax in
your answer.
The answer grid, on pages 71 to 73, contains vertical
lines to help you indent your code. [8 marks]

*70*
71

[Turn over]

*71*
72

*72*
73

END OF QUESTIONS 12

*73*
74

Additional page, if required.


Write the question numbers in the left-hand margin.

*74*
75

Additional page, if required.


Write the question numbers in the left-hand margin.

*75*
76

BLANK PAGE

For Examiner’s Use

Question Mark
1
2–3
4–5
6–7
8–9
10
11
12
13
14

TOTAL

Copyright information

For confidentiality purposes, all acknowledgements of third-party copyright material are published
in a separate booklet. This booklet is published after each live examination series and is
available for free download from www.aqa.org.uk.

Permission to reproduce all copyright material has been applied for. In some cases, efforts to
contact copyright-holders may have been unsuccessful and AQA will be happy to rectify any
omissions of acknowledgements. If you have any queries please contact the Copyright Team.

Copyright © 2022 AQA and its licensors. All rights reserved.

IB/M/TT/Jun22/8525/1B/E4

*76* *226G8525/1B*

You might also like