All papers

Computer Science · AQA 7517 · Paper 1: On-screen exam · June 2025

AQA A Level Computer Science Paper 1: On-screen exam June 2025 question paper 7517/1

2h 30m

Materials

AQA 7517 · Paper 1

12 questions
Report a problem
What is wrong?

Goes to whoever maintains the question split. No account needed and nothing is published on this page.

Question 1

Two data structures that can be used to store a collection of data records are a hash table and a sorted list.

Explain why a record in a hash table can normally be found more quickly than a record in a sorted list.

[1 mark]

Answer
Mark scheme for question 1.1

Describe the steps involved in adding a new record to a hash table.

[4 marks]

Answer
Mark scheme for question 1.2

Explain why the time taken to find a specific record in a hash table can increase when lots of records are stored in the table.

[1 mark]

Answer
Mark scheme for question 1.3

Linear search and binary search are two algorithms that could be used to find a record in a sorted list.

Explain why the linear search algorithm has time complexity of O(n).

[1 mark]

Answer
Mark scheme for question 1.4

Explain why the binary search algorithm has time complexity of O(log n).

[1 mark]

Answer
Mark scheme for question 1.5

State one advantage of a linear search compared to a binary search.

[1 mark]

Answer
Mark scheme for question 1.6

If the list of records was unsorted, a bubble sort algorithm or a merge sort algorithm could be used to sort the records.

Explain why both these sorting algorithms are tractable.

[1 mark]

Answer
Mark scheme for question 1.7

After how many passes is bubble sort guaranteed to have sorted any list of 100 items?

[1 mark]

Answer
Mark scheme for question 1.8

Question 2

Define the term decomposition.

[2 marks]

Answer
Mark scheme for question 2

Question 3

Dijkstra’s algorithm is an example of a breadth-first traversal algorithm.

State the purpose of Dijkstra’s algorithm.

[1 mark]

Answer
Mark scheme for question 3.1

Figure 1 shows a graph containing seven nodes.

Figure for question 3

State both the reasons why the graph in Figure 1 is not a tree.

[2 marks]

Answer
Mark scheme for question 3.2

Complete the unshaded cells in Table 1 to show how the graph in Figure 1 could be represented as an adjacency matrix.

Figure for question 3

Copy the contents of the unshaded cells in Table 1 into the table in your Electronic Answer Document.

[2 marks]

Answer
Mark scheme for question 3.3
Figure for question 3 Figure for question 3

[1 mark]

Answer
Mark scheme for question 3.4
Figure for question 3 Figure for question 3 Figure for question 3

[6 marks]

Answer
Mark scheme for question 3.5

Question 4

You are advised to spend no more than 20 minutes on this section.

Enter your answers to Section B in your Electronic Answer Document.

You must save this document at regular intervals.

The question in this section asks you to write program code starting from a new program/project/file.

You are advised to save your program at regular intervals.

Write a program that uses a transposition cipher to encrypt a string entered by the user.

After the user enters the string to encrypt, they enter the number of columns to use. Different numbers of columns result in different encrypted versions of the same string.

Any non-alphabetic characters in the string entered by the user are ignored and will not appear in the encrypted text.

To encrypt the string, the characters from the user’s input are written into a grid (left to right, top to bottom) of cells which has the number of columns specified by the user. The characters are then read from the grid in a different order (top to bottom, left to right).

Example 1

If the user enters the string hypothetically and 3 for the number of columns, then the encrypted version of that string will be hoeclyttayphil

Figure for question 4

Example 2

If the user enters the string hypothetically and 5 for the number of columns, then the encrypted version of that string will be hhayelptloiytc

Figure for question 4

Example 3

If the user enters the string How many, how rarely? and 4 for the number of columns, then the encrypted version of that string will be Haoronwewyrlmhay

Figure for question 4

The spaces and punctuation characters have been removed in the encrypted string.

Figure for question 4
Figure for question 4

[12 marks]

Answer
Mark scheme for question 4.1
Figure for question 4

[1 mark]

Answer
Mark scheme for question 4.2

Question 5

You are advised to spend no more than 20 minutes on this section.

Enter your answers to Section C in your Electronic Answer Document.

You must save this document at regular intervals.

These questions refer to the Preliminary Material and the Skeleton Program, but do not require any additional programming.

Refer either to the Preliminary Material issued with this question paper or your electronic copy.

This question is about the ConvertToRPN subroutine.

Describe two advantages of using Reverse Polish Notation (RPN) instead of infix notation to represent expressions.

[2 marks]

Answer
Mark scheme for question 5.1

A dictionary is used to store the precedence of the allowed operators.

Explain the concept of a dictionary.

[2 marks]

Answer
Mark scheme for question 5.2

State the type of data structure that has been represented using the Operators list.

[1 mark]

Answer
Mark scheme for question 5.3

Question 6

This question is about the CheckIfUserInputValid subroutine.

Figure 5 shows a finite state machine (FSM) represented as a state transition diagram. The FSM is equivalent to the regular expression in the CheckIfUserInputValid subroutine.

Figure for question 6

Complete the unshaded cells in Table 3 to represent the FSM in Figure 5 as a state transition table.

Part of the first row has been completed for you.

Figure for question 6

Copy the contents of the unshaded cells in Table 3 into the table in your Electronic Answer Document.

[2 marks]

Answer
Mark scheme for question 6.1

Figure 6 and Figure 7 show two attempts to represent the regular expression in the CheckIfUserInputValid subroutine using a state transition diagram. There are errors in both diagrams, as the FSM will either accept some strings that do not match the regular expression or not accept some strings that do match the regular expression.

Figure for question 6 Figure for question 6

Explain which strings accepted by the FSM in Figure 5 are not accepted by the FSM in Figure 6.

[2 marks]

Answer
Mark scheme for question 6.2

Explain which strings accepted by the FSM in Figure 7 are not accepted by the FSM in Figure 5.

[2 marks]

Answer
Mark scheme for question 6.3

Explain the purpose of the metacharacter $ in the regular expression in the CheckValidNumber subroutine.

[1 mark]

Answer
Mark scheme for question 6.4

Explain the difference between the metacharacters * and ? in regular expressions.

[1 mark]

Answer
Mark scheme for question 6.5

A regular expression can be used to describe a set.

State two properties of sets that do not have to be true for a list.

[2 marks]

Answer
Mark scheme for question 6.6

Infix expressions can normally use brackets.

The infix expressions entered by the user in the Skeleton Program cannot use brackets.

Explain why a regular expression could not be used to check if an infix expression entered by the user was valid if the infix expression was allowed to contain brackets.

[1 mark]

Answer
Mark scheme for question 6.7
Figure for question 6

[3 marks]

Answer
Mark scheme for question 6.8

Question 7

This question is about the EvaluateRPN subroutine.

Describe an infix expression that:

maths symbol would cause the subroutine CheckIfUserInputValid to return True and

maths symbol could be successfully converted to RPN by the ConvertToRPN subroutine

but that would not be evaluated correctly by the EvaluateRPN subroutine.

[1 mark]

Answer
Mark scheme for question 7.1

Explain the purpose of the final selection structure in the EvaluateRPN subroutine.

Your explanation should include a description of what the possible values returned by the subroutine represent.

[2 marks]

Answer
Mark scheme for question 7.2

Question 8

Figure for question 8

[1 mark]

Answer
Mark scheme for question 8

Question 9

Figure for question 9 Figure for question 9
Figure for question 9

[4 marks]

Answer
Mark scheme for question 9.1
Figure for question 9

[1 mark]

Answer
Mark scheme for question 9.2

Question 10

This question extends the Skeleton Program by allowing the player to use exponentiation in the expressions they enter.

The player will be allowed to use the ^ symbol to denote exponentiation in an expression they enter. Exponentiation has higher precedence than the other operators.

The four operators currently allowed in expressions are left-associative.

Question 10, shown as an image
Figure for question 10

The exponentiation operator will be right-associative.

Question 10, shown as an image
Figure for question 10

What you need to do

Task 1 Modify the CheckIfUserInputValid, ConvertToRPN and EvaluateRPN subroutines so the exponentiation operator is allowed and works correctly.

Note: you will be able to achieve most of the marks for this question if you implement the exponentiation operator as left-associative.

Task 2 Test that the changes you have made work:

maths symbol run the Skeleton Program

maths symbol select the training game

maths symbol enter 512/2^3^2+8

maths symbol enter 3^2

Figure for question 10
Figure for question 10

[7 marks]

Answer
Mark scheme for question 10.1
Figure for question 10

[1 mark]

Answer
Mark scheme for question 10.2

Question 11

This question extends the Skeleton Program by telling the player all the values that appear more than once in the list of targets.

Before displaying the current score, the program should display an additional list containing all the values that appear more than once in the list of targets. In this additional list, each value should only be displayed once.

What you need to do

Task 1 Create a new subroutine called DisplayTargetMultiples that will display all the values that appear more than once in the targets shown to the player.

Task 2 Modify the DisplayState subroutine so that it calls the subroutine DisplayTargetMultiples immediately before the current score is displayed.

Task 3 Test that the changes you have made work:

maths symbol run the Skeleton Program

maths symbol select the training game.

Figure for question 11
Figure for question 11

[11 marks]

Answer
Mark scheme for question 11.1
Figure for question 11

[1 mark]

Answer
Mark scheme for question 11.2

Question 12

This question extends the Skeleton Program so that the program will tell the player if they can make one of the targets using an expression that contains exactly three of the values from the numbers available.

Your program does not need to work with the exponentiation operator from Question 10.

What you need to do

Task 1 Create a new subroutine called CanGetATargetUsingThreeNumbers that will return True if it is possible to create an expression using exactly three of the values in NumbersAllowed that matches any of the targets shown to the player. Otherwise, it should return False.

Task 2 Modify the DisplayState subroutine so that it calls the subroutine CanGetATargetUsingThreeNumbers and then displays an appropriate message saying if it is possible or not to make one of the targets using exactly three of the values from the available numbers.

Task 3 Test that the changes you have made work:

maths symbol run the Skeleton Program

maths symbol select the training game

maths symbol enter 3+8–2

Figure for question 12
Figure for question 12

[11 marks]

Answer
Mark scheme for question 12.1
Figure for question 12

[1 mark]

Answer
Mark scheme for question 12.2
Figure for question 12

[2 marks]

Answer
Mark scheme for question 12.3

The paper as printed

Spotted a mistake on this page?Report a problem