AQA A-Level Computer Science Paper 1, June 2025: Question 9

5 marks · Medium difficulty · Programming

Modify the PlayGame subroutine to reduce the player's score when numbers appear in penalty positions in the list of targets, and provide test evidence.

Practise this question

Question

Exam question 09 specifying a modification to the PlayGame subroutine in the Skeleton Program. Penalty positions are introduced to the targets list: a number in the second position reduces the score by 5; a number in the first position reduces the score by 10 plus the value of that number; both apply additively if present in both positions. An example walkthrough of scores and target lists is provided. Task 1 asks for the amended source code for PlayGame (4 marks), and Task 2 asks for a screen capture showing the test entering 4*5 six times in the training game (1 mark).
Question text

09 This question refers to the PlayGame subroutine.

The Skeleton Program is to be changed so that there are penalty positions in the list

of targets.

If there is a number shown in the second position of the list of targets, then the

player’s score is to be reduced by five.

If there is a number shown in the first position of the list of targets, then the player’s

score is to be reduced by the value of the number that is ten larger than the number

shown in that position.

If there are numbers in the first and second positions of the list of targets, then the

player’s score will be reduced by five and by the value of the number that is ten larger

than the number shown in the first position of the list of targets.

The program should check if there are numbers shown in the penalty positions after

reducing the player’s score by one.

Example

3 80 17 62 7 31 11 0 18 19 22 41 13 22 75

Numbers available: 2 7 8 3 4

Current score: 4

Player enters the expression 2*7

This expression evaluates to 14. This is not one of the targets, so the player’s score

will reduce by one.

3 80 17 62 7 31 11 0 18 19 22 41 13 22 75 1

Numbers available: 2 7 8 3 4

Current score: 3

Player enters the expression 2*7

This expression evaluates to 14. This is not one of the targets, so the player’s score

will reduce by six (1 + 5).

3 80 17 62 7 31 11 0 18 19 22 41 13 22 75 1 33

Numbers available: 2 7 8 3 4

Current score: –3

Player enters the expression 2*7

This expression evaluates to 14. This is not one of the targets so the player’s score

will reduce by 19 (1 + 5 + 10 + 3).

The game now ends and the final score (–22) will be displayed.

What you need to do

Task 1

Modify the subroutine PlayGame so it reduces the player’s score if there are

numbers shown in a penalty position.

Task 2

Test that the changes you have made work:

• run the Skeleton Program

• select the training game

• enter the expression 4*5 six times.

Evidence that you need to provide

Include the following evidence in your Electronic Answer Document.

09.1 Your PROGRAM SOURCE CODE for the amended subroutine PlayGame.

[4 marks]

09.2 SCREEN CAPTURE(S) showing the results of the requested test.

[1 mark]

Mark scheme

Show the mark scheme Mark scheme for question 09 showing 4 marks for 09.1 (AO3 programming): mark 1 for new selection structure in correct position reducing score by 5; mark 2 for correct condition checking if a number is shown in the second position; mark 3 for reducing score by ten plus the value in the first position; mark 4 for attempting to place this inside a selection structure comparing the position with a numeric value (maximum 3 if code contains errors). 09.2 awards 1 mark (AO3 evaluate) for a screen capture matching the code, showing the last two instances of 4*5 being entered, followed by the game over message and a final score of -49.

Question Marks

09 1 All marks for AO3 (programming) 4

1. New selection structure, in correct position in code, with score reduced by five

inside the structure;

2. Correct condition for selection structure for mark point 1 used to check if there is

a number shown in the second position;

3. Score reduced by ten and by the value of the number in the first position in

Targets;

4. Attempt at code for mark point 3 is inside a selection structure that compares a

position in Targets with a numeric value; A. new selection structure or using

existing selection structure

Max 3 if code contains errors

09 2 Mark is for AO3 (evaluate) 1

**** SCREEN CAPTURE ****

Must match code from 09.1.

Code for 09.1 must be sensible.

Screen capture showing the last two instances of 4*5 being entered followed by

game over message being displayed. Final score should be –49:

How to answer it

Skeleton Program: Adding Penalty Positions to PlayGame

What this question tests

This question assesses your ability to modify an existing skeleton program (AO3 Programming) and test the modification (AO3 Evaluation). Specifically, it tests:

  • Locating the correct section within subroutine PlayGame where incorrect guesses reduce the player's score.
  • Navigating 0-indexed or 1-indexed data structures representing the target queue/list.
  • Writing conditional logic to check if target positions contain active numerical values rather than empty space sentinels (e.g. -1 or " " ).
  • Applying dynamic score deductions based on the value held at a specific index.
  • Producing rigorous screen capture evidence verifying game behavior and final scores.
Question 09.1 • 4 Marks

Part (a) — Amending Subroutine PlayGame

Modifying the penalty scoring rules when an invalid target is entered

💡 Key Knowledge

  • Position in Code: The prompt explicitly states: "The program should check if there are numbers shown in the penalty positions after reducing the player's score by one." Find the existing line: Score = Score - 1 .
  • Array/List Indexing:
    • First position = index 0 (Python/C#) or 1 (VB.NET 1-based collections).
    • Second position = index 1 (Python/C#) or 2 (VB.NET).
  • Checking for "Numbers Shown": Empty slots in the target list are represented by a sentinel (typically -1 or space " " ). Checking if a number is shown means checking Targets[index] != -1 (or > -1 ).

🧠 Exam Technique

  • Separate Conditions: Do not use an if ... elif ladder. The question specifies that if both positions contain numbers, both penalties apply. Use two separate if statements!
  • Keep Original Logic Intact: Only add the new penalty checks directly underneath the line that deducts the single standard penalty point.
  • Watch the Math: First position penalty is 10 + Targets[first] , not just 10, and not just the value!

✅ Model Implementation (Python & Pseudocode Equivalent)

# Existing skeleton code inside PlayGame where incorrect expression is evaluated if not TargetFound: Score = Score - 1 # --- NEW AMENDED CODE STARTS HERE --- # Check second position in Targets (index 1 in Python, Targets[1] != -1) if Targets[ 1 ] != - 1 : Score = Score - 5 # Check first position in Targets (index 0 in Python, Targets[0] != -1) if Targets[ 0 ] != - 1 : Score = Score - ( 10 + Targets[ 0 ]) # --- NEW AMENDED CODE ENDS HERE ---

❌ Common Student Errors

  • Off-by-one index error: Checking Targets[1] for the first position and Targets[2] for the second position in 0-indexed languages (Python / C#), causing an index out of bounds error or checking the wrong cells.
  • Using else if / elif : If position 2 has a penalty, using an elif causes the program to skip the check for position 1 entirely, losing mark point 3 and 4 when both contain numbers.
  • Checking wrong empty value: Checking Targets[0] is not None or Targets[0] > 0 when zero is a valid target, or failing to check against -1 (the sentinel representing an empty slot).
  • Incorrect order: Placing the penalty checks before Score = Score - 1 , which violates the requirement: "check ... after reducing the player's score by one".
Mark Scheme Breakdown (4 Marks total, AO3):
• Mark 1: New selection structure, in correct position in code, with score reduced by 5 inside structure.
• Mark 2: Correct condition used to check if a number is shown in the second position.
• Mark 3: Score reduced by 10 and by the value of the number in the first position of Targets .
• Mark 4: Check for first position is inside a selection structure comparing the position with a numeric value.
Note: Maximum 3 marks if the submitted code contains syntax or semantic errors.
Question 09.2 • 1 Mark

Part (b) — Testing and Screen Capture Evidence

Executing the specified test run and verifying program output

📐 Step-by-Step Score Trace (Why Final Score = -49)

Training game starts with score = 0. Entering 4*5 (evaluates to 20) six consecutive times:

1
20 not in targets. No penalty targets active. Deduct 1. Score = -1
2
Targets shift. Position 2 empty, Position 1 empty. Deduct 1. Score = -2
3
Targets shift. Position 2 now occupied by a number. Deduct 1 + 5. Score = -8
4
Position 1 has value 3, Position 2 occupied. Deduct 1 + 5 + (10 + 3) = 19. Score = -27
5
Further shifts and penalty positions trigger another deduction. Score decreases
6
Final incorrect attempt triggers the end of game. Final Score = -49

🧠 Screenshot Requirements

  • Exact Match Required: The screen capture must match code written in 09.1. You cannot get this mark if your code in 09.1 could not produce the output.
  • Show the End State: The screenshot must show:
    • The last two instances of 4*5 being entered.
    • The game over message clearly visible.
    • The final score displaying exactly -49 .
  • Clear & Uncropped: Do not crop out the prompt or the final score line.

❌ Trap to Avoid

Candidates frequently enter the wrong expression (e.g. entering 20 instead of 4*5 ) or do not complete all six rounds. Follow the test instructions strictly: "select the training game, enter the expression 4*5 six times".

Mark Scheme Breakdown (1 Mark total, AO3):
• Screen capture showing the last two instances of 4*5 being entered followed by the game over message, with a final score of -49. Code from 09.1 must be sensible and consistent with output.

Topics

4.1 Fundamentals of programming · 4.2 Fundamentals of data structures · 4.1.1 Programming · 4.2.1 Data structures and abstract data types

Question and mark scheme from the AQA A-Level Computer Science examination, Paper 1, June 2025. QuestionVault is an independent revision resource; questions remain the copyright of the awarding body.