All papers

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

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

2h 30m

AQA 7517 · Paper 1

16 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

Describe the process that should be followed to add an item to a circular queue implemented as a static data structure using an array.

Your method should deal appropriately with any issues which could arise.

[5 marks]

Answer
Mark scheme for question 1

Question 2

Figure 1 shows a logic puzzle.

Figure 1

The following five coloured shapes are placed on a table.

Image of coloured shapes not reproduced here due to third party copyright restrictions.

Tabitha secretly chooses one of the coloured shapes and:

• tells Walter the colour of the shape she has chosen (pink, yellow or blue)

• tells Lionel the type of shape she has chosen (triangle, circle or square).

Lionel and Walter both know what coloured shapes are on the table.

Lionel knows that Walter has been told the colour chosen by Tabitha. Walter knows that Lionel has been told the type of shape chosen by Tabitha. They do not know what the other has been told.

Tabitha first asks Walter and Lionel if they know which coloured shape she has chosen. They both answer at the same time and say “No”.

Tabitha then asks them again if they know which coloured shape she has chosen. They both answer at the same time and say “No” again.

Tabitha asks them a third time if they know which coloured shape she has chosen and they both answer at the same time and say “Yes”.

After they have both replied to Tabitha’s first question, what does Lionel now know about Tabitha’s choice because Walter said “No”?

[1 mark]

Answer
Mark scheme for question 2.1

After they have both replied to Tabitha’s first question, what does Walter now know about Tabitha’s choice because Lionel said “No”?

[1 mark]

Answer
Mark scheme for question 2.2

Which coloured shape had Tabitha chosen?

[1 mark]

Answer
Mark scheme for question 2.3

Question 3

A binary tree is a type of data structure.

State two characteristics that make a tree a binary tree.

[2 marks]

Answer
Mark scheme for question 3.1
Figure for question 3 Figure for question 3 Figure for question 3

[4 marks]

Answer
Mark scheme for question 3.2

There are similarities in how the binary tree search and the binary search algorithms work.

State the big-O time complexity of the binary search algorithm.

[1 mark]

Answer
Mark scheme for question 3.3

Explain why the binary search algorithm has the time complexity stated in your answer for 03.3.

[1 mark]

Answer
Mark scheme for question 3.4

Explain why searching for an item in a list or tree is a tractable problem.

[1 mark]

Answer
Mark scheme for question 3.5

Heuristics can be used when working with an intractable problem.

Explain what heuristics are.

[2 marks]

Answer
Mark scheme for question 3.6

Explain what is meant by constant time complexity.

[2 marks]

Answer
Mark scheme for question 3.7

Question 4

Figure for question 4 Figure for question 4

Complete Table 2 to show which of the languages in Figure 4 are regular languages.

Figure for question 4

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

[3 marks]

Answer
Mark scheme for question 4.1

Show that the language defined by the union of the sets {bn | n > 0} and {a, ab} is a regular language by writing a regular expression for the language.

[2 marks]

Answer
Mark scheme for question 4.2

Explain what is meant by the cardinality of a set.

[1 mark]

Answer
Mark scheme for question 4.3

Question 5

Figure for question 5

Complete the unshaded cells of Table 3 to show the result of tracing the computation of this Turing machine for the first 20 steps only.

Show the contents of the tape, the current position of the read/write head and the current state as the input is processed. The top row of the table shows the initial state, the initial position of the read/write head and the starting contents of the tape.

Table 3

Figure for question 5

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

[5 marks]

Answer
Mark scheme for question 5.1

Describe two circumstances when the transition function for this Turing machine will not correctly count the number of zeros between two # symbols on the tape.

You should assume that:

maths symbol the read/write head starts immediately to the right of a cell containing a #

maths symbol there is a cell containing a # symbol somewhere on the tape to the right of the read/write head’s initial position

maths symbol there are exactly two # symbols on the tape.

[2 marks]

Answer
Mark scheme for question 5.2

Explain what a Universal Turing machine is.

[2 marks]

Answer
Mark scheme for question 5.3

State one reason why there are some problems that no real computer can solve that the Universal Turing Machine could solve.

[1 mark]

Answer
Mark scheme for question 5.4

Question 6

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 gets the user to enter a string. It should keep getting the user to enter a string until they enter a valid string. Each time they enter a string an appropriate message should be displayed telling them whether the string they entered is valid or not.

For a string to be valid:

maths symbol it must be between five and seven characters in length (inclusive)

maths symbol it must consist only of uppercase letters

maths symbol it must contain only unique characters (ie no character appears in the string more than once)

maths symbol the sum of the ASCII codes of the characters in the string must be between 420 and 600 (inclusive).

Figure for question 6
Figure for question 6

[12 marks]

Answer
Mark scheme for question 6.1
Figure for question 6

[1 mark]

Answer
Mark scheme for question 6.2

Question 7

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 PlayGame method in the Dastan class.

Complete the unshaded cells of Table 4 to show which statements are true and which statements are false about the PlayGame method.

Figure for question 7

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

[2 marks]

Answer
Mark scheme for question 7.1

If the PlayGame method was altered to allow the user to select any move option from their queue, what is the maximum amount their score could decrease by after making a move?

[1 mark]

Answer
Mark scheme for question 7.2

Question 8

The Skeleton Program uses overriding. When a derived class overrides a method from the base class, the base class method could be either a virtual method or an abstract method.

Describe two differences between a virtual method and an abstract method.

[2 marks]

Answer
Mark scheme for question 8

Question 9

This question is about the MoveOptionQueue class.

Explain how this class uses information hiding.

[1 mark]

Answer
Mark scheme for question 9.1

The data structure Queue has not been implemented as a first-in first-out (FIFO) queue.

Explain why the MoveItemToBack method in the MoveOptionQueue class does not use the Queue data structure as a FIFO queue.

[1 mark]

Answer
Mark scheme for question 9.2

State the identifier of a method in the MoveOptionQueue class that does use the Queue data structure as a FIFO queue.

[1 mark]

Answer
Mark scheme for question 9.3

Question 10

This question is about the CheckIfGameOver method in the Dastan class.

Explain why the first selection structure is needed.

[1 mark]

Answer
Mark scheme for question 10.1

Figure 6 shows a pseudo-code representation of part of the CheckIfGameOver method.

Figure 6

NOT (Player1HasMirza AND Player2HasMirza) Rewrite the code in Figure 6 so that it has the same functionality but uses OR and NOT Boolean operations only, instead of the AND and NOT Boolean operations.

[1 mark]

Answer
Mark scheme for question 10.2

Question 11

1 1

State the name of an identifier for a user-defined method that uses string concatenation.

[1 mark]

Answer
Mark scheme for question 11.1

State the name of an identifier for a class that has a constructor that takes three integer parameters.

[1 mark]

Answer
Mark scheme for question 11.2

Question 12

Explain why a value of-1 is used in the CreateMoveOptions method in the Dastan class.

[1 mark]

Answer
Mark scheme for question 12

Question 13

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

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

You must save this document at regular intervals.

These questions require you to load the Skeleton Program and to make programming changes to it.

This question refers to the method UseMoveOptionOffer in the Dastan class.

The program is to be changed so that it checks the choice made by the player about which move option to replace is valid. A choice is valid if it is between 1 and 5 inclusive.

The program should keep getting the player to enter a value until a valid choice has been made. Each time an invalid value is entered an appropriate error message should be displayed.

What you need to do

Task 1 Modify the method UseMoveOptionOffer so it checks that the value entered by the player is valid. An appropriate error message should be displayed if an invalid value is entered and the user should be made to enter another value.

You may assume that the user will only enter a single numeric digit.

Task 2 Test that the changes you have made work:

maths symbol run the Skeleton Program

maths symbol enter 9

maths symbol enter 6

maths symbol enter 4

Figure for question 13
Figure for question 13

[4 marks]

Answer
Mark scheme for question 13.1
Figure for question 13

[1 mark]

Answer
Mark scheme for question 13.2

Question 14

This question extends the Skeleton Program by allowing a player to choose a bhukampa (earthquake).

After choosing a bhukampa the player can then choose a move option, choose to use the move option offer or choose a bhukampa again.

When a bhukampa is chosen the following steps are repeated five times:

maths symbol two different squares are randomly selected

maths symbol the positions on the board of those two squares are swapped.

The player’s score is then reduced by 15 and the new state of the game is displayed.

What you need to do

Task 1 Create a new method in the Dastan class called ProcessBhukampa that swaps the squares in the way described.

Task 2 Modify the PlayGame method in the Dastan class so that if the player enters 8 when asked for their move option, the new method ProcessBhukampa is called, the current player’s score is reduced by 15 and the new game state is displayed.

Task 3 Test that the changes you have made work:

maths symbol run the Skeleton Program

maths symbol enter 8

The results of your test should show at least one piece or kotla now being in a different location. If your test does not show this (because all the squares randomly selected by your program were empty), then keep doing this test until that is not the

Figure for question 14
Figure for question 14

[9 marks]

Answer
Mark scheme for question 14.1
Figure for question 14

[1 mark]

Answer
Mark scheme for question 14.2

Question 15

This question extends the Skeleton Program so that there is a new type of square – a gacaka (trap).

When a player makes a move that means a piece moves into a gacaka, the value of PointsIfCaptured of the piece is increased by 2 and a message saying " Trap! " is displayed. A player who has a piece in a gacaka has their score decreased by 3 each turn until the piece is moved out of the gacaka.

The location of the gacaka is not shown on the board.

What you need to do

Task 1 Create a new class called Gacaka that is a subclass of the Square class. Create two methods SetPiece and GetPointsForOccupancy in the Gacaka class that allow a gacaka to work in the way described.

The method SetPiece in the Gacaka class should override the method from the Square class. The method GetPointsForOccupancy in the Gacaka class should override the method from the Square class.

Task 2 Modify the CreateBoard method in the Dastan class so that row four, column four is a gacaka instead of a square.

Task 3 Test that the changes you have made work:

maths symbol run the Skeleton Program

maths symbol enter 3

maths symbol enter 24

maths symbol enter 44

maths symbol enter 1

maths symbol enter 54

maths symbol enter 44

Figure for question 15
Figure for question 15

[8 marks]

Answer
Mark scheme for question 15.1
Figure for question 15

[1 mark]

Answer
Mark scheme for question 15.2

Question 16

This question extends the program by telling the player how many legal moves they have in the current state of the game.

A legal move is when, using one of the first three move options in their move option queue, a player’s piece will move to a square that contains an opponent’s piece or to a square that does not contain a piece. There are 45 legal moves at the start of the game for the first player.

When answering this question, you should ignore the option to use the move option offer and the option to use a bhukampa (from Question 14) as these do not count as moves.

What you need to do

Task 1 Create a new method called GetNoOfPossibleMoves in the Player class that takes Board as a parameter and returns the total number of possible legal moves for that player based on the contents of the squares in the Board list.

Task 2 Modify the DisplayState method in the Dastan class so that it displays the value returned by a call to GetNoOfPossibleMoves for the current player.

Task 3 Test that the changes you have made work:

maths symbol run the Skeleton Program

maths symbol enter 1

maths symbol enter 22

maths symbol enter 12

Figure for question 16
Figure for question 16

[12 marks]

Answer
Mark scheme for question 16.1
Figure for question 16

[1 mark]

Answer
Mark scheme for question 16.2

The paper as printed

Spotted a mistake on this page?Report a problem