All papers

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

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

2h 30m

Materials

AQA 7517 · Paper 1

14 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

State three advantages of using subroutines.

For each advantage, you must explain how the advantage is achieved.

[3 marks]

Answer
Mark scheme for question 1

Question 2

Circular queues and linear queues are examples of data structures that can be implemented using a fixed-length array.

Explain why, when implemented using a fixed-length array, a circular queue is usually considered to be a better choice of data structure than a linear queue.

[2 marks]

Answer
Mark scheme for question 2.1

Describe the steps that must be completed to remove (dequeue) an item from a circular queue that has been implemented using a fixed-length array.

[5 marks]

Answer
Mark scheme for question 2.2

Question 3

0 3

Describe the Halting problem.

[2 marks]

Answer
Mark scheme for question 3.1

Explain the importance of the Halting problem.

[1 mark]

Answer
Mark scheme for question 3.2

Question 4

Figure 1 shows four sets R, S, T and U. Three dots (…) means the remaining members of the set follow the same pattern as the previous members of the set.

Figure 1

R = { a, b } S = { a, abb, abbbb, abbbbbb, …} T = { bb, bbbb, bbbbbb, …} U = { c, d, bb, b }

What is meant by the cardinality of a set?

[1 mark]

Answer
Mark scheme for question 4.1

Explain what is wrong with the statement:

‘The only subsets of R are the sets { a }, { b } and { a, b }’.

[1 mark]

Answer
Mark scheme for question 4.2

How many members are there in the set formed by the intersection of R and U ?

[1 mark]

Answer
Mark scheme for question 4.3

The language defined by a regular expression can be represented as a set.

Explain the functionality of the | (vertical bar) metacharacter when it is used in a regular expression.

[1 mark]

Answer
Mark scheme for question 4.4

The members of the set V are strings that match the regular expression a?b+

Set W is formed by the union of sets S and T.

Set X is formed by the set operation V – W.

Write a regular expression that would match with all the members of the set W.

[2 marks]

Answer
Mark scheme for question 4.5

Write a regular expression that would match with all the members of the set X.

[2 marks]

Answer
Mark scheme for question 4.6

Question 5

(3 + 4) * 5 is an example of an infix expression. The same expression has been represented in a different expression format in Figure 2.

Figure 2

3 4 + 5 *

What is the name of the expression format used in Figure 2 ?

[1 mark]

Answer
Mark scheme for question 5.1

Represent the infix expression 5 + 2 * 3 + 4 in the same expression format used in Figure 2.

[2 marks]

Answer
Mark scheme for question 5.2

Question 6

Figure 3 shows a graph containing five nodes. Figure 4 shows how the graph in Figure 3 could be represented using three one-dimensional arrays: Data, Dir1 and Dir2.

Figure for question 6

The graph in Figure 3 is a binary tree. A binary tree is a rooted tree where each node has at most two child nodes.

There are three properties that a graph needs to have for it to be a tree. One of those properties is that it contains no cycles.

State the other two properties of this graph that make it a tree.

[2 marks]

Answer
Mark scheme for question 6.1
Figure for question 6

[7 marks]

Answer
Mark scheme for question 6.2

The array Temp needs to be able to store three values when used with the binary tree shown in Figure 3, on page 6.

For some binary trees with only five nodes, the array Temp would need to be able to store five values.

Describe the structure of a five-node binary tree that would require Temp to be able to store five values.

[2 marks]

Answer
Mark scheme for question 6.3

State the type of data structure the algorithm shown in Figure 5 implements using the array Temp.

[1 mark]

Answer
Mark scheme for question 6.4
Figure for question 6

[1 mark]

Answer
Mark scheme for question 6.5

Question 7

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 an integer. It should keep doing this until they enter a value greater than 0.

The program should then tell the user if they have entered a perfectly bouncy number, a bouncy number or a number that is not bouncy.

A bouncy number is a number that is not an increasing number and not a decreasing number.

An increasing number is one where each digit is greater than or equal to the previous digit in the number.

A decreasing number is one where each digit is less than or equal to the previous digit in the number.

A perfectly bouncy number is a bouncy number in which the number of digits that are followed by a larger digit is equal to the number of digits that are followed by a smaller digit.

Examples

maths symbol 13578 is not a bouncy number because it is an increasing number.

maths symbol 973 is not a bouncy number because it is a decreasing number.

maths symbol 98657 is a bouncy number.

maths symbol 1111 is not a bouncy number because it is both an increasing number and a decreasing number.

maths symbol 13421 is a perfectly bouncy number as exactly two digits are followed by a larger digit and there are also exactly two digits followed by a smaller digit.

maths symbol 1829361 is a perfectly bouncy number as exactly three digits are followed by a larger digit and there are also exactly three digits followed by a smaller digit.

maths symbol 13333331 is a perfectly bouncy number as there is exactly one digit followed by a larger digit and also exactly one digit followed by a smaller digit.

Figure for question 7
Figure for question 7

[12 marks]

Answer
Mark scheme for question 7.1
Figure for question 7

[1 mark]

Answer
Mark scheme for question 7.2

Question 8

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 Puzzle class.

The DisplayPuzzle method uses concatenation.

Explain what is meant by concatenation.

[1 mark]

Answer
Mark scheme for question 8.1

State the number of methods in the Puzzle class that read data from a text file.

[1 mark]

Answer
Mark scheme for question 8.2

State the number of methods in the Puzzle class that read data from a binary (non-text) file.

[1 mark]

Answer
Mark scheme for question 8.3

Question 9

This question is about the Cell class.

Explain why IsEmpty could have been a private method instead of a public method.

[1 mark]

Answer
Mark scheme for question 9.1

The CheckSymbolAllowed method in the Cell class uses a local variable.

Explain one difference between a local variable and a private class attribute.

[1 mark]

Answer
Mark scheme for question 9.2

Question 10

This question is about the CheckForMatchWithPattern method in the Puzzle class.

CheckForMatchWithPattern uses nested iteration and exception handling.

State the name of another method in the Puzzle class that uses nested iteration.

[1 mark]

Answer
Mark scheme for question 10.1

Explain what problem would occur if the first two iteration structures in the method CheckForMatchWithPattern had been inside the exception handling structure instead of outside it.

[1 mark]

Answer
Mark scheme for question 10.2

Describe what exception handling is used for in the CheckForMatchWithPattern method.

[3 marks]

Answer
Mark scheme for question 10.3

A value of 10 is returned sometimes when it should not be. Figure 6 and Figure 7 show example 4maths symbol4 grids. The pattern in Figure 6 correctly results in a value of 10 being returned. The pattern in Figure 7 also results in a value of 10 being returned, but it should return 0.

Figure for question 10

Explain why the pattern in Figure 7 results in the value 10 being returned by the CheckForMatchWithPattern method.

[1 mark]

Answer
Mark scheme for question 10.4

Question 11

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 AttemptPuzzle in the Puzzle class.

The Skeleton Program is to be changed so that it checks the choice made by the user for the column number. A choice is valid if it is between one and the number of columns in the puzzle inclusive. You do not need to add checks for the row number.

The program should keep getting the user to enter a value until a valid choice has been made.

What you need to do

Task 1 Modify the method AttemptPuzzle so it checks that the value entered by the user is valid. If an invalid value is entered, the user should be made to enter another value.

Task 2 Test that the changes you have made work:

maths symbol run the Skeleton Program

maths symbol press the Enter key

maths symbol enter 1

maths symbol enter 10

maths symbol enter 4

Figure for question 11
Figure for question 11

[4 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 by tracking the user’s average score and highest score for the puzzle.

After the user chooses not to do another puzzle, the program should display the user’s highest score achieved on the puzzle and the user’s average score. Your amended Skeleton Program should calculate the average and highest scores for any number of puzzle attempts.

Example If the user:

maths symbol gets a score of 30 when they complete a puzzle

maths symbol decides to do another puzzle

maths symbol gets a score of 20 for the second puzzle

maths symbol decides not to do another puzzle

the program should display messages saying that their highest score was 30 and their average score was 25

What you need to do

Task 1 Modify the Main subroutine so that after the user decides not to attempt another puzzle their highest score for the puzzles attempted and their average score for the puzzles attempted are displayed.

Task 2 Test that the changes you have made work:

maths symbol run the Skeleton Program

maths symbol load the file puzzle1

maths symbol enter 5

maths symbol enter 5

maths symbol enter X

maths symbol enter Y

maths symbol load the file puzzle1

maths symbol enter 1

maths symbol enter 4

maths symbol enter X

maths symbol enter N

Figure for question 12
Figure for question 12

[5 marks]

Answer
Mark scheme for question 12.1
Figure for question 12

[1 mark]

Answer
Mark scheme for question 12.2

Question 13

This question extends the Skeleton Program by giving the user an option to shift all the cells in one row in the puzzle one place to the left.

When shifting left, the first cell in the row will move to the last position in the row.

Figure 8 shows an example puzzle and Figure 9 shows the result obtained from shifting all the cells in row 2 from the puzzle in Figure 8 one place to the left.

Figure 8

Figure for question 13

Figure 9

Figure for question 13

After the cells have been shifted, the user’s score should be reduced by 20 and the new state of the grid and the user’s new score should be displayed. No other changes to the user’s score should be made.

Shifting the cells does not count as a turn. After choosing to shift cells, the user should carry on with the rest of their turn by selecting a cell to place a symbol in.

When answering this question, you should make sure your program code will work for any size of puzzle grid.

What you need to do

Task 1 Create a new method called ShiftCellsInRowLeft in the Puzzle class that takes an integer parameter that specifies the row number to use with the shift.

Each cell, in the row indicated by the parameter, should be moved in Grid so that it is one place to the left; the leftmost cell should shift to the end of the row.

Task 2 Modify the AttemptPuzzle method in the Puzzle class so that it gives the user the option to shift the cells in a row. Inside the iteration structure used to get a row number from the user your program should:

maths symbol display a modified message telling the user to enter a row number or to enter 0 to shift cells

maths symbol if the user enters 0: o ask the user to enter the row number for the row to shift o call the method ShiftCellsInRowLeft with the number entered as a parameter o subtract 20 from the user’s score o display the new grid o display the new score o set Valid to be false.

Task 3 Test that the changes you have made work:

maths symbol run the Skeleton Program

maths symbol load the file puzzle2

maths symbol enter 0

maths symbol enter 1

maths symbol enter 1

Figure for question 13
Figure for question 13

[11 marks]

Answer
Mark scheme for question 13.1
Figure for question 13

[1 mark]

Answer
Mark scheme for question 13.2

The movement of the cells within a row can be described using vectors.

State the 2-vector that describes the movement for all but the leftmost cell in the row.

[1 mark]

Answer
Mark scheme for question 13.3

State the 2-vector that describes the movement for the leftmost cell in the row.

Your vector should work for any grid size.

[1 mark]

Answer
Mark scheme for question 13.4

Question 14

This question extends the Skeleton Program so that there is a new type of cell – a countdown cell.

A countdown cell has a timer associated with it that decreases by one each time the user tries to place a symbol in the puzzle grid.

The location of a countdown cell is shown by a numeric digit representing the current value of its timer. When its timer reaches zero, the cell’s symbol changes to an @.

A countdown cell should be added to the board each time the user’s score is increased. The location for the countdown cell should be an empty cell on the grid and selected randomly.

What you need to do

Task 1 Create a new class called CountdownCell that is a subclass of the BlockedCell class. Create a constructor for the CountdownCell class that sets the initial value of the timer and makes sure that the symbol displayed for the cell will be the value of its timer. The first symbol that should be displayed for the timer value of a CountdownCell is 3 Create a method UpdateCell in the CountdownCell class that:

maths symbol overrides the method from the base class

maths symbol decreases the value of the timer by one

maths symbol changes the symbol to @ when the timer has a value of zero.

Task 2 Modify the AttemptPuzzle method in the Puzzle class so that, if the amount to add to the score is greater than zero, it selects an empty cell in the grid at random and replaces that cell with a new CountdownCell.

Task 3 Modify the AttemptPuzzle method in the Puzzle class so that, immediately before it checks if the number of symbols left is zero, it calls the UpdateCell method for each cell in the grid.

Task 4 Test that the changes you have made work:

maths symbol run the Skeleton Program

maths symbol load the file puzzle3

maths symbol enter 1

maths symbol enter 4

maths symbol enter X

maths symbol place a T in an empty cell

maths symbol place a T in an empty cell

maths symbol place a T in an empty cell.

Figure for question 14
Figure for question 14

[13 marks]

Answer
Mark scheme for question 14.1
Figure for question 14

[1 mark]

Answer
Mark scheme for question 14.2

The paper as printed

Question paper - 7517/1 (1)

Question paper - 7517/1 (2)

Spotted a mistake on this page?Report a problem