AQA AS-Level · PastPaper.sampleTitle

MetadataPastPaper.sampleTitle

Thinka Jun 2023 AQA AS Level-Style Mock — Computer Science 7516

150 PastPaper.marks195 PastPaper.minutes2023
An original Thinka practice paper modelled on the structure and difficulty of the Jun 2023 AQA AS Level Computer Science 7516 paper. Not affiliated with or reproduced from AQA.

Paper 1 Section A

Spend approximately 20 minutes on this section. Answer all questions. Programming questions require you to write code starting from a clean file.
6 PastPaper.question · 25 PastPaper.marks
PastPaper.question 1 · Complete Table (FSM State Transitions)
6 PastPaper.marks
A finite state machine (FSM) is used to detect a specific sequence of inputs. The input alphabet is \(\{A, B\}\) and the states are \(\{S_0, S_1, S_2, S_3\}\).

The FSM behaves according to the following rules:
* \(S_0\) is the starting state.
* If the FSM is in state \(S_0\) and receives input \(A\), it transitions to state \(S_1\). If it receives input \(B\), it remains in state \(S_0\).
* If the FSM is in state \(S_1\) and receives input \(A\), it remains in state \(S_1\). If it receives input \(B\), it transitions to state \(S_2\).
* If the FSM is in state \(S_2\) and receives input \(A\), it transitions to state \(S_3\). If it receives input \(B\), it transitions back to state \(S_0\).
* State \(S_3\) is an accepting state. Once reached, any further inputs of \(A\) or \(B\) keep the FSM in state \(S_3\).

Complete the state transition table below by identifying the missing next states for labels **(i)** to **(vi)**.

| Current State | Input | Next State |
| :---: | :---: | :---: |
| \(S_0\) | \(A\) | **(i)** |
| \(S_0\) | \(B\) | \(S_0\) |
| \(S_1\) | \(A\) | **(ii)** |
| \(S_1\) | \(B\) | **(iii)** |
| \(S_2\) | \(A\) | **(iv)** |
| \(S_2\) | \(B\) | **(v)** |
| \(S_3\) | \(A\) | \(S_3\) |
| \(S_3\) | \(B\) | **(vi)** |
PastPaper.showAnswers

PastPaper.workedSolution

To find the missing entries, we apply the FSM rules systematically:

1. **State \(S_0\) with input \(A\)**: The rule states "If the FSM is in state \(S_0\) and receives input \(A\), it transitions to state \(S_1\)". Therefore, **(i)** is \(S_1\).
2. **State \(S_1\) with input \(A\)**: The rule states "If the FSM is in state \(S_1\) and receives input \(A\), it remains in state \(S_1\)". Therefore, **(ii)** is \(S_1\).
3. **State \(S_1\) with input \(B\)**: The rule states "If it receives input \(B\), it transitions to state \(S_2\)". Therefore, **(iii)** is \(S_2\).
4. **State \(S_2\) with input \(A\)**: The rule states "If the FSM is in state \(S_2\) and receives input \(A\), it transitions to state \(S_3\)". Therefore, **(iv)** is \(S_3\).
5. **State \(S_2\) with input \(B\)**: The rule states "If it receives input \(B\), it transitions back to state \(S_0\)". Therefore, **(v)** is \(S_0\).
6. **State \(S_3\) with input \(B\)**: The rule states "Once reached, any further inputs of \(A\) or \(B\) keep the FSM in state \(S_3\)". Therefore, **(vi)** is \(S_3\).

PastPaper.markingScheme

Award 1 mark for each correct state transition:
* **(i)**: \(S_1\) (1 mark)
* **(ii)**: \(S_1\) (1 mark)
* **(iii)**: \(S_2\) (1 mark)
* **(iv)**: \(S_3\) (1 mark)
* **(v)**: \(S_0\) (1 mark)
* **(vi)**: \(S_3\) (1 mark)

Accept equivalent clear notations (e.g., S1, S2, S0, S3 without subscript formatting).
PastPaper.question 2 · Algorithm Trace Table
5 PastPaper.marks
An algorithm is represented by the following pseudocode:

```text
A <- [3, 8, 4, 7, 2]
P <- 0
Q <- 1
R <- 0
WHILE P < 5
R <- A[P]
IF R MOD 2 = 1 THEN
Q <- Q + R
ELSE
Q <- Q * 2
ENDIF
P <- P + 1
ENDWHILE
```

Complete the trace table below to show the execution of this algorithm. The first row (initial values) has been completed for you.

| P | Q | R |
| :---: | :---: | :---: |
| 0 | 1 | 0 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
PastPaper.showAnswers

PastPaper.workedSolution

To trace the algorithm, we follow the execution step-by-step:

1. **Initialization**:
* `A = [3, 8, 4, 7, 2]`
* `P = 0`, `Q = 1`, `R = 0` (Given in the first row)

2. **Iteration 1** (`P < 5` is `0 < 5`, which is True):
* `R` becomes `A[0]` which is `3`.
* `3 MOD 2 = 1` is True, so `Q` becomes `Q + R` = `1 + 3 = 4`.
* `P` becomes `P + 1` = `1`.

3. **Iteration 2** (`P < 5` is `1 < 5`, which is True):
* `R` becomes `A[1]` which is `8`.
* `8 MOD 2 = 1` is False, so `Q` becomes `Q * 2` = `4 * 2 = 8`.
* `P` becomes `P + 1` = `2`.

4. **Iteration 3** (`P < 5` is `2 < 5`, which is True):
* `R` becomes `A[2]` which is `4`.
* `4 MOD 2 = 1` is False, so `Q` becomes `Q * 2` = `8 * 2 = 16`.
* `P` becomes `P + 1` = `3`.

5. **Iteration 4** (`P < 5` is `3 < 5`, which is True):
* `R` becomes `A[3]` which is `7`.
* `7 MOD 2 = 1` is True, so `Q` becomes `Q + R` = `16 + 7 = 23`.
* `P` becomes `P + 1` = `4`.

6. **Iteration 5** (`P < 5` is `4 < 5`, which is True):
* `R` becomes `A[4]` which is `2`.
* `2 MOD 2 = 1` is False, so `Q` becomes `Q * 2` = `23 * 2 = 46`.
* `P` becomes `P + 1` = `5`.

7. **Termination** (`P < 5` is `5 < 5`, which is False):
* The loop terminates.

**Completed Trace Table (by iteration row):**
| P | Q | R |
| :---: | :---: | :---: |
| 0 | 1 | 0 |
| 1 | 4 | 3 |
| 2 | 8 | 8 |
| 3 | 16 | 4 |
| 4 | 23 | 7 |
| 5 | 46 | 2 |

*(Note: Candidates may write updates on separate lines sequentially; this is also completely correct as long as the relative order of updates is correct.)*

PastPaper.markingScheme

Award 1 mark per correct iteration row/state change up to a maximum of 5 marks:
- **1 Mark**: First iteration state correct (`R = 3`, `Q = 4`, `P = 1`).
- **1 Mark**: Second iteration state correct (`R = 8`, `Q = 8`, `P = 2`).
- **1 Mark**: Third iteration state correct (`R = 4`, `Q = 16`, `P = 3`).
- **1 Mark**: Fourth iteration state correct (`R = 7`, `Q = 23`, `P = 4`).
- **1 Mark**: Fifth iteration state and correct termination state traced (`R = 2`, `Q = 46`, `P = 5`).

**Guidance notes:**
* Accept values written on separate lines sequentially (e.g. `R` changing first, then `Q`, then `P` on a new line) as long as the sequence of values is correct.
* If a candidate makes a calculation error in an early row, follow-through marks (FT) can be awarded for subsequent rows if they correctly apply the logic to their incorrect values.
PastPaper.question 3 · Short Answer
2 PastPaper.marks
Describe what is meant by the 'scope' of a variable, and distinguish between the scope of a local variable and the scope of a global variable.
PastPaper.showAnswers

PastPaper.workedSolution

Scope refers to the section of the program source code where a variable is visible, recognized, and can be referenced. A local variable has a local scope, meaning it is created when the subroutine is called and destroyed when the subroutine exits, so it can only be accessed within that specific subroutine. In contrast, a global variable is declared outside of any subroutines and has global scope, meaning it can be accessed and modified by any part of the program during its execution.

PastPaper.markingScheme

Award up to 2 marks: 1 mark for a correct definition of scope (e.g., the area of program code where a variable is visible, accessible, or can be referenced). 1 mark for clearly distinguishing local and global scope (e.g., local is restricted to the subroutine/block in which it is declared, while global is accessible throughout the entire program). Note: Accept equivalent terminology such as 'visibility' or 'lifetime/accessibility boundaries'.
PastPaper.question 4 · Short Answer
2 PastPaper.marks
Define the term 'algorithm' by describing its essential properties.
PastPaper.showAnswers

PastPaper.workedSolution

An algorithm is a set of precise, step-by-step instructions designed to accomplish a specific task or solve a particular problem. To be considered an algorithm, it must be unambiguous (each step is clearly defined) and it must terminate after a finite number of steps.

PastPaper.markingScheme

Award 1 mark for each correct point made, up to a maximum of 2 marks.
- 1 Mark: A sequence of instructions / steps / rules.
- 1 Mark: Designed to solve a problem / perform a task / must be finite (will terminate).

Acceptable alternatives:
- "An ordered set of operations..." for the first mark.
- "To achieve a specific outcome..." for the second mark.
PastPaper.question 5 · practical
5 PastPaper.marks
An online retailer uses product codes of the form `XX-YYYY-Z` where:
- `XX` represents exactly two uppercase letters (A-Z).
- `YYYY` represents exactly four digits (0-9).
- `Z` is a single-digit check digit, which is equal to the sum of the digits in `YYYY` modulo 10.

Write a Python function `validate_product_code(code)` that takes a string `code` as a parameter and returns `True` if the product code is valid according to this specification, and `False` otherwise.
PastPaper.showAnswers

PastPaper.workedSolution

The function first checks if the length of the string is exactly 9 characters and verifies that hyphens are at index 2 and 7. Next, it verifies that the first two characters are uppercase alphabetical letters. It then extracts the digits from index 3 to 6 and checks if they are numeric. Finally, it calculates the sum of these digits, computes the sum modulo 10, and compares this check digit with the character at index 8. If all checks pass, it returns `True`; otherwise, `False`.

PastPaper.markingScheme

1 mark: Correct length check (9 characters) and verification of hyphens at indices 2 and 7.
1 mark: Verification of exactly two uppercase letters at the start.
1 mark: Verification of four numerical characters in the middle section (indices 3-6).
1 mark: Correct calculation of the sum of the four digits modulo 10.
1 mark: Correct comparison of calculated check digit with the final character (index 8), returning True/False appropriately.
PastPaper.question 6 · practical
5 PastPaper.marks
Write a Python function `compress_string(text)` that performs basic run-length encoding. The function should take a string of letters `text` as input and return a new string where consecutive repeating characters are replaced with the count of repetitions followed by the character itself.

For example:
- `compress_string("AAABBC")` should return `"3A2B1C"`.
- `compress_string("")` should return `""`.
- `compress_string("D")` should return `"1D"`.
PastPaper.showAnswers

PastPaper.workedSolution

We handle the edge case of an empty input string by returning an empty string. We then initialize an empty list or string to hold the results and a counter starting at 1. We loop through the string starting from the second character (index 1). If the current character is equal to the previous one, we increment the count. If it is different, we append the count and the previous character to our results, then reset the count to 1. After the loop, we must append the final character group and count, then return the reconstructed string.

PastPaper.markingScheme

1 mark: Correctly handling the empty string edge case.
1 mark: Setting up a loop to correctly iterate over the characters of the string.
1 mark: Correct condition checking to compare consecutive characters.
1 mark: Correctly appending the count and corresponding character to the output structure when characters transition.
1 mark: Appending the final group after the loop terminates and returning the correct final string representation.

Paper 1 Section B

Spend approximately 25 minutes on this section. Questions refer to the Preliminary Material and the Skeleton Program but do not require code modifications.
13 PastPaper.question · 21 PastPaper.marks
PastPaper.question 1 · Identifier identification
1 PastPaper.marks
Refer to the following outline of a Skeleton Program for a game called *Island Rescue*:

```
Constant GRID_SIZE = 10
Constant STARTING_FUEL = 100
Constant RESCUE_CHARACTER = 'R'

Global Grid : Array of Arrays of Characters
Global FuelRemaining : Integer

Subroutine InitializeGrid(Grid)
// Code here
EndSubroutine

Subroutine DisplayGrid(Grid)
// Code here
EndSubroutine

Subroutine GetMoveDirections(CurrentPos)
Declare Directions : String
// Code here
Return Directions
EndSubroutine

Subroutine UpdateFuel(Fuel, Amount)
Declare NewFuel : Integer
NewFuel = Fuel + Amount
Return NewFuel
EndSubroutine

Subroutine PlayGame()
Declare GameOver : Boolean
Declare MoveDirection : String
Declare Steps : Integer
// Code here
EndSubroutine
```

State the name of a local variable declared in the subroutine `PlayGame`.
PastPaper.showAnswers

PastPaper.workedSolution

The local variables declared within the `PlayGame` subroutine are `GameOver`, `MoveDirection`, and `Steps`. Any of these three are correct identifiers.

PastPaper.markingScheme

1 Mark: Accept 'GameOver', 'MoveDirection', or 'Steps'. Reject any other answer.
PastPaper.question 2 · Identifier identification
1 PastPaper.marks
Refer to the following outline of a Skeleton Program for a game called *Island Rescue*:

```
Constant GRID_SIZE = 10
Constant STARTING_FUEL = 100
Constant RESCUE_CHARACTER = 'R'

Global Grid : Array of Arrays of Characters
Global FuelRemaining : Integer

Subroutine InitializeGrid(Grid)
// Code here
EndSubroutine

Subroutine DisplayGrid(Grid)
// Code here
EndSubroutine

Subroutine GetMoveDirections(CurrentPos)
Declare Directions : String
// Code here
Return Directions
EndSubroutine

Subroutine UpdateFuel(Fuel, Amount)
Declare NewFuel : Integer
NewFuel = Fuel + Amount
Return NewFuel
EndSubroutine

Subroutine PlayGame()
Declare GameOver : Boolean
Declare MoveDirection : String
Declare Steps : Integer
// Code here
EndSubroutine
```

State the name of a user-defined subroutine that returns a value (a function).
PastPaper.showAnswers

PastPaper.workedSolution

A subroutine that returns a value is a function. In this program, both `GetMoveDirections` and `UpdateFuel` are functions because they return values (`Directions` and `NewFuel` respectively).

PastPaper.markingScheme

1 Mark: Accept either 'GetMoveDirections' or 'UpdateFuel'. Reject any other identifier.
PastPaper.question 3 · Identifier identification
1 PastPaper.marks
Refer to the following outline of a Skeleton Program for a game called *Island Rescue*:

```
Constant GRID_SIZE = 10
Constant STARTING_FUEL = 100
Constant RESCUE_CHARACTER = 'R'

Global Grid : Array of Arrays of Characters
Global FuelRemaining : Integer

Subroutine InitializeGrid(Grid)
// Code here
EndSubroutine

Subroutine DisplayGrid(Grid)
// Code here
EndSubroutine

Subroutine GetMoveDirections(CurrentPos)
Declare Directions : String
// Code here
Return Directions
EndSubroutine

Subroutine UpdateFuel(Fuel, Amount)
Declare NewFuel : Integer
NewFuel = Fuel + Amount
Return NewFuel
EndSubroutine

Subroutine PlayGame()
Declare GameOver : Boolean
Declare MoveDirection : String
Declare Steps : Integer
// Code here
EndSubroutine
```

State the name of a user-defined constant used in the program.
PastPaper.showAnswers

PastPaper.workedSolution

The three user-defined constants declared at the top level of the program are `GRID_SIZE`, `STARTING_FUEL`, and `RESCUE_CHARACTER`.

PastPaper.markingScheme

1 Mark: Accept 'GRID_SIZE', 'STARTING_FUEL', or 'RESCUE_CHARACTER'. Case-insensitive matching can be accepted, but exact casing is preferred.
PastPaper.question 4 · Identifier identification
1 PastPaper.marks
Refer to the following outline of a Skeleton Program for a game called *Island Rescue*:

```
Constant GRID_SIZE = 10
Constant STARTING_FUEL = 100
Constant RESCUE_CHARACTER = 'R'

Global Grid : Array of Arrays of Characters
Global FuelRemaining : Integer

Subroutine InitializeGrid(Grid)
// Code here
EndSubroutine

Subroutine DisplayGrid(Grid)
// Code here
EndSubroutine

Subroutine GetMoveDirections(CurrentPos)
Declare Directions : String
// Code here
Return Directions
EndSubroutine

Subroutine UpdateFuel(Fuel, Amount)
Declare NewFuel : Integer
NewFuel = Fuel + Amount
Return NewFuel
EndSubroutine

Subroutine PlayGame()
Declare GameOver : Boolean
Declare MoveDirection : String
Declare Steps : Integer
// Code here
EndSubroutine
```

State the name of a formal parameter defined in the subroutine `UpdateFuel`.
PastPaper.showAnswers

PastPaper.workedSolution

The subroutine signature `Subroutine UpdateFuel(Fuel, Amount)` defines two formal parameters: `Fuel` and `Amount`.

PastPaper.markingScheme

1 Mark: Accept either 'Fuel' or 'Amount'. Reject 'NewFuel' (as it is a local variable, not a parameter).
PastPaper.question 5 · written
1 PastPaper.marks
The Skeleton Program uses a fixed-size, one-dimensional array to store the list of active players in a game session. State one disadvantage of using a static array for this purpose rather than a dynamic list structure.
PastPaper.showAnswers

PastPaper.workedSolution

A static array has a fixed size determined at compile time. This means that if the number of players exceeds the predefined size of the array, an index out of bounds error will occur unless additional boundary checks are written. Furthermore, if there are very few players, the memory allocated for the unused elements of the static array is wasted.

PastPaper.markingScheme

1 mark for identifying any of the following: The array has a fixed capacity / cannot grow dynamically to accommodate more players than its initial size; memory is wasted if the number of active players is significantly lower than the maximum size; it can cause array index out of bounds errors if capacity is exceeded.
PastPaper.question 6 · written
1 PastPaper.marks
The Skeleton Program represents a game board using a two-dimensional array of characters. State one advantage of using a two-dimensional array instead of a one-dimensional array of the same total capacity to represent a grid-based game board.
PastPaper.showAnswers

PastPaper.workedSolution

A two-dimensional array allows the programmer to access any grid cell directly using two coordinates representing the row and column, matching the physical layout of the board. With a one-dimensional array, the programmer would have to mathematically calculate the index (for example, index = row * width + col), which makes the code harder to read and maintain.

PastPaper.markingScheme

1 mark for: Directly maps to 2D coordinates / grid system (making indexing row and column easier or more intuitive); improves code readability/maintainability as coordinate lookups do not require complex index calculation formulas (such as index = row * width + col).
PastPaper.question 7 · Core Term Definition
1 PastPaper.marks
State what is meant by the term *scope* of a variable.
PastPaper.showAnswers

PastPaper.workedSolution

The scope of a variable defines the part of the program's source code where the variable is visible and can be referenced. For example, a local variable's scope is restricted to the subroutine in which it is declared, whereas a global variable's scope typically extends throughout the entire program.

PastPaper.markingScheme

1 mark for stating that scope is the part, region, or area of the program/code where a variable is visible, accessible, or can be used. Accept: 'where the variable is active' or 'where it is known'. Reject: explanations of lifetime (e.g., 'how long the variable exists in memory').
PastPaper.question 8 · Core Term Definition
1 PastPaper.marks
State what is meant by the term *scope* of a variable.
PastPaper.showAnswers

PastPaper.workedSolution

The scope of a variable defines the part of the program's source code where the variable is visible and can be referenced. For example, a local variable's scope is restricted to the subroutine in which it is declared, whereas a global variable's scope typically extends throughout the entire program.

PastPaper.markingScheme

1 mark for stating that scope is the part, region, or area of the program/code where a variable is visible, accessible, or can be used. Accept: 'where the variable is active' or 'where it is known'. Reject: explanations of lifetime (e.g., 'how long the variable exists in memory').
PastPaper.question 9 · Mapping / Value lookup
5 PastPaper.marks
An AS Level Computer Science Skeleton Program simulates a simple grid-based movement game. The game board is represented by a 4x4 2D array named Grid (with row index 0 to 3 and column index 0 to 3).

The initial state of Grid is shown below:

Row 0: ['.', '.', 'T', '.']
Row 1: ['P', '.', '.', 'X']
Row 2: ['.', 'W', '.', '.']
Row 3: ['.', '.', '.', 'E']

Key:
'.' = Empty space
'P' = Player
'T' = Treasure
'W' = Wall
'X' = Trap
'E' = Exit

At start-up, the game initializes the following state variables:
- PlayerRow = 1
- PlayerCol = 0
- Health = 50
- TreasureCount = 0

The movements are processed using the following rules:
1. Commands are 'R' (Right: col + 1), 'L' (Left: col - 1), 'U' (Up: row - 1), and 'D' (Down: row + 1).
2. If the destination square contains 'W' (Wall), the move is blocked: the player remains in their current square and 'Blocked' is printed.
3. If the destination square contains 'X' (Trap), the player moves to that square, but Health is decreased by 10.
4. If the destination square contains 'T' (Treasure), the player moves to that square and TreasureCount increases by 1.
5. When the player successfully moves to a new square, their previous square becomes '.' and the new square becomes 'P'.

Trace the state of the variables and the Grid after the following sequence of move commands is executed in order:
'R', 'D', 'R', 'U', 'R', 'D'

State the final value for each of the following:
1. PlayerRow
2. PlayerCol
3. Health
4. TreasureCount
5. The character value of Grid[1][2]
PastPaper.showAnswers

PastPaper.workedSolution

Let's trace the execution of the moves step-by-step:

- Initial State:
Grid:
Row 0: ['.', '.', 'T', '.']
Row 1: ['P', '.', '.', 'X']
Row 2: ['.', 'W', '.', '.']
Row 3: ['.', '.', '.', 'E']
PlayerRow = 1, PlayerCol = 0, Health = 50, TreasureCount = 0

- Move 1: 'R' (Right)
Target square is Grid[1][1] ('.').
The move is successful. Grid[1][0] becomes '.', Grid[1][1] becomes 'P'.
PlayerRow = 1, PlayerCol = 1.

- Move 2: 'D' (Down)
Target square is Grid[2][1] ('W').
This is a Wall, so the move is blocked. Player remains at Grid[1][1].
No variable changes.

- Move 3: 'R' (Right)
Target square is Grid[1][2] ('.').
The move is successful. Grid[1][1] becomes '.', Grid[1][2] becomes 'P'.
PlayerRow = 1, PlayerCol = 2.

- Move 4: 'U' (Up)
Target square is Grid[0][2] ('T').
The move is successful. Grid[1][2] becomes '.', Grid[0][2] becomes 'P'.
TreasureCount increases to 1.
PlayerRow = 0, PlayerCol = 2.

- Move 5: 'R' (Right)
Target square is Grid[0][3] ('.').
The move is successful. Grid[0][2] becomes '.', Grid[0][3] becomes 'P'.
PlayerRow = 0, PlayerCol = 3.

- Move 6: 'D' (Down)
Target square is Grid[1][3] ('X').
The move is successful. Grid[0][3] becomes '.', Grid[1][3] becomes 'P'.
Health decreases by 10 (from 50 to 40).
PlayerRow = 1, PlayerCol = 3.

Final State Lookup:
1. PlayerRow = 1
2. PlayerCol = 3
3. Health = 40
4. TreasureCount = 1
5. Grid[1][2] = '.'

PastPaper.markingScheme

Award 1 mark for each correct final value (Max 5 marks):

- 1 Mark: PlayerRow = 1
- 1 Mark: PlayerCol = 3
- 1 Mark: Health = 40
- 1 Mark: TreasureCount = 1
- 1 Mark: Grid[1][2] = '.' (Accept single quotes, double quotes, or simply the period/dot character)
PastPaper.question 10 · Subroutine Code Analysis
2 PastPaper.marks
An educational simulation game uses a 2D array Grid of size 5x5 to represent a play area. The following subroutine is used to initialize the board:

```python
def ResetGrid(Grid, Size):
for R in range(0, Size):
for C in range(0, Size):
if R == C or R + C == Size - 1:
Grid[R][C] = "X"
else:
Grid[R][C] = "."
```

Describe the precise visual pattern that will be stored in the 2D array Grid after this subroutine is executed with Size = 5.
PastPaper.showAnswers

PastPaper.workedSolution

We trace the loops where R and C range from 0 to 4:
- When R == C, cells (0,0), (1,1), (2,2), (3,3), and (4,4) are set to 'X'. This forms the main diagonal from top-left to bottom-right.
- When R + C == Size - 1 (which is 4), cells (0,4), (1,3), (2,2), (3,1), and (4,0) are set to 'X'. This forms the opposite diagonal from top-right to bottom-left.
- All other cells are set to '.'.
This creates a large 'X' shape crossing through the middle cell of the 5x5 grid, with all other spaces filled with dots.

PastPaper.markingScheme

1 mark: Identifies that the 'X' characters form two diagonal lines crossing in the center (an 'X' shape / diagonals).
1 mark: Identifies that all non-diagonal cells are filled with '.' characters.
PastPaper.question 11 · Subroutine Code Analysis
2 PastPaper.marks
In a board game simulation, a move is validated using the following subroutine:

```python
def CheckMove(StartRow, StartCol, EndRow, EndCol):
RowDiff = abs(StartRow - EndRow)
ColDiff = abs(StartCol - EndCol)
if (RowDiff == 2 and ColDiff == 1) or (RowDiff == 1 and ColDiff == 2):
return True
return False
```

State which standard chess piece has its movement pattern validated by this subroutine, and explain how the logic in the selection statement checks for this pattern.
PastPaper.showAnswers

PastPaper.workedSolution

The subroutine calculates the absolute difference between the starting and ending row indices (RowDiff) and column indices (ColDiff).
A standard chess Knight moves in an 'L' shape, which consists of moving either:
- 2 spaces vertically and 1 space horizontally (i.e., RowDiff == 2 and ColDiff == 1), OR
- 1 space vertically and 2 spaces horizontally (i.e., RowDiff == 1 and ColDiff == 2).
This matches the if condition perfectly.

PastPaper.markingScheme

1 mark: Identifies the piece is a Knight.
1 mark: Explains that the conditional checks for an 'L' shape movement (moving 2 units along one axis and 1 unit along the other axis).
PastPaper.question 12 · Subroutine Code Analysis
2 PastPaper.marks
The following subroutine is used to encrypt messages in a text game:

```python
def ShiftCipher(Word, Key):
NewWord = ""
for Char in Word:
AsciiVal = ord(Char)
if AsciiVal >= 65 and AsciiVal <= 90:
NewVal = AsciiVal + Key
if NewVal > 90:
NewVal = NewVal - 26
NewWord = NewWord + chr(NewVal)
else:
NewWord = NewWord + Char
return NewWord
```

Dry run this subroutine by stating the exact string returned when the call ShiftCipher("ZEBRA", 3) is executed.
PastPaper.showAnswers

PastPaper.workedSolution

We trace each character of the string "ZEBRA" with Key = 3:
- 'Z' (ASCII 90): NewVal = 90 + 3 = 93. Since 93 > 90, NewVal = 93 - 26 = 67 ('C').
- 'E' (ASCII 69): NewVal = 69 + 3 = 72 ('H').
- 'B' (ASCII 66): NewVal = 66 + 3 = 69 ('E').
- 'R' (ASCII 82): NewVal = 82 + 3 = 85 ('U').
- 'A' (ASCII 65): NewVal = 65 + 3 = 68 ('D').
Concatenating these gives "CHEUD".

PastPaper.markingScheme

1 mark: Correctly wraps 'Z' around to 'C' by subtracting 26.
1 mark: Correctly shifts 'E', 'B', 'R', 'A' by 3 positions to get 'H', 'E', 'U', 'D' (all characters must be correct to gain this mark).
PastPaper.question 13 · Subroutine Code Analysis
2 PastPaper.marks
The subroutine ValidateInput is used to validate a user's coordinate selection:

```python
def ValidateInput(Choice):
IsValid = False
if len(Choice) == 3:
FirstChar = Choice[0]
Digits = Choice[1:3]
if FirstChar >= "A" and FirstChar <= "F":
if Digits.isdigit():
Num = int(Digits)
if Num >= 10 and Num <= 50:
IsValid = True
return IsValid
```

State the exact range of string inputs that will cause this subroutine to return True.
PastPaper.showAnswers

PastPaper.workedSolution

The validation rules checked by the nested if statements are:
1. The length of the string Choice must be exactly 3 characters.
2. The first character (Choice[0]) must be an uppercase letter between 'A' and 'F' inclusive.
3. The remaining two characters (Choice[1:3]) must be numeric digits representing an integer between 10 and 50 inclusive.

PastPaper.markingScheme

1 mark: Identifies that the string must start with an uppercase letter from A to F (inclusive).
1 mark: Identifies that the string must end with a two-digit integer in the range 10 to 50 (inclusive) and be exactly 3 characters in length.

Paper 1 Section C

Spend approximately 60 minutes on this section. Load the Skeleton Program and make functional changes. Save and capture screenshots of test outputs.
9 PastPaper.question · 29.800000000000004 PastPaper.marks
PastPaper.question 1 · modification
2.5 PastPaper.marks
The Skeleton Program contains a subroutine `CalculateScore` designed to calculate a player's final score:

```python
def CalculateScore(LevelsCompleted, BonusPoints):
Score = (LevelsCompleted * 100) + BonusPoints
return Score
```

Modify the `CalculateScore` subroutine so that:
1. If `LevelsCompleted` is strictly greater than 5, an extra 500 points is added to the final score.
2. If the final calculated score is negative (less than 0), the subroutine returns 0.

Test the modified subroutine with the following inputs and record the outputs:
- Test 1: `LevelsCompleted = 6`, `BonusPoints = -700`
- Test 2: `LevelsCompleted = 4`, `BonusPoints = -500`
PastPaper.showAnswers

PastPaper.workedSolution

To complete the modification, we update the `CalculateScore` function with conditional statements.

```python
def CalculateScore(LevelsCompleted, BonusPoints):
Score = (LevelsCompleted * 100) + BonusPoints
if LevelsCompleted > 5:
Score += 500
if Score < 0:
Score = 0
return Score
```

**Walkthrough of Tests:**
- **Test 1:** `CalculateScore(6, -700)`
- Initial score = \(6 \times 100 + (-700) = -100\).
- Since `LevelsCompleted` (6) is greater than 5, add 500 points: \(-100 + 500 = 400\).
- The score is not negative, so the function returns `400`.
- **Test 2:** `CalculateScore(4, -500)`
- Initial score = \(4 \times 100 + (-500) = -100\).
- Since `LevelsCompleted` (4) is not greater than 5, no bonus is added.
- The score is negative (\(-100 < 0\)), so it is adjusted to `0` and the function returns `0`.

PastPaper.markingScheme

- **1 Mark:** Correct conditional check for `LevelsCompleted > 5` and correctly adding 500 to the score.
- **1 Mark:** Correct conditional check to ensure that if `Score < 0`, the score is set to 0 (or 0 is returned).
- **0.5 Marks:** Providing correct test outputs: `400` for Test 1 and `0` for Test 2.
PastPaper.question 2 · modification
2.5 PastPaper.marks
The Skeleton Program contains a subroutine `ValidateMove` that checks if a target position is within the boundaries of an \(8 \times 8\) grid game board:

```python
def ValidateMove(CurrentRow, CurrentCol, NewRow, NewCol, BoardSize):
if NewRow < 0 or NewRow >= BoardSize or NewCol < 0 or NewCol >= BoardSize:
return False
return True
```

Modify this subroutine to also check that the move is valid according to the following rule:
- The player must move exactly one square horizontally or vertically. Diagonal moves are not allowed, and the player cannot remain on the same square. (Hint: The sum of the absolute difference in Row coordinates and the absolute difference in Column coordinates must equal exactly 1).

Test your modified subroutine with a `BoardSize` of 8 and the following inputs:
- Test 1: `CurrentRow = 3`, `CurrentCol = 4`, `NewRow = 4`, `NewCol = 4`
- Test 2: `CurrentRow = 3`, `CurrentCol = 4`, `NewRow = 4`, `NewCol = 5`
PastPaper.showAnswers

PastPaper.workedSolution

To implement the required check, we calculate the absolute differences of the row and column coordinates using python's built-in `abs()` function, sum them, and verify if the result is equal to 1.

```python
def ValidateMove(CurrentRow, CurrentCol, NewRow, NewCol, BoardSize):
if NewRow < 0 or NewRow >= BoardSize or NewCol < 0 or NewCol >= BoardSize:
return False

# Check that the move is exactly one step horizontally or vertically
RowDiff = abs(NewRow - CurrentRow)
ColDiff = abs(NewCol - CurrentCol)
if (RowDiff + ColDiff) != 1:
return False

return True
```

**Walkthrough of Tests:**
- **Test 1:** `ValidateMove(3, 4, 4, 4, 8)`
- Row boundary check passes.
- `abs(4 - 3) + abs(4 - 4) = 1 + 0 = 1`. This equals 1, so the function returns `True`.
- **Test 2:** `ValidateMove(3, 4, 4, 5, 8)`
- Row boundary check passes.
- `abs(4 - 3) + abs(5 - 4) = 1 + 1 = 2`. This does not equal 1 (it is a diagonal move), so the function returns `False`.

PastPaper.markingScheme

- **1 Mark:** Correct implementation of computing absolute differences for both rows and columns (e.g., using `abs()`).
- **1 Mark:** Correct logic to check that the sum of differences equals 1 (or returning `False` if it does not equal 1).
- **0.5 Marks:** Providing correct test outputs: `True` for Test 1 and `False` for Test 2.
PastPaper.question 3 · Subroutine Validation implementation (Code & Test)
3 PastPaper.marks
Spend approximately 60 minutes on this section. Load the Skeleton Program and make functional changes. Save and capture screenshots of test outputs.

The Skeleton Program contains a stub subroutine `IsValidMove(Move)` which currently returns `True` for any input.

Modify the `IsValidMove` subroutine so that it validates the move string according to the following rules:
1. The input string must be exactly three characters in length.
2. The first character must be an uppercase letter between 'A' and 'H' inclusive.
3. The second character must be a comma (',').
4. The third character must be a digit between '1' and '8' inclusive.

If the input is valid, the subroutine must return `True`, otherwise it must return `False`.

**Test your code:**
- Run the program and test with the input `"A,9"` (should return `False` / show invalid).
- Run the program and test with the input `"C,4"` (should return `True` / show valid).
PastPaper.showAnswers

PastPaper.workedSolution

An example implementation in Python:

```python
def IsValidMove(Move):
if len(Move) != 3:
return False
if not ('A' <= Move[0] <= 'H'):
return False
if Move[1] != ',':
return False
if not ('1' <= Move[2] <= '8'):
return False
return True
```

When testing, entering `"A,9"` fails because the third character `9` is out of range, returning `False`.
Entering `"C,4"` succeeds because all conditions are met, returning `True`.

PastPaper.markingScheme

- **1 mark:** Correctly checks that the string length is exactly 3 and the second character is a comma (',').
- **1 mark:** Correctly checks that the first character is between 'A' and 'H' inclusive and the third character is between '1' and '8' inclusive.
- **1 mark:** Correct screenshot or text proof showing `"A,9"` fails and `"C,4"` passes.
PastPaper.question 4 · Subroutine Validation implementation (Code & Test)
3 PastPaper.marks
Spend approximately 60 minutes on this section. Load the Skeleton Program and make functional changes. Save and capture screenshots of test outputs.

The Skeleton Program contains a stub subroutine `IsValidPIN(PinText)` which currently returns `True` for any input.

Modify the `IsValidPIN` subroutine so that it validates the PIN string according to the following rules:
1. The PIN must consist of exactly 4 characters.
2. Each character must be a numeric digit ('0' to '9').
3. The PIN must not consist of four identical digits (e.g. "0000", "1111", etc., are invalid).

If the input is valid, the subroutine must return `True`, otherwise it must return `False`.

**Test your code:**
- Run the program and test with the input `"2222"` (should return `False` / show invalid).
- Run the program and test with the input `"1234"` (should return `True` / show valid).
PastPaper.showAnswers

PastPaper.workedSolution

An example implementation in Python:

```python
def IsValidPIN(PinText):
if len(PinText) != 4:
return False
for char in PinText:
if not ('0' <= char <= '9'):
return False
if PinText[0] == PinText[1] == PinText[2] == PinText[3]:
return False
return True
```

When testing, entering `"2222"` fails because all digits are identical, returning `False`.
Entering `"1234"` succeeds because all conditions are met, returning `True`.

PastPaper.markingScheme

- **1 mark:** Correctly checks that the length is exactly 4 and all characters are digits.
- **1 mark:** Correctly checks that the four digits are not all identical (e.g. by comparing indexes or utilizing a comparison loop/set).
- **1 mark:** Correct screenshot or text proof showing `"2222"` fails and `"1234"` passes.
PastPaper.question 5 · practical
2.5 PastPaper.marks
In a procedural skeleton program, a stack is represented using a global 1D array `MemoryStore` of size 12 (indices 0 to 11) and an integer pointer `SP` (Stack Pointer), which points to the current top of the stack. `SP` is initialized to -1.

Write a code snippet (in Python, C#, VB.Net or pseudo-code) for the pointer check that must be executed inside the `Push` subroutine before any item is added, to prevent writing beyond the memory limit of the array. If the limit is reached, it must print 'Error: Stack Full' and terminate the push operation.
PastPaper.showAnswers

PastPaper.workedSolution

To prevent a stack overflow, we must check if the stack pointer `SP` has reached the maximum index of the array (which is 11, since size is 12 and indices are 0 to 11) before incrementing it and inserting an item.

Example in Python:
```python
if SP >= 11:
print("Error: Stack Full")
return
```

Example in pseudo-code:
```
IF SP >= 11 THEN
OUTPUT "Error: Stack Full"
EXIT SUBROUTINE
ENDIF
```

PastPaper.markingScheme

- 1 mark: Correct conditional check to identify if the stack is full (e.g., `SP >= 11` or `SP == 11` or `SP + 1 > 11`).
- 1 mark: Outputs the exact string 'Error: Stack Full'.
- 0.5 marks: Correctly prevents further execution / modification of the stack (e.g. using `return`, `exit`, or wrapping the push logic in an `else` block).
PastPaper.question 6 · practical
2.5 PastPaper.marks
A FIFO queue is implemented in a skeleton program using a 1D array of size 15 (indices 0 to 14). The pointer `Head` points to the front of the queue, and `Tail` points to the next available empty slot at the end of the queue. The queue is empty when `Head` equals `Tail`.

A subroutine `Enqueue` adds an element at index `Tail` and increments `Tail`. To prevent a memory out-of-bounds error, write a pointer check to be placed at the start of the `Enqueue` subroutine that ensures `Tail` has not exceeded the array limit. If the limit is exceeded (i.e. `Tail` is 15), print 'Queue Full' and prevent the enqueue operation.

Provide your answer in Python, C#, VB.Net, or pseudo-code.
PastPaper.showAnswers

PastPaper.workedSolution

Since `Tail` represents the index of the next available slot, and the array has indices 0 to 14, a `Tail` value of 15 means there is no space left in the array (and writing to index 15 would cause an out-of-bounds exception).

Example in Python:
```python
if Tail >= 15:
print("Queue Full")
return
```

Example in pseudo-code:
```
IF Tail >= 15 THEN
OUTPUT "Queue Full"
EXIT SUBROUTINE
ENDIF
```

PastPaper.markingScheme

- 1 mark: Correct comparison checking if `Tail` is greater than or equal to 15 (or equal to 15).
- 1 mark: Outputs the exact string 'Queue Full'.
- 0.5 marks: Correctly structured control flow to prevent enqueuing when the condition is met.
PastPaper.question 7 · practical
4.6 PastPaper.marks
An AS Level Skeleton Program represents a grid-based puzzle game using an \(8 \times 8\) 2D array of characters called `Grid` (with indices from 0 to 7 representing both rows and columns).

You are required to write a new subroutine to rotate a column downwards.

Write a subroutine `RotateColumnDown(Grid, ColIndex)` in pseudocode or a high-level programming language of your choice that performs a circular shift downwards of the elements in the column specified by `ColIndex`.

Your subroutine must satisfy the following requirements:
1. The element at index 7 of the column must wrap around and move to index 0.
2. All other elements must shift down by one position (e.g., index 0 moves to index 1, index 1 moves to index 2, etc.).
3. The array must be modified in-place, or the fully updated array must be returned.
PastPaper.showAnswers

PastPaper.workedSolution

To shift a column downwards, we must perform the following logical steps:
1. Save the bottom-most element (`Grid[7][ColIndex]`) into a temporary variable (`Temp`) so that it is not overwritten during shifting.
2. Iterate backwards from index 6 down to index 0.
3. In each iteration, copy the value of the current cell to the cell directly below it: `Grid[RowIndex + 1][ColIndex] = Grid[RowIndex][ColIndex]`.
4. Finally, assign the saved temporary value to the top-most cell at index 0: `Grid[0][ColIndex] = Temp`.

PastPaper.markingScheme

Marks are awarded as follows:
- 1.6 marks: Correctly storing the bottom-most cell (`Grid[7][ColIndex]`) in a temporary variable before any shifts occur.
- 1.5 marks: Loop structure that moves backwards from index 6 down to 0, shifting values down without overwriting data.
- 1.5 marks: Correctly placing the temporary value at the top of the column (`Grid[0][ColIndex]`).
PastPaper.question 8 · practical
4.6 PastPaper.marks
The following subroutine `FindHiddenItems(Grid)` is designed to scan an \(8 \times 8\) 2D array representing a game board and return the count of hidden items represented by the character `'*'` that are surrounded on all four cardinal directions (North, South, East, West) by empty spaces represented by `'.'`. Notice that the outer boundaries (rows 0, 7 and columns 0, 7) are not evaluated as candidate centers.

```text
Subroutine FindHiddenItems(Grid)
Count = 0
For R = 1 To 6
For C = 1 To 6
If Grid[R][C] == '*' Then
If Grid[R-1][C] == '.' And Grid[R+1][C] == '.' And Grid[R][C-1] == '.' And Grid[R][C+1] == '.' Then
Count = Count + 1
EndIf
EndIf
EndFor
EndFor
Return Count
EndSubroutine
```

Trace the execution of this subroutine on the following \(8 \times 8\) grid slice and state:
1. The coordinates `(Row, Col)` of any cells containing `'*'` that are evaluated by the inner conditional statement.
2. The final value of `Count` returned by the subroutine.

Grid state:
```text
Row 0: . . . . . . . .
Row 1: . . * . . * . .
Row 2: . * * * . . . .
Row 3: . . * . . . . .
Row 4: . . . . * . . .
Row 5: . . . * * * . .
Row 6: . . . . * . . .
Row 7: . . . . . . . .
```
All elements not explicitly shown with `'*'` are `'.'`.
PastPaper.showAnswers

PastPaper.workedSolution

Let's list all indices where '*' exists and determine if they are inside the inner loop range of rows 1 to 6 and columns 1 to 6:
- (1, 2): Checked. North is (0, 2) which is '.', but South is (2, 2) which is '*'. Not counted.
- (1, 5): Checked. North (0, 5), South (2, 5), West (1, 4), and East (1, 6) are all '.'. Count increments to 1.
- (2, 1): Checked. East is (2, 2) which is '*'. Not counted.
- (2, 2): Checked. All cardinal directions are '*'. Not counted.
- (2, 3): Checked. West is (2, 2) which is '*'. Not counted.
- (3, 2): Checked. North is (2, 2) which is '*'. Not counted.
- (4, 4): Checked. South is (5, 4) which is '*'. Not counted.
- (5, 3): Checked. East is (5, 4) which is '*'. Not counted.
- (5, 4): Checked. All cardinal directions are '*'. Not counted.
- (5, 5): Checked. West is (5, 4) which is '*'. Not counted.
- (6, 4): Checked. North is (5, 4) which is '*'. Not counted.

Therefore, only (1, 5) meets the criteria. The final count is 1.

PastPaper.markingScheme

Marks are awarded as follows:
- 2.6 marks: Correctly identifying all coordinates evaluated inside the nested loop containing '*' (allow minor transcription omissions if the methodology is demonstrated).
- 2.0 marks: Correctly calculating the final count as 1.
PastPaper.question 9 · practical
4.6 PastPaper.marks
An AS Level game Skeleton Program stores players' names and scores in a 2D array of size 100 called `PlayerData`. Each row of the array contains the player's name at index 0 (as a string) and their high score at index 1 (stored as a string, e.g., `"85"`).

Write a subroutine `GetWinnerName(PlayerData, NumPlayers)` in pseudocode or a high-level programming language of your choice. It must search through the first `NumPlayers` elements of the array and return the name of the player with the highest numerical score.

If there is a tie for the highest score, the subroutine must return the name of the player who appears first in the array.
PastPaper.showAnswers

PastPaper.workedSolution

The subroutine must:
1. Initialize `MaxScore` to an impossibly low score, such as -1.
2. Loop from index `0` up to `NumPlayers - 1` to examine each active player record.
3. Convert the score string at `PlayerData[I][1]` to an integer to ensure numerical comparison (e.g., so that `"100"` is recognized as greater than `"95"`).
4. Use a strict inequality comparison (`CurrentScore > MaxScore`) to ensure that if a subsequent player has an identical high score, the first player remains the winner.
5. Keep track of the winner's name and return it after the loop finishes.

PastPaper.markingScheme

Marks are awarded as follows:
- 1.6 marks: Correctly setting up a search loop from index 0 to `NumPlayers - 1` and converting scores from strings to integers.
- 1.5 marks: Implementing a strict greater-than comparison (`>`) to handle ties correctly (first player wins).
- 1.5 marks: Successfully updating and returning the name associated with the maximum score found.

Paper 2 Written Theory

Time allowed: 1 hour 30 minutes. Answer all questions in the spaces provided. Calculators are allowed.
38 PastPaper.question · 78.70000000000002 PastPaper.marks
PastPaper.question 1 · multiple_choice
1 PastPaper.marks
Which of the following numbers is an element of the set of rational numbers (\(\mathbb{Q}\)) but is NOT an element of the set of integers (\(\mathbb{Z}\))?
  1. A.\(-4\)
  2. B.\(\sqrt{3}\)
  3. C.\(-\frac{3}{4}\)
  4. D.\(0\)
PastPaper.showAnswers

PastPaper.workedSolution

The set of rational numbers \(\mathbb{Q}\) consists of any number that can be expressed as a fraction \(\frac{a}{b}\) where \(a\) and \(b\) are integers and \(b \neq 0\). The set of integers \(\mathbb{Z}\) consists of whole numbers (positive, negative, and zero). The fraction \(-\frac{3}{4}\) is rational because it is a ratio of two integers, but it is not an integer. Therefore, option C is correct.

PastPaper.markingScheme

1 mark: Correct choice selected (C).
PastPaper.question 2 · multiple_choice
1 PastPaper.marks
Which of the following correctly describes the relationship (using subset notation) between the set of Natural Numbers (\(\mathbb{N}\)), the set of Integers (\(\mathbb{Z}\)), and the set of Rational Numbers (\(\mathbb{Q}\)) as defined in the AQA syllabus?
  1. A.\(\mathbb{N} \subset \mathbb{Z} \subset \mathbb{Q}\)
  2. B.\(\mathbb{Z} \subset \mathbb{N} \subset \mathbb{Q}\)
  3. C.\(\mathbb{Q} \subset \mathbb{Z} \subset \mathbb{N}\)
  4. D.\(\mathbb{N} \subset \mathbb{Q} \subset \mathbb{Z}\)
PastPaper.showAnswers

PastPaper.workedSolution

Every natural number is also an integer, and every integer can be represented as a rational number (by writing it over 1). Therefore, the set of natural numbers is a subset of integers, which is a subset of rational numbers. This is written as \(\mathbb{N} \subset \mathbb{Z} \subset \mathbb{Q}\).

PastPaper.markingScheme

1 mark: Correct choice selected (A).
PastPaper.question 3 · multiple_choice
1 PastPaper.marks
According to the AQA Computer Science specification, which of the following represents the correct set of elements for the Natural numbers (\(\mathbb{N}\))?
  1. A.\(\{1, 2, 3, 4, ...\}\)
  2. B.\(\{0, 1, 2, 3, ...\}\)
  3. C.\(\{..., -2, -1, 0, 1, 2, ...\}\)
  4. D.\(\{0, 0.5, 1, 1.5, 2, ...\}\)
PastPaper.showAnswers

PastPaper.workedSolution

The AQA Computer Science specification explicitly includes zero in the set of natural numbers, defining it as \(\mathbb{N} = \{0, 1, 2, 3, ...\}\).

PastPaper.markingScheme

1 mark: Correct choice selected (B).
PastPaper.question 4 · multiple_choice
1 PastPaper.marks
A student is reviewing real and irrational numbers. Which of the following statements about the set of Real numbers (\(\mathbb{R}\)) is correct?
  1. A.All real numbers can be represented exactly using a finite number of binary bits.
  2. B.The set of Real numbers contains only numbers that can be written as a fraction \(\frac{a}{b}\) where \(a\) and \(b\) are integers.
  3. C.The set of Real numbers (\(\mathbb{R}\)) is the union of the set of Rational numbers (\(\mathbb{Q}\)) and the set of Irrational numbers.
  4. D.Real numbers exclude all negative values.
PastPaper.showAnswers

PastPaper.workedSolution

The set of Real numbers (\(\mathbb{R}\)) comprises all possible real-world quantities, which can be subdivided into rational numbers (\(\mathbb{Q}\)) and irrational numbers. The union of these two disjoint subsets represents the entire set of Real numbers.

PastPaper.markingScheme

1 mark: Correct choice selected (C).
PastPaper.question 5 · multiple_choice
1 PastPaper.marks
To which of the following sets of numbers does the mathematical constant \(\pi\) (pi) belong?
  1. A.\(\mathbb{Z}\) only
  2. B.\(\mathbb{Q}\) and \(\mathbb{R}\)
  3. C.\(\mathbb{R}\) but not \(\mathbb{Q}\)
  4. D.\(\mathbb{N}\) and \(\mathbb{Z}\)
PastPaper.showAnswers

PastPaper.workedSolution

\(\pi\) is an irrational number because its decimal representation is non-terminating and non-recurring. Because it cannot be written as a fraction of two integers, it is not a member of \(\mathbb{Q}\). However, it represents a real-world quantity, meaning it is a member of the set of Real numbers (\(\mathbb{R}\)).

PastPaper.markingScheme

1 mark: Correct choice selected (C).
PastPaper.question 6 · short_answer
1 PastPaper.marks
Convert the hexadecimal number \(\text{D4}_{16}\) into an 8-bit unsigned binary representation.
PastPaper.showAnswers

PastPaper.workedSolution

To convert the hexadecimal value \(\text{D4}\) to binary, convert each hexadecimal digit into a 4-bit binary nibble. First, \(\text{D}_{16}\) is equal to decimal 13, which is represented in binary as \(1101_2\). Second, \(4_{16}\) is equal to decimal 4, which is represented in binary as \(0100_2\). Concatenating these two nibbles yields the final 8-bit binary number: \(11010100_2\).

PastPaper.markingScheme

1 mark for the correct 8-bit binary value: 11010100.
PastPaper.question 7 · short_answer
1 PastPaper.marks
Convert the 8-bit unsigned binary integer \(10101111_2\) to its hexadecimal representation.
PastPaper.showAnswers

PastPaper.workedSolution

To convert the binary sequence \(10101111_2\) to hexadecimal, divide the byte into two 4-bit nibbles. The most significant nibble is \(1010_2\), which represents decimal 10 or hexadecimal \(\text{A}\). The least significant nibble is \(1111_2\), which represents decimal 15 or hexadecimal \(\text{F}\). Joining these two values results in the hexadecimal representation \(\text{AF}_{16}\).

PastPaper.markingScheme

1 mark for the correct hexadecimal representation: AF (also accept af, 0xAF, or AF base 16).
PastPaper.question 8 · Binary Mathematics (Arithmetic, Ranges, Fixed-point)
1.4 PastPaper.marks
An 8-bit signed two's complement fixed-point binary representation uses 4 bits for the integer part (including the sign bit) and 4 bits for the fractional part. Convert the binary pattern \(1101.1010\) into its denary representation. Show your working.
PastPaper.showAnswers

PastPaper.workedSolution

1. Identify the positional weights for each bit of \(1101.1010\):
- Integer part (left of binary point): \(-2^3 = -8\), \(2^2 = 4\), \(2^1 = 2\), \(2^0 = 1\).
- Fractional part (right of binary point): \(2^{-1} = 0.5\), \(2^{-2} = 0.25\), \(2^{-3} = 0.125\), \(2^{-4} = 0.0625\).

2. Multiply each bit by its respective positional weight:
- \(-8 \times 1 = -8\)
- \(4 \times 1 = 4\)
- \(2 \times 0 = 0\)
- \(1 \times 1 = 1\)
- \(0.5 \times 1 = 0.5\)
- \(0.25 \times 0 = 0\)
- \(0.125 \times 1 = 0.125\)
- \(0.0625 \times 0 = 0\)

3. Calculate the sum of these values:
\(-8 + 4 + 0 + 1 + 0.5 + 0 + 0.125 + 0 = -3 + 0.625 = -2.375\).

PastPaper.markingScheme

1 Mark: Correct assignment of negative weight to the sign bit and fractional binary weights, showing sum calculation.
0.4 Marks: Correct final denary answer (-2.375 or -2 and 3/8).
PastPaper.question 9 · Binary Mathematics (Arithmetic, Ranges, Fixed-point)
1.4 PastPaper.marks
Perform the binary addition of the following two 8-bit signed two's complement binary numbers:

\(01011100_2 + 01001010_2\)

State whether arithmetic overflow has occurred, and explain your reasoning with reference to both the binary carries and the denary equivalent values of the inputs and the result.
PastPaper.showAnswers

PastPaper.workedSolution

1. Perform the binary addition:
```
01011100
+ 01001010
----------
10100110
```

2. Analyze carries at the most significant bit (MSB):
- There is a carry into the sign bit (MSB) from the previous column (bit 6 to bit 7).
- There is no carry out of the sign bit (MSB).
- Because the carry-in and carry-out of the MSB differ, an overflow condition has occurred.

3. Verify using denary equivalents:
- \(01011100_2 = 92_{10}\)
- \(01001010_2 = 74_{10}\)
- The theoretical sum is \(92 + 74 = 166_{10}\).
- The maximum positive value representable in an 8-bit signed two's complement system is \(2^7 - 1 = +127\).
- Since \(166 > 127\), the range is exceeded, resulting in a wrap-around to a negative value (\(10100110_2 = -90_{10}\)).

PastPaper.markingScheme

0.5 Marks: Correct binary sum result (10100110).
0.5 Marks: Clear explanation of overflow using either binary carries (carry-in differs from carry-out at sign bit) or denary range limits (expected 166 exceeds maximum 127).
0.4 Marks: Correctly stating that overflow has occurred.
PastPaper.question 10 · Binary Mathematics (Arithmetic, Ranges, Fixed-point)
1.4 PastPaper.marks
An 8-bit signed two's complement fixed-point binary representation has \(I\) integer bits (including the sign bit) and \(F\) fractional bits.

Given that the minimum (most negative) representable value in this system is exactly \(-8\):
1. State the number of integer bits, \(I\), and fractional bits, \(F\).
2. Calculate the maximum positive value representable in this system, writing your answer as a denary decimal.
PastPaper.showAnswers

PastPaper.workedSolution

1. In an 8-bit signed two's complement fixed-point representation, the minimum value is represented by the binary pattern where the MSB (sign bit) is 1 and all other bits are 0 (`10000000`).
- The value of this minimum representation is equal to the weight of the MSB: \(-2^{I-1} = -8\).
- Solving for \(I\): \(I - 1 = 3 \Rightarrow I = 4\) integer bits.
- Since \(I + F = 8\), the number of fractional bits \(F = 8 - 4 = 4\).

2. The maximum positive value occurs when the sign bit is 0 and all other bits are 1 (`0111.1111`):
- Positional weights: \(4, 2, 1, 0.5, 0.25, 0.125, 0.0625\).
- Sum: \(4 + 2 + 1 + 0.5 + 0.25 + 0.125 + 0.0625 = 7.9375\).
- Alternatively, calculated as \(8 - 2^{-4} = 8 - 0.0625 = 7.9375\).

PastPaper.markingScheme

0.5 Marks: Correct determination that \(I = 4\) and \(F = 4\).
0.5 Marks: Correct method for determining the maximum positive value (summing binary weights or subtracting LSB from 8).
0.4 Marks: Correct maximum positive value of 7.9375.
PastPaper.question 11 · Binary Mathematics (Arithmetic, Ranges, Fixed-point)
1.4 PastPaper.marks
Using 8-bit signed two's complement binary representation, perform the subtraction \(23_{10} - 45_{10}\) by converting both numbers to 8-bit binary, finding the two's complement of the subtrahend (\(45\)), and then performing binary addition. Show your working.
PastPaper.showAnswers

PastPaper.workedSolution

1. Convert \(23_{10}\) to 8-bit binary:
- \(23 = 16 + 4 + 2 + 1 \Rightarrow 00010111_2\).

2. Convert \(45_{10}\) to 8-bit binary:
- \(45 = 32 + 8 + 4 + 1 \Rightarrow 00101101_2\).

3. Find the two's complement of \(45\) to represent \(-45\):
- Invert the bits of \(00101101_2\) to get \(11010010_2\).
- Add 1 to get \(11010011_2\).

4. Add the binary representations: \(23 + (-45)\):
```
00010111 (23)
+ 11010011 (-45)
------------
11101010 (-22)
```
- Check: \(11101010_2 = -128 + 64 + 32 + 8 + 2 = -22_{10}\), which matches \(23 - 45 = -22\).

PastPaper.markingScheme

0.5 Marks: Correct binary patterns for 23 (00010111) and -45 (11010011).
0.5 Marks: Correct binary addition process showing carries.
0.4 Marks: Correct final 8-bit binary pattern (11101010).
PastPaper.question 12 · Binary Mathematics (Arithmetic, Ranges, Fixed-point)
1.4 PastPaper.marks
A programmer uses an unsigned 8-bit fixed-point binary representation with 5 bits for the integer part and 3 bits for the fractional part to represent real numbers.

They attempt to store the denary value \(12.4\) in this system.

1. State the closest representable binary value in this 8-bit system.
2. Calculate the absolute error introduced by this representation, writing your final answer as a denary decimal.
PastPaper.showAnswers

PastPaper.workedSolution

1. Establish the positional weights of the 8-bit fixed-point system:
- Integer weights: \(16, 8, 4, 2, 1\).
- Fractional weights: \(0.5, 0.25, 0.125\).

2. Represent the integer part (12):
- \(12 = 8 + 4 \Rightarrow 01100_2\).

3. Determine the closest approximation for the fractional part (0.4):
- Possible 3-bit fractional combinations:
- `011` \(= 0.25 + 0.125 = 0.375\). Absolute error: \(|12.4 - 12.375| = 0.025\).
- `100` \(= 0.5\). Absolute error: \(|12.4 - 12.5| = 0.100\).
- The closest representation is \(12.375\), which corresponds to the binary pattern `01100.011` (or `01100011` without the point).

4. Calculate the absolute error:
- \(|12.4 - 12.375| = 0.025\).

PastPaper.markingScheme

0.5 Marks: Correct binary pattern of the closest value (01100011 or 01100.011).
0.5 Marks: Correct working comparing the errors of the two nearest representable values (12.375 and 12.5).
0.4 Marks: Correct absolute error value of 0.025.
PastPaper.question 13 · Error correction & transmission (Majority vs Parity)
1.3 PastPaper.marks
A data communication system can use either a parity bit check or a majority voting system (where each bit is transmitted three times) to detect or correct transmission errors. State one major disadvantage of using the majority voting system compared to the parity bit system.
PastPaper.showAnswers

PastPaper.workedSolution

In a 3-bit majority voting system, every single bit is transmitted three times, meaning the total number of transmitted bits is tripled (an overhead of 200%). In contrast, a parity bit system only adds one extra bit per byte or character, resulting in a much smaller overhead (typically 12.5%). This means majority voting is far less efficient and requires much more bandwidth.

PastPaper.markingScheme

1.3 marks total. Award full marks for identifying that majority voting has a much larger transmission overhead, uses significantly more bandwidth, or is less efficient because 3 times as many bits need to be transmitted compared to just one extra parity bit. Reject answers that do not compare the two or only state that parity has 1 bit without referencing the relative efficiency/overhead.
PastPaper.question 14 · Error correction & transmission (Majority vs Parity)
1.3 PastPaper.marks
A 3-bit majority voting scheme is used to transmit data over a noisy channel. The receiver receives the following 12-bit sequence, which represents a 4-bit message where each original bit has been sent three times: 101 000 110 011. Reconstruct the original 4-bit binary message after applying majority voting error correction.
PastPaper.showAnswers

PastPaper.workedSolution

We divide the 12-bit sequence into four 3-bit blocks: Block 1: 101 -> majority is 1. Block 2: 000 -> majority is 0. Block 3: 110 -> majority is 1. Block 4: 011 -> majority is 1. Combining these results gives the corrected 4-bit message: 1011.

PastPaper.markingScheme

1.3 marks for the correct 4-bit binary sequence '1011'. Award 0.5 marks if there is a single bit error in the final answer (e.g., 1010 or 1111) showing correct process for at least three blocks.
PastPaper.question 15 · Error correction & transmission (Majority vs Parity)
1.3 PastPaper.marks
Explain why a single parity bit can only detect a single-bit error but cannot correct it, whereas a 3-bit majority voting system can both detect and correct a single-bit error.
PastPaper.showAnswers

PastPaper.workedSolution

A parity check calculates whether the total count of 1s matches the expected even or odd parity. If one bit flips, the parity changes, which alerts the receiver that an error occurred, but it gives no information about which specific bit position was corrupted. Thus, correction is impossible without retransmission. In a 3-bit majority voting system, each bit position is evaluated independently because three copies of each bit are received. If one of the three copies is corrupted (e.g., 1 becomes 0, resulting in 101), the receiver can see that 1 is the majority, identifying the exact position of the error and correcting the 0 back to a 1.

PastPaper.markingScheme

1.3 marks total: Award 0.5 marks for explaining that parity only checks the overall count of 1s or lacks positional information to locate the corrupted bit. Award 0.8 marks for explaining that majority voting compares three copies of each individual bit to identify the outlier/minority bit and automatically correct it to match the majority.
PastPaper.question 16 · written
1.6 PastPaper.marks
Explain how sampling rate and sample resolution affect the fidelity of a digitized audio signal, and explain the significance of the Nyquist theorem when digitizing an analog audio wave containing frequencies up to \(18\text{ kHz}\).
PastPaper.showAnswers

PastPaper.workedSolution

1. **Sampling Rate**: Determines how often the sound amplitude is measured. A higher rate means more frequent samples, capturing higher frequencies and preserving the shape of the sound wave.
2. **Sample Resolution**: The number of bits allocated per sample. A higher resolution means more precise volume/amplitude measurements, reducing quantization noise.
3. **Nyquist Theorem**: States that the sampling rate must be at least double the highest frequency in the analogue signal to avoid aliasing.
4. **Calculation**: For a max frequency of \(18\text{ kHz}\), the minimum sampling rate required is \(36\text{ kHz}\) (\(18\text{ kHz} \times 2\)).

PastPaper.markingScheme

- **0.4 marks**: Clearly explaining how increasing the sampling rate increases accuracy/frequency fidelity.
- **0.4 marks**: Explaining how increasing sample resolution reduces quantization error/noise.
- **0.4 marks**: Stating the Nyquist theorem (sampling rate must be at least twice the highest frequency).
- **0.4 marks**: Showing correct application to the scenario: \(2 \times 18\text{ kHz} = 36\text{ kHz}\) minimum sampling rate required.
PastPaper.question 17 · written
1.6 PastPaper.marks
A medical scanner produces high-resolution X-ray images. Compare the suitability of lossy and lossless compression techniques for storing these medical images.
PastPaper.showAnswers

PastPaper.workedSolution

Lossy compression algorithms achieve smaller file sizes by identifying and permanently discarding non-essential details that the human eye might not easily notice. Lossless compression algorithms reduce file size by finding patterns (like redundant data) and encoding them without losing any original binary information.

In medical imaging, lossless compression is necessary because:
1. Even minor artifacts or slight blurring of edges caused by lossy compression could obscure tiny anomalies, leading to misdiagnosis.
2. Legal and ethical frameworks often require medical records to be stored without any degradation of original quality.

PastPaper.markingScheme

- **0.4 marks**: Defining lossy compression (permanently discards data, higher compression ratio).
- **0.4 marks**: Defining lossless compression (reconstructs original image exactly without data loss).
- **0.4 marks**: Linking lossless compression to the critical nature of medical imaging (no loss of vital diagnostic details).
- **0.4 marks**: Explaining why lossy compression is dangerous/unsuitable here (loss of data, potential for artifacts to cause misdiagnosis).
PastPaper.question 18 · written
1.6 PastPaper.marks
A black-and-white grid image is represented using 0 for black pixels and 1 for white pixels. The first line of the image is: \(0\ 0\ 0\ 0\ 0\ 0\ 0\ 0\ 0\ 0\ 0\ 1\ 1\ 1\ 1\ 1\).

1. Represent this line using Run-Length Encoding (RLE) where each run is represented as a pair: `(color, count)`.
2. Assuming the original uncompressed line used 1 bit per pixel, and the RLE format uses 1 bit for color and 4 bits for count per run, calculate the compression ratio achieved for this line (round to 1 decimal place).
PastPaper.showAnswers

PastPaper.workedSolution

1. **Identify the runs**:
- Run 1: Eleven '0's -> `(0, 11)`
- Run 2: Five '1's -> `(1, 5)`

2. **Calculate original file size**:
- 16 pixels \(\times\) 1 bit/pixel = 16 bits

3. **Calculate compressed file size**:
- Each run needs: 1 bit (color) + 4 bits (count) = 5 bits.
- Total runs = 2.
- Compressed size = \(2 \times 5\text{ bits} = 10\text{ bits}\).

4. **Calculate compression ratio**:
- \(\text{Original Size} / \text{Compressed Size} = 16 / 10 = 1.6\) (or \(1.6:1\)).

PastPaper.markingScheme

- **0.4 marks**: Correctly identifying the two runs as `(0, 11)` and `(1, 5)` (or equivalent format).
- **0.4 marks**: Showing that the original uncompressed size is 16 bits.
- **0.4 marks**: Showing that the compressed size is 10 bits based on 5 bits per run.
- **0.4 marks**: Correctly calculating the compression ratio as 1.6 (or 1.6:1).
PastPaper.question 19 · written
1.6 PastPaper.marks
Describe two fundamental differences between vector graphics and bitmap images, and explain why a vector graphic format is preferred for a company logo.
PastPaper.showAnswers

PastPaper.workedSolution

1. **Structure**: Bitmaps map every individual pixel to a specific color value. Vectors store mathematical formulas/properties (e.g., radius, stroke weight, start/end points).
2. **Scalability**: Scaling a bitmap requires the software to interpolate or stretch existing pixels, causing pixelation. Scaling a vector simply requires multiplying the mathematical coordinates by a scale factor, keeping the edges perfectly sharp.
3. **Logo Use Case**: Since logos must appear on different media (websites, letterheads, merchandise, banners), vectors provide the ultimate versatility of lossless scaling and typically require less storage space for simple shapes.

PastPaper.markingScheme

- **0.4 marks**: Identifying that bitmaps are pixel-based while vectors are mathematically/shape-based.
- **0.4 marks**: Stating that vectors scale losslessly/infinitely while bitmaps suffer from pixelation/quality loss.
- **0.4 marks**: Explaining the requirement of scaling a company logo to various sizes (e.g., from small screens to huge billboards).
- **0.4 marks**: Linking this scaling requirement directly to vector graphics' ability to maintain perfect sharpness/low file size for flat graphic shapes.
PastPaper.question 20 · written
1.6 PastPaper.marks
A digital camera captures an uncompressed image with a resolution of \(3000 \times 2000\) pixels and a color depth of 24 bits.

1. Calculate the minimum file size of the image payload in mebibytes (MiB). Show your working and round your final answer to two decimal places.
2. State two examples of metadata that would typically be saved within the image file header.
PastPaper.showAnswers

PastPaper.workedSolution

1. **Calculate total pixels**:
\(3000 \times 2000 = 6,000,000\text{ pixels}\)

2. **Calculate total bytes**:
\(6,000,000 \times 24\text{ bits} = 144,000,000\text{ bits}\)
\(144,000,000 / 8 = 18,000,000\text{ Bytes}\)

3. **Convert to MiB (binary-based, \(2^{20}\))**:
\(18,000,000 / 1024 = 17578.125\text{ KiB}\)
\(17578.125 / 1024 \approx 17.16613769\text{ MiB}\)
Rounding to 2 decimal places gives **17.17 MiB**.

4. **Metadata Examples**:
Any two valid examples of image metadata, such as camera model, date/time, GPS coordinates, shutter speed, aperture, exposure time, or color space.

PastPaper.markingScheme

- **0.4 marks**: Calculating the total bytes correctly (\(18,000,000\text{ bytes}\)).
- **0.4 marks**: Converting to MiB by dividing by \(1024^2\) or \(1,048,576\) correctly to yield \(17.17\text{ MiB}\) (accept 17.17 or 17.2).
- **0.4 marks**: Identifying a first valid metadata item (e.g., camera model, date/time).
- **0.4 marks**: Identifying a second valid metadata item (e.g., aperture, GPS location, resolution, exposure settings).
PastPaper.question 21 · short_answer
4 PastPaper.marks
A software developer writes a program in a compiled high-level language. The program imports and uses several subroutines from an external pre-compiled library. Describe the roles of the linker and the loader in enabling these library subroutines to be executed as part of the program. You should refer to both static and dynamic linking in your answer.
PastPaper.showAnswers

PastPaper.workedSolution

Linker: The linker combines the compiled object code of the main program with the object code of the external library. It resolves external references, ensuring that subroutine calls point to the correct memory addresses of the imported library. In static linking, the library code is physically copied into the executable file. In dynamic linking, references are resolved at runtime. Loader: The loader is an operating system utility that copies the executable program from secondary storage into main memory (RAM) so the CPU can execute it. If dynamic linking is used, the loader also loads the required dynamic link libraries into RAM at runtime.

PastPaper.markingScheme

Award 1 mark per point up to a maximum of 4 marks. Point 1: Linker combines object files and external library code. Point 2: Linker resolves external references / memory addresses for subroutine calls. Point 3: Explains distinction between static linking (code compiled into executable) and dynamic linking (references resolved at runtime). Point 4: Loader copies the executable from secondary storage into main memory (RAM) for execution (and loads dynamic libraries if needed).
PastPaper.question 22 · short_answer
4 PastPaper.marks
A manufacturer is designing an embedded system to control a high-speed industrial sorting machine. The system requires precise, microsecond-level timing to activate mechanical actuators. The development team is deciding whether to write the control program in Assembly Language or in a high-level imperative language. State two advantages of using Assembly Language for this specific application, and explain one major disadvantage of using Assembly Language instead of a high-level language.
PastPaper.showAnswers

PastPaper.workedSolution

Advantages of Assembly Language: 1. Direct Hardware Control: Assembly allows the programmer to manipulate specific hardware registers, I/O ports, and memory addresses directly, which is crucial for controlling physical actuators. 2. Performance and Timing: Since assembly code translates 1-to-1 to machine code, there is no compiler overhead, allowing highly optimized code with predictable, microsecond-level timing. Disadvantage of Assembly Language: Lack of Portability: Assembly language is tied directly to a specific processor architecture. If the microcontroller is changed, the entire software must be rewritten. (Alternatively, complexity and long development time: It is much harder to write, debug, and maintain than high-level languages due to lack of structured abstractions).

PastPaper.markingScheme

Award up to 4 marks. For Advantages (Max 2 marks): 1 mark for identifying direct hardware/register access; 1 mark for explaining high speed / precise execution timing / low memory overhead. For Disadvantage (Max 2 marks): 1 mark for identifying a valid disadvantage (e.g., lack of portability, high complexity, or long development time); 1 mark for explaining this disadvantage in the context of the sorting machine project (e.g., rewriting code if processor changes, or increased chance of software bugs and higher development costs).
PastPaper.question 23 · written
3 PastPaper.marks
Simplify the following Boolean expression using Boolean algebra: \( Q = A \cdot \overline{B} \cdot \overline{C} + A \cdot B \cdot \overline{C} + A \cdot C \). Show all steps in your working.
PastPaper.showAnswers

PastPaper.workedSolution

Step 1: Factor out \( A \cdot \overline{C} \) from the first two terms: \( Q = A \cdot \overline{C} \cdot (\overline{B} + B) + A \cdot C \). Step 2: Apply the identity \( \overline{B} + B = 1 \), which simplifies the expression to: \( Q = A \cdot \overline{C} \cdot 1 + A \cdot C = A \cdot \overline{C} + A \cdot C \). Step 3: Factor out \( A \) from the remaining terms: \( Q = A \cdot (\overline{C} + C) \). Step 4: Apply the identity \( \overline{C} + C = 1 \), resulting in: \( Q = A \cdot 1 = A \).

PastPaper.markingScheme

1 mark: Correctly factoring out \( A \cdot \overline{C} \) or equivalent grouping. 1 mark: Correctly applying the identity \( \overline{X} + X = 1 \) to simplify the grouped expression to \( A \cdot \overline{C} + A \cdot C \) (or equivalent intermediate). 1 mark: Providing the final simplified answer of \( A \) with a complete and correct sequence of working.
PastPaper.question 24 · written
3 PastPaper.marks
Simplify the following Boolean expression using Boolean algebra: \( X = (A + B) \cdot (A + \overline{B}) \cdot C \). Show all steps in your working.
PastPaper.showAnswers

PastPaper.workedSolution

Step 1: Expand or simplify the first two terms: \( (A + B) \cdot (A + \overline{B}) \). Using the distributive law, \( (A + B) \cdot (A + \overline{B}) = A + B \cdot \overline{B} \). Step 2: Since \( B \cdot \overline{B} = 0 \), this simplifies to \( A + 0 = A \) (Alternatively: \( A \cdot A + A \cdot \overline{B} + B \cdot A + B \cdot \overline{B} = A + A \cdot \overline{B} + A \cdot B + 0 = A \cdot (1 + \overline{B} + B) = A \cdot 1 = A \)). Step 3: Multiply this simplified result by the remaining term \( C \) to obtain the final simplified expression: \( A \cdot C \).

PastPaper.markingScheme

1 mark: Correctly expanding the terms or applying the distributive law to the first part: e.g. showing \( (A + B)(A + \overline{B}) = A + B\overline{B} \) or \( AA + A\overline{B} + AB + B\overline{B} \). 1 mark: Simplifying the first part down to \( A \), showing the elimination of the B terms (e.g. \( B\overline{B} = 0 \)). 1 mark: Correct final answer of \( A \cdot C \) (or \( AC \)) with clear supporting working.
PastPaper.question 25 · written
3 PastPaper.marks
Simplify the following Boolean expression using De Morgan's Laws and Boolean identities: \( Y = \overline{\overline{A} + B} + \overline{A \cdot \overline{B}} \). Show all steps in your working.
PastPaper.showAnswers

PastPaper.workedSolution

Step 1: Apply De Morgan's Law to the first term: \( \overline{\overline{A} + B} = \overline{\overline{A}} \cdot \overline{B} = A \cdot \overline{B} \). Step 2: Identify that the second term, \( \overline{A \cdot \overline{B}} \), is the exact complement of the first term, \( A \cdot \overline{B} \). Step 3: Express the overall equation in terms of a temporary variable \( P = A \cdot \overline{B} \), which yields \( Y = P + \overline{P} \). Step 4: By the complement law, \( P + \overline{P} = 1 \). Therefore, the entire expression simplifies to \( 1 \) (Alternatively, applying De Morgan's to the second term yields \( \overline{A} + B \), giving \( Y = A\overline{B} + \overline{A} + B \). This simplifies to \( \overline{A} + B + A = \overline{A} + A + B = 1 + B = 1 \)).

PastPaper.markingScheme

1 mark: Correctly applying De Morgan's Law to at least one term (e.g., obtaining \( A \cdot \overline{B} \) or \( \overline{A} + B \)). 1 mark: Recognizing the complement relationship (e.g., expressing the terms as \( P + \overline{P} \)) OR performing correct distributive/absorption simplification on the expanded terms. 1 mark: Arriving at the correct final simplified answer of \( 1 \) with complete, mathematically correct steps.
PastPaper.question 26 · explanation
1.6 PastPaper.marks
Explain the precise steps involving the Program Counter (PC) and the Memory Address Register (MAR) during the fetch stage of the fetch-decode-execute cycle.
PastPaper.showAnswers

PastPaper.workedSolution

During the fetch stage: 1. The memory address stored in the PC is transferred to the MAR via the internal CPU bus. 2. The PC is incremented to point to the next instruction in sequence. 3. The address in the MAR is sent along the address bus to locate the instruction in RAM, which is then retrieved via the data bus.

PastPaper.markingScheme

Award up to 1.6 marks as follows: 1.0 Mark: For clearly stating that the address in the PC is copied to the MAR. 0.6 Marks: For stating that the PC is then incremented (to point to the next instruction).
PastPaper.question 27 · explanation
1.6 PastPaper.marks
Explain how an operating system manages physical memory using virtual memory when the available Random Access Memory (RAM) is fully allocated.
PastPaper.showAnswers

PastPaper.workedSolution

The operating system uses a partition of secondary storage (such as a hard drive or SSD) as an extension of RAM. When RAM is saturated, the OS swaps out pages of inactive memory onto secondary storage. When the CPU requires these pages again, an interrupt is triggered, and the OS swaps active pages out of RAM to make room to swap the required pages back in.

PastPaper.markingScheme

Award up to 1.6 marks as follows: 1.0 Mark: Identifying that an area of secondary storage is used as an extension of RAM, where pages/segments of inactive data are transferred to free up physical space. 0.6 Marks: Explaining the mechanism of 'swapping' or 'paging' data back and forth dynamically when needed by active processes.
PastPaper.question 28 · explanation
1.6 PastPaper.marks
State the purpose of the control bus in a processor architecture, and explain why the control bus must be bidirectional whereas the address bus is unidirectional.
PastPaper.showAnswers

PastPaper.workedSolution

The control bus is responsible for synchronizing and controlling system operations by sending timing and command signals. It is bidirectional because information must flow both ways: the CPU sends write/read commands and receives interrupt signals, clock signals, and status codes from peripheral controllers. The address bus is unidirectional because the CPU is the sole initiator of memory addresses to specify where data is being read from or written to.

PastPaper.markingScheme

Award up to 1.6 marks as follows: 1.0 Mark: Correctly explaining that the control bus is bidirectional because the CPU must both send control instructions (e.g. read/write commands) and receive status updates/interrupts from external components. 0.6 Marks: Correctly explaining that the address bus is unidirectional because addresses only travel one way, from the processor to memory or I/O devices to select a location.
PastPaper.question 29 · theory
4 PastPaper.marks
An assembly language programmer needs to translate a block of high-level code into AQA standard assembly language.

The high-level code is as follows:

```text
IF x < 20 THEN
y = x * 4
ELSE
y = x - 10
ENDIF
```

Write assembly language code that is equivalent to this high-level language code.

Assume that:
* The value of variable `x` is currently stored in register `R1`.
* The final value of `y` must be stored in register `R2`.
* You should use the AQA standard assembly language instruction set.
* You may define any labels you require.
PastPaper.showAnswers

PastPaper.workedSolution

To translate the given high-level selection statement into AQA standard assembly language, we must perform the following actions:

1. **Comparison**: Compare the value of `x` (stored in register `R1`) with the value `20` using the `CMP` instruction.
2. **Conditional Branching**: Use a conditional branch instruction to alter the flow of execution. For example, if `R1` is greater than or equal to `20` (which is the opposite condition of `x < 20`), execution should branch to the `else` block.
3. **THEN Block (y = x * 4)**: To multiply `R1` by 4 and store it in `R2`, we can perform a logical shift left by 2 bits (`LSL R2, R1, #2`). An unconditional branch (`B`) is then needed to jump past the `else` block.
4. **ELSE Block (y = x - 10)**: Subtract 10 from `R1` and store the result in `R2` using `SUB R2, R1, #10`.

**Example Solution Code:**
```assembly
CMP R1, #20
BGE else_label
LSL R2, R1, #2
B end_if
else_label:
SUB R2, R1, #10
end_if:
```

PastPaper.markingScheme

Award marks as follows:

* **1 mark**: Correct comparison instruction comparing register `R1` with the immediate value `#20` (i.e., `CMP R1, #20`).
* **1 mark**: Correct structure of conditional branch and unconditional branch to control flow (e.g. `BGE else_label` and `B end_if` in the appropriate places, or equivalent logic using `BLT`).
* **1 mark**: Correct instruction to multiply `R1` by 4 and store the result in `R2` (e.g., `LSL R2, R1, #2` or an equivalent sequence of additions like `ADD R2, R1, R1` followed by `ADD R2, R2, R2`).
* **1 mark**: Correct subtraction instruction `SUB R2, R1, #10` that places the result in `R2`.
PastPaper.question 30 · short_answer
2 PastPaper.marks
A software developer decides to upgrade a computer's CPU to a model that has a larger Level 2 (L2) cache, while keeping the clock speed and the number of cores exactly the same.

Explain how this upgrade can improve the performance of the system.
PastPaper.showAnswers

PastPaper.workedSolution

1. A larger L2 cache allows more data and instructions to be stored close to the CPU. This increases the cache hit rate (and reduces cache misses).
2. Fetching data from the cache is significantly faster than fetching it from the main memory (RAM). Therefore, the processor spends fewer clock cycles idling/waiting for data to be transferred, which speeds up the instruction execution cycle and improves overall system performance.

PastPaper.markingScheme

Award up to 2 marks:

- 1 Mark: For explaining that a larger L2 cache increases the cache hit rate OR reduces the number of accesses needed to the slower main memory (RAM).
- 1 Mark: For explaining that this reduces CPU idle time (the time the processor spends waiting for data to be fetched), leading to faster program execution.

Note: Do not award marks for simply saying "it makes the computer faster" without explaining the mechanism (cache vs RAM speed or CPU idle time).
PastPaper.question 31 · Essay
9 PastPaper.marks
A large distribution warehouse is considering replacing its manual barcode-scanning system with an automated Radio Frequency Identification (RFID) tracking system for all inventory items. At the same time, management plans to issue passive RFID-enabled ID badges to all warehouse employees to automatically track their physical movements and log their working hours while on site.

Discuss how passive RFID technology operates to scan inventory items, and analyze the ethical and social issues associated with tracking employee movements using this technology.

In your answer, you should address:
- The step-by-step physical operation of a passive RFID reader and passive RFID tag.
- At least two distinct social or ethical concerns raised by implementing employee-tracking badges.
PastPaper.showAnswers

PastPaper.workedSolution

### Technical Operation of Passive RFID:
1. **Signal Emission**: The RFID reader's antenna continuously emits radio frequency (RF) electromagnetic waves.
2. **Energy Induction**: The passive RFID tag, which has no internal power source (battery), comes within range of the reader. Its antenna intercepts the RF waves.
3. **Powering up**: The magnetic field induces a small electrical current in the tag's antenna (electromagnetic induction), powering the microchip inside the tag.
4. **Data Transmission**: The activated microchip modulates the signal and transmits its unique identifier/data back to the reader via radio waves.
5. **Data Reception**: The reader's antenna detects the incoming radio signal, decodes the data, and sends it to the host computer system.

### Social and Ethical Issues:
- **Privacy & Constant Surveillance**: Tracking physical movements in real-time allows employers to micromanage workers (e.g., monitoring toilet breaks or idle times). This can lead to increased stress, anxiety, and a feeling of constant scrutiny, leading to a culture of distrust.
- **Security and Cloning (Skimming)**: Passive RFID tags do not usually have advanced cryptography. They can be read from a distance by unauthorized scanners without the wearer's consent, exposing them to security threats or identity spoofing outside the warehouse.
- **Data Misuse & Retention**: Detailed logs of employee movements could be used for purposes other than those initially declared (e.g., performance evaluation based on movement speed rather than work quality) or could be leaked in a data breach.
- **Consent and Labor Rights**: Employees may have no choice but to wear the badges to keep their jobs, creating an ethical issue regarding forced surveillance and imbalance of power.

PastPaper.markingScheme

### Level of Response marking grid

- **Level 3 (7-9 marks)**:
- Shows a clear, accurate, and detailed technical understanding of passive RFID operation (must detail electromagnetic induction / how the tag gets power, and data modulation/transmission).
- Thoroughly analyzes at least two distinct social/ethical issues of employee tracking with well-justified arguments.
- The response is coherent and logically structured.

- **Level 2 (4-6 marks)**:
- Explains the operation of passive RFID but may omit specific technical steps (such as how power is induced or how the tag transmits data back).
- Identifies and discusses at least one social/ethical issue clearly, or two briefly.
- The response is generally structured but may lack technical precision or depth in analysis.

- **Level 1 (1-3 marks)**:
- Shows limited understanding of RFID technology (e.g., merely stating it uses radio waves to read data).
- Mentions a social/ethical issue with little or no explanation.
- The response may be fragmented, disorganized, or contain significant technical inaccuracies.

### Indicative Content

**Technical Points (RFID):**
- Reader emits radio waves / electromagnetic field.
- Tag has no internal battery (passive).
- Tag antenna intercepts the electromagnetic waves.
- Current is induced in the tag's antenna (electromagnetic induction).
- This current powers the microchip.
- Chip modulates and transmits its data (ID) back via radio waves.
- Reader receives and decodes the signal.

**Ethical / Social Points:**
- Privacy infringement / surveillance culture.
- Stress and mental health impact of continuous physical monitoring.
- Lack of meaningful consent / power imbalance.
- Security risks such as skimming/cloning of badges.
- Data protection concerns (who accesses the location database and how it is secured).
PastPaper.question 32 · short_answer
2 PastPaper.marks
A network administrator configures a wireless access point (WAP) to use MAC address filtering as a security measure to prevent unauthorised devices from joining the network. Explain why MAC address filtering alone provides weak security, describing how an unauthorised user can bypass it.
PastPaper.showAnswers

PastPaper.workedSolution

MAC address filtering is a weak security measure because MAC addresses are transmitted in unencrypted (plaintext) format in the headers of wireless data packets. An attacker within physical range of the wireless network can use packet sniffing/analysis software to capture these packets and identify authorised MAC addresses. Once an authorised MAC address is identified, the attacker can change (spoof) their own device's MAC address to match the authorised one, thereby bypassing the filter and gaining access to the network.

PastPaper.markingScheme

1 Mark: State that MAC addresses are transmitted in cleartext/unencrypted/plaintext format (making them easy to intercept/sniff using packet captures). 1 Mark: State that an attacker can spoof/clone/mimic an authorised MAC address on their own device to bypass the filter.
PastPaper.question 33 · short_answer
2 PastPaper.marks
Unlike wired Ethernet networks which use CSMA/CD, wireless networks use Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA). Explain two reasons why Collision Detection (CSMA/CD) is not practical for wireless networks.
PastPaper.showAnswers

PastPaper.workedSolution

Collision Detection (CSMA/CD) is impractical for wireless networks due to physical limitations of the medium. First, a wireless device's own transmission is much stronger than any incoming signal, making it extremely difficult or impossible for the device to transmit and listen for a collision simultaneously. Second, the 'hidden node problem' means that two devices may not be able to hear each other's transmissions, but both can communicate with the central wireless access point. In this scenario, they cannot detect each other's signals to determine if a collision is occurring at the access point.

PastPaper.markingScheme

1 Mark: Explaining that a wireless transceiver cannot easily transmit and receive/detect signals simultaneously (due to the strength of its own signal drowning out other signals). 1 Mark: Explaining the 'hidden node' problem, where devices cannot hear each other and thus cannot detect a collision occurring at the receiving access point.
PastPaper.question 34 · short_answer
2 PastPaper.marks
A business implements both WPA3 wireless encryption and MAC address filtering on their corporate Wi-Fi network. Distinguish between the primary purpose of WPA3 encryption and the purpose of MAC address filtering in this network configuration.
PastPaper.showAnswers

PastPaper.workedSolution

WPA3 and MAC address filtering serve distinct security roles. WPA3's primary purpose is data confidentiality and secure authentication; it encrypts all wireless traffic between the client and the access point so that intercepted data cannot be read by unauthorised third parties. MAC address filtering's primary purpose is device access control; it checks the hardware address of the connecting device against an approved list to determine whether that specific hardware is allowed to connect to the network, regardless of whether they have the correct encryption password.

PastPaper.markingScheme

1 Mark: Identifies that WPA3 is for data encryption/privacy/confidentiality (preventing eavesdropping/intercepted data from being read) or secure authentication. 1 Mark: Identifies that MAC address filtering is for hardware-level/device access control (allowing or blocking specific devices based on their physical network adapter addresses).
PastPaper.question 35 · short_answer
2 PastPaper.marks
State two advantages of using a physical star topology compared to a physical bus topology in a local area network.
PastPaper.showAnswers

PastPaper.workedSolution

In a physical star topology, each device is connected to a central switch or hub via its own dedicated cable. This leads to several benefits: 1. A break in a cable only disconnects that specific device, whereas in a bus topology, a main cable break or lack of termination can disrupt the entire network. 2. New devices can be plugged into the central switch without taking the network offline, which is more difficult in a bus topology where modifying the trunk cable might disrupt active transmissions.

PastPaper.markingScheme

Award 1 mark per valid advantage up to a maximum of 2 marks. Correct advantages include: - Failure of a single connection/cable does not affect the rest of the network. - Easier to add/remove/configure devices without disrupting the network. - Fewer data collisions (if a switch is used) leading to better performance. - Easier to locate and isolate faults. Reject: 'Cheaper to set up' or 'Requires less cabling'.
PastPaper.question 36 · short_answer
2 PastPaper.marks
Describe two advantages of organizing a school network as a client-server network rather than a peer-to-peer network.
PastPaper.showAnswers

PastPaper.workedSolution

A client-server network relies on a central server to manage resources, security, and data: 1. Centralised backup: All student and staff files stored on the server can be backed up at once, ensuring data recovery is simple. 2. Centralised administration: IT staff can update software, manage user accounts, and enforce access rights from a single server rather than having to configure every peer machine individually.

PastPaper.markingScheme

Award 1 mark per valid advantage clearly explained, up to a maximum of 2 marks. Correct points: - Centralised backups: files can be backed up in one central location rather than on each workstation. - Centralised security/administration: user accounts, access levels, and security policies can be managed from a central server. - Centralised software deployment: updates and software can be pushed out from the server to all clients. Reject: 'It is cheaper to set up' or 'It is faster' without qualification.
PastPaper.question 37 · Descriptive
3 PastPaper.marks
A marathon event uses Radio Frequency Identification (RFID) technology to track the progress of runners as they cross timing mats on the course.

Describe how a passive RFID tag attached to a runner's shoe interacts with the timing mat reader to record their race time. Your answer must explain how the tag is powered and how data is transferred.
PastPaper.showAnswers

PastPaper.workedSolution

The process operates as follows:

1. **Signal Transmission:** The reader antenna in the timing mat continuously broadcasts radio frequency signals.
2. **Power Generation (Inductive Coupling):** The passive tag does not have its own power source. When it enters the electromagnetic field generated by the reader, a current is induced in the tag's antenna, providing the electrical power needed to energise the microchip.
3. **Data Return:** Once powered, the microchip modulates the signal and transmits its stored data (the runner's unique ID) back to the reader, which records the exact time of the crossing.

PastPaper.markingScheme

Award up to 3 marks for the following points:

- **1 Mark:** The reader/antenna in the mat transmits a radio frequency (RF) / electromagnetic signal.
- **1 Mark:** The passive tag receives the RF signal, which induces a small electrical current in the tag's antenna to power up the chip (accept 'powers the tag via electromagnetic induction').
- **1 Mark:** The tag's microchip modulates the signal / transmits its unique ID data back to the reader via radio waves.

*Note: Do not award marks for describing active RFID features (such as internal batteries) unless explicitly contrasted to explain how the passive tag is powered.*
PastPaper.question 38 · Descriptive
3 PastPaper.marks
A marathon event uses Radio Frequency Identification (RFID) technology to track the progress of runners as they cross timing mats on the course.

Describe how a passive RFID tag attached to a runner's shoe interacts with the timing mat reader to record their race time. Your answer must explain how the tag is powered and how data is transferred.
PastPaper.showAnswers

PastPaper.workedSolution

The process operates as follows:

1. **Signal Transmission:** The reader antenna in the timing mat continuously broadcasts radio frequency signals.
2. **Power Generation (Inductive Coupling):** The passive tag does not have its own power source. When it enters the electromagnetic field generated by the reader, a current is induced in the tag's antenna, providing the electrical power needed to energise the microchip.
3. **Data Return:** Once powered, the microchip modulates the signal and transmits its stored data (the runner's unique ID) back to the reader, which records the exact time of the crossing.

PastPaper.markingScheme

Award up to 3 marks for the following points:

- **1 Mark:** The reader/antenna in the mat transmits a radio frequency (RF) / electromagnetic signal.
- **1 Mark:** The passive tag receives the RF signal, which induces a small electrical current in the tag's antenna to power up the chip (accept 'powers the tag via electromagnetic induction').
- **1 Mark:** The tag's microchip modulates the signal / transmits its unique ID data back to the reader via radio waves.

*Note: Do not award marks for describing active RFID features (such as internal batteries) unless explicitly contrasted to explain how the passive tag is powered.*

PastPaper.sampleCTATitle

PastPaper.sampleCTADescription

PastPaper.sampleStickyMessage

PastPaper.stickyCtaText