An original Thinka practice paper modelled on the structure and difficulty of the Jun 2024 AQA AS Level Computer Science 7516 paper. Not affiliated with or reproduced from AQA.
Paper 1 Section A
Answer all questions. Suggested time: 20 minutes. Covers hand-tracing algorithms and baseline programming concepts.
4 PastPaper.question · 21 PastPaper.marks
PastPaper.question 1 · Algorithm Tracing
5 PastPaper.marks
An algorithm is represented by the following pseudocode:
Total = 0 Count = 0 For i = 0 To 4 Value = A[i] If Value MOD 3 == 0 Then Total = Total + Value Count = Count + 1 Else Total = Total - 1 EndIf EndFor
The array A contains the following integers: [3, 7, 12, 5, 18].
Complete the trace table below to show the execution of this algorithm. Only write down values when they change.
Tracing the loop step-by-step: - Initial state: Total = 0, Count = 0. - Iteration i = 0: Value = A[0] = 3. Since 3 MOD 3 == 0, Total becomes 0 + 3 = 3, and Count becomes 0 + 1 = 1. - Iteration i = 1: Value = A[1] = 7. Since 7 MOD 3 != 0, Total becomes 3 - 1 = 2. Count does not change. - Iteration i = 2: Value = A[2] = 12. Since 12 MOD 3 == 0, Total becomes 2 + 12 = 14, and Count becomes 1 + 1 = 2. - Iteration i = 3: Value = A[3] = 5. Since 5 MOD 3 != 0, Total becomes 14 - 1 = 13. Count does not change. - Iteration i = 4: Value = A[4] = 18. Since 18 MOD 3 == 0, Total becomes 13 + 18 = 31, and Count becomes 2 + 1 = 3.
Maximum 5 marks: - 1 mark: Correct values in 'i' column (0, 1, 2, 3, 4) and 'Value' column (3, 7, 12, 5, 18) throughout trace. - 1 mark: Correct 'Total' column values on iterations 1 & 2 (3, 2). - 1 mark: Correct 'Total' column values on iterations 3 & 4 (14, 13). - 1 mark: Correct 'Total' column value on iteration 5 (31). - 1 mark: Correct 'Count' column values (1, 2, 3) written only when they change (or written fully on respective rows with 1, 1, 2, 2, 3). Accept blank or repeated correct values for Count on unchanged steps.
PastPaper.question 2 · Conceptual Short-Answer
3.5 PastPaper.marks
The following pseudocode algorithm represents a standard routine processing two positive integers, X and Y:
X <- 45 Y <- 12 WHILE Y > 0 Temp <- X MOD Y X <- Y Y <- Temp ENDWHILE
Trace this algorithm by stating the values of X, Y, and Temp at each check of the WHILE loop condition (including the initial check and the final check where the loop terminates). State the final value of X when the algorithm terminates.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Let's trace the execution step-by-step: - Before the loop starts (Initial Check): X is initialized to 45, Y is initialized to 12. Temp is not yet defined. - First loop test: Y > 0 (12 > 0) is True. Inside the loop: - Temp <- 45 MOD 12 = 9 - X <- 12 - Y <- 9 - Second loop test: Y > 0 (9 > 0) is True. Inside the loop: - Temp <- 12 MOD 9 = 3 - X <- 9 - Y <- 3 - Third loop test: Y > 0 (3 > 0) is True. Inside the loop: - Temp <- 9 MOD 3 = 0 - X <- 3 - Y <- 0 - Fourth loop test: Y > 0 (0 > 0) is False. The loop terminates. - The final value of X is 3.
PastPaper.markingScheme
- 1 Mark: Correct trace for the first iteration (X = 12, Y = 9, Temp = 9 at the second check). - 1 Mark: Correct trace for the second iteration (X = 9, Y = 3, Temp = 3 at the third check). - 1 Mark: Correct final values identifying that the loop terminates when Y reaches 0 (X = 3, Y = 0, Temp = 0 at the final check). - 0.5 Mark: Correctly identifying the final returned value of X as 3.
PastPaper.question 3 · Conceptual Short-Answer
3.5 PastPaper.marks
Explain the difference in scope between a local variable and a global variable. State one reason why it is considered good programming practice to use local variables rather than global variables wherever possible.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Scope defines the parts of a program where a variable can be accessed or modified. 1. Local Variable Scope: Local variables are declared within a specific subroutine (function or procedure) or block of code and are only visible and accessible within that context. Once the subroutine finishes execution, the local variable's lifetime ends and its memory is released. 2. Global Variable Scope: Global variables are declared in the main body of the program outside any specific subroutine and remain accessible from any part of the program throughout its entire runtime. 3. Advantage of Local Variables: Using local variables limits access to data to only where it is needed. This prevents side-effects, such as another subroutine accidentally overwriting a variable's value, and makes code modular, easier to debug, and reusable.
PastPaper.markingScheme
- 1 Mark: Clear definition of local variable scope (restricted to the subroutine/block where declared). - 1 Mark: Clear definition of global variable scope (accessible throughout the entire program). - 1.5 Marks: One valid reason for using local variables over global variables, split as: - 1 Mark: Identifies a valid reason (e.g., 'avoids unintended side effects', 'makes subroutines modular/reusable', 'efficient memory management as they are destroyed after execution'). - 0.5 Mark: Provides clear development-focused explanation or elaboration of that reason.
PastPaper.question 4 · Direct Coding Implementation
9 PastPaper.marks
Write a subroutine/function named `ValidateCode` in the programming language of your choice (or in pseudocode) that validates a given string code.
The subroutine must accept a single string parameter and return a boolean value: `True` if the code is valid, and `False` if it is invalid.
To be considered valid, the input string must meet **all** of the following validation rules: 1. It must be exactly 8 characters in length. 2. The first three characters (indices 0, 1, and 2) must be uppercase alphabetic letters (from 'A' to 'Z' inclusive). 3. The fourth character (index 3) must be a hyphen (`-`). 4. The final four characters (indices 4 to 7) must be numeric digits representing a value between 1000 and 9999 inclusive.
You can assume standard built-in functions/methods (such as length check, type conversion, or character range checks) are available in your chosen language.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
An elegant way to implement this in Python is:
```python def ValidateCode(code): # Rule 1: Check length is exactly 8 if len(code) != 8: return False
# Rule 2: Check first three characters are uppercase letters for i in range(3): if not ('A' <= code[i] <= 'Z'): return False
# Rule 3: Check fourth character is a hyphen if code[3] != '-': return False
# Rule 4: Check that the last four characters are numeric and form a value between 1000 and 9999 last_four = code[4:] if not last_four.isdigit(): return False
val = int(last_four) if val < 1000 or val > 9999: return False
return True ```
### Alternative Version (Pseudocode) ```text SUBROUTINE ValidateCode(code) IF LEN(code) != 8 THEN RETURN False ENDIF
FOR i FROM 0 TO 2 IF code[i] < 'A' OR code[i] > 'Z' THEN RETURN False ENDIF ENDFOR
IF code[3] != '-' THEN RETURN False ENDIF
FOR i FROM 4 TO 7 IF code[i] < '0' OR code[i] > '9' THEN RETURN False ENDIF ENDFOR
val <- TO_INTEGER(SUBSTRING(code, 4, 4)) IF val < 1000 OR val > 9999 THEN RETURN False ENDIF
RETURN True ENDSUBROUTINE ```
PastPaper.markingScheme
Marks are awarded as follows:
1. **Subroutine Structure (1 Mark)**: Correct subroutine header defining name `ValidateCode` and accepting one parameter. 2. **Length Validation (1 Mark)**: Checks if the input string has a length of exactly 8 characters. Returns False or handles state if not. 3. **Uppercase Character Verification (2 Marks)**: Checks that the first three characters are uppercase letters ('A'-'Z'). Award 1 mark for correct indexing/loop limits, and 1 mark for correctly checking they are all within 'A' to 'Z'. 4. **Separator Check (1 Mark)**: Correctly checks that the character at index 3 (fourth position) is a hyphen (`-`). 5. **Digit Type Check (1 Mark)**: Verifies that characters 4 to 7 are all numeric digits (e.g. using a loop, `.isdigit()`, regex, or range comparison '0'-'9'). 6. **Integer Range Check (2 Marks)**: Extracts characters 4 to 7 as a substring, safely casts/interprets them as an integer, and checks that this value is between 1000 and 9999 inclusive. Award 1 mark for conversion and 1 mark for the bounds check. 7. **Return Values (1 Mark)**: Subroutine correctly returns `True` only if all validation tests pass, and returns `False` if any test fails.
*Note: Equivalent constructs in any recognized programming language (Python, C#, VB.Net, Java) or pseudocode are fully acceptable.*
Paper 1 Section B
Answer all questions. Suggested time: 25 minutes. Covers analysis of the pre-released skeleton program code structure without writing modifications.
12 PastPaper.question · 19 PastPaper.marks
PastPaper.question 1 · Identifier Identification
1 PastPaper.marks
Refer to the following code snippet representing part of a skeleton program:
def SetupGrid(self, initial_score): self.Score = initial_score for row in range(GRID_SIZE): new_row = [] for col in range(GRID_SIZE): new_row.append(EMPTY_CELL) self.Grid.append(new_row)
def MovePlayer(self, direction): steps_taken = 0 if direction == 'N': self.PlayerY -= 1 steps_taken += 1 elif direction == 'S': self.PlayerY += 1 steps_taken += 1 return steps_taken
Identify a global constant identifier defined in this code snippet.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The global constants are declared at the top-level scope (not inside any class or subroutine) and are conventionally written in uppercase. Either GRID_SIZE or EMPTY_CELL is correct.
PastPaper.markingScheme
1 mark for either GRID_SIZE or EMPTY_CELL. Accept case-insensitive matches but ignore trailing punctuation.
PastPaper.question 2 · Identifier Identification
1 PastPaper.marks
Refer to the code snippet provided in Question 1. Identify a local variable identifier that is declared and used inside the MovePlayer subroutine.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Inside the MovePlayer method, steps_taken is initialized to 0 and incremented. It is a local variable because its scope is limited to the MovePlayer method.
PastPaper.markingScheme
1 mark for steps_taken. Reject direction (as it is a parameter), self.PlayerY (as it is an instance variable/attribute), or variables from other subroutines.
PastPaper.question 3 · Identifier Identification
1 PastPaper.marks
Refer to the code snippet provided in Question 1. Identify an identifier that is used as a formal parameter in the SetupGrid subroutine.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The parameter list of SetupGrid is (self, initial_score). Therefore, either initial_score or self is a formal parameter.
PastPaper.markingScheme
1 mark for initial_score or self. Reject local variables inside the subroutine like row or new_row.
PastPaper.question 4 · Identifier Identification
1 PastPaper.marks
Refer to the code snippet provided in Question 1. Identify a user-defined function identifier that is defined outside of any class and returns a value to the calling routine.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The identifier DisplayMenu represents a subroutine defined outside of the GridGame class. It returns the value of choice, making it a function.
PastPaper.markingScheme
1 mark for DisplayMenu (accept DisplayMenu()). Reject methods within the class like MovePlayer or SetupGrid.
PastPaper.question 5 · Identifier Identification
1 PastPaper.marks
Refer to the code snippet provided in Question 1. Identify an instance variable (or class attribute) identifier that is initialized as an empty list.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
In the __init__ constructor of the GridGame class, the line self.Grid = [] initializes an instance variable called Grid as an empty list.
PastPaper.markingScheme
1 mark for Grid or self.Grid. Reject local variables like new_row or other attributes like Score or PlayerX.
PastPaper.question 6 · Explain Code Subroutines
1.5 PastPaper.marks
In the pre-released skeleton program, the subroutine `CheckValidMove` is defined as:
Explain why the parameters `CurrentX` and `CurrentY` should be passed to this subroutine by value rather than by reference.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
When parameters are passed by value, a copy of the actual data is passed into the subroutine's local scope. If the subroutine performing the validation checks modifies these variables during its calculations, those modifications remain local and do not alter the player's true position in the calling routine. Passing by reference would create an alias to the original variables, risking unintended changes to the player's location before the move is confirmed.
PastPaper.markingScheme
Award marks as follows: - 1.0 mark: For explaining that passing by value creates a local copy which prevents the subroutine from accidentally modifying the original coordinate variables in the calling routine (preventing side effects). - 0.5 marks: For explaining that the subroutine only needs to read or inspect the coordinates to perform its check and does not need to return updated coordinate values through those parameters.
PastPaper.question 7 · Explain Code Subroutines
1.5 PastPaper.marks
The subroutine `LoadMap` reads map data from an external text file to populate a grid. Explain why it is good programming practice to use local variables for file handlers and loop counters inside `LoadMap` instead of global variables.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Local variables only exist within the execution context of the subroutine where they are declared. By using local variables for file handlers and loop counters inside `LoadMap`, you ensure that other subroutines cannot accidentally read or overwrite these variables. Additionally, the memory allocated for these variables is released once the subroutine finishes execution, which is more efficient than keeping global variables in memory throughout the program run.
PastPaper.markingScheme
Award marks as follows: - 1.0 mark: For explaining that local scope prevents accidental modifications or naming conflicts (side-effects) from other subroutines, preserving encapsulation. - 0.5 marks: For noting that local variables are deallocated when the subroutine finishes, leading to efficient memory management OR making the subroutine easier to test/debug independently.
PastPaper.question 8 · Explain Code Subroutines
1.5 PastPaper.marks
The subroutine `GetMenuChoice` displays a main menu and uses a loop to obtain and validate a user's selection, returning the chosen option. State whether `GetMenuChoice` is a function or a procedure, and explain the key structural difference between these two types of subroutine.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
`GetMenuChoice` returns the validated menu choice (such as an integer or a character) to the calling routine, which means it is a function. Structurally, functions use a return statement to pass data back to the point where they were called, allowing the subroutine call to be assigned to a variable or used in an expression. A procedure simply executes its block of statements and does not pass a value back directly.
PastPaper.markingScheme
Award marks as follows: - 0.5 marks: Correctly identifying `GetMenuChoice` as a function. - 1.0 mark: Explaining the key structural difference (functions must return a value to the calling statement, whereas procedures do not return a value).
PastPaper.question 9 · Explain Code Subroutines
1.5 PastPaper.marks
The skeleton program contains a subroutine `ResetBoard` which resets all elements of a 2D array representing a game board to empty spaces. If the 2D array is passed as a parameter to this subroutine, explain why it must be passed by reference rather than by value.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
When a parameter is passed by reference, the subroutine is given the memory address of the actual variable. Therefore, any updates made to the 2D array inside `ResetBoard` immediately update the original array in the calling routine. If it were passed by value, the compiler would create a local copy of the entire 2D array; the resetting would only affect this copy, and the original board would remain unchanged when the subroutine finished.
PastPaper.markingScheme
Award marks as follows: - 1.0 mark: Explaining that passing by reference allows modifications inside the subroutine to directly update the original array in the calling routine. - 0.5 marks: Explaining that passing by value would create a copy of the array, meaning any changes would be lost once the subroutine finished execution.
PastPaper.question 10 · short-answer
4 PastPaper.marks
An object-oriented skeleton program for a board game has a GameBoard class and a Tile class. The GameBoard class contains a 2D array of Tile objects.
Describe the relationship between GameBoard and Tile by answering the following three questions:
1. State whether the relationship between GameBoard and Tile is composition or aggregation, assuming that a Tile cannot exist independently of the GameBoard which contains it.
2. Explain the fundamental difference between composition and aggregation in terms of object lifetimes.
3. Explain how this relationship is typically implemented within the constructor of the GameBoard class to enforce this dependency.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
### Detailed Solution
1. **Relationship Type:** The relationship is **composition**. This is because the Tile objects have a strong ownership relationship with the GameBoard and cannot exist without it.
2. **Difference in Object Lifetimes:** * **Composition (Strong 'has-a' relationship):** The lifetime of the child object (Tile) is completely controlled by the parent object (GameBoard). If the parent object is destroyed, all its child objects are automatically destroyed along with it. * **Aggregation (Weak 'has-a' relationship):** The child object can exist independently of the parent object. If the parent object is destroyed, the child object continues to exist (it may be associated with another class or live on in global memory).
3. **Implementation in Code:** To implement composition, the child objects must be instantiated inside the constructor of the parent class (e.g., using 'new Tile()' inside GameBoard's constructor). This ensures they are created alongside the parent and cannot be passed in from outside already created.
* **Part 2 (2 Marks):** * **1 mark** for explaining that in composition, the lifetime of the associated object is bound to the parent object / if parent is destroyed, child is destroyed. * **1 mark** for explaining that in aggregation, the associated object exists independently of the parent / if parent is destroyed, child survives.
* **Part 3 (1 Mark):** * **1 mark** for explaining that the child objects (Tile) are instantiated / created *inside* the parent class (GameBoard) constructor (or instantiated when the parent is instantiated), rather than being passed in as reference arguments from external code.
PastPaper.question 11 · Design Outline
2 PastPaper.marks
In the skeleton program, players make moves on an 8 by 8 grid. The developer wants to introduce a feature that stores a history of all successful moves.
Describe how a user-defined record structure named `Move` can be designed to store the details of a single move from a start coordinate to an end coordinate. You must specify the names and data types of the fields required in your record structure.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To represent a single move from a starting grid square to a destination grid square, the record must capture both the starting and ending positions.
A typical solution defines four fields corresponding to the row and column indices: - `StartRow` (Integer) and `StartCol` (Integer) to store the starting position. - `EndRow` (Integer) and `EndCol` (Integer) to store the destination position.
Alternatively, if the grid coordinates are represented as alphanumeric strings (such as "E4"), the structure could use: - `StartPosition` (String) - `EndPosition` (String)
PastPaper.markingScheme
Award up to 2 marks: - 1 Mark: For identifying appropriate fields to represent both the starting position and ending position (e.g. Row/Col or X/Y for start and end, or Start/End position strings). - 1 Mark: For specifying appropriate and consistent data types (e.g. Integer for indices, String for coordinate codes) for all identified fields.
PastPaper.question 12 · Design Outline
2 PastPaper.marks
In the skeleton program, players make moves on an 8 by 8 grid. The developer wants to introduce a feature that stores a history of all successful moves.
Describe how a user-defined record structure named `Move` can be designed to store the details of a single move from a start coordinate to an end coordinate. You must specify the names and data types of the fields required in your record structure.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To represent a single move from a starting grid square to a destination grid square, the record must capture both the starting and ending positions.
A typical solution defines four fields corresponding to the row and column indices: - `StartRow` (Integer) and `StartCol` (Integer) to store the starting position. - `EndRow` (Integer) and `EndCol` (Integer) to store the destination position.
Alternatively, if the grid coordinates are represented as alphanumeric strings (such as "E4"), the structure could use: - `StartPosition` (String) - `EndPosition` (String)
PastPaper.markingScheme
Award up to 2 marks: - 1 Mark: For identifying appropriate fields to represent both the starting position and ending position (e.g. Row/Col or X/Y for start and end, or Start/End position strings). - 1 Mark: For specifying appropriate and consistent data types (e.g. Integer for indices, String for coordinate codes) for all identified fields.
Paper 1 Section C
Answer all questions. Suggested time: 60 minutes. Complete practical programming changes and feature extensions in the IDE.
3 PastPaper.question · 30 PastPaper.marks
PastPaper.question 1 · Program Modification (Standard)
8 PastPaper.marks
An existing Python function CompressString(Data) is used to compress a string using Run-Length Encoding (RLE). The current implementation is shown below:
def CompressString(Data): if len(Data) == 0: return "" Compressed = "" CurrentChar = Data[0] Count = 1 for i in range(1, len(Data)): if Data[i] == CurrentChar: Count += 1 else: Compressed += str(Count) + CurrentChar CurrentChar = Data[i] Count = 1 Compressed += str(Count) + CurrentChar return Compressed
Modify the CompressString function so that it does not prepend the count when a character appears exactly once in a sequence (i.e., when the run length is 1). For example: - CompressString("AABCCC") should return "2AB3C" instead of "2A1B3C". - CompressString("XYZ") should return "XYZ" instead of "1X1Y1Z".
Write the complete, modified CompressString subroutine.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Below is the modified Python subroutine:
def CompressString(Data): if len(Data) == 0: return "" Compressed = "" CurrentChar = Data[0] Count = 1 for i in range(1, len(Data)): if Data[i] == CurrentChar: Count += 1 else: if Count > 1: Compressed += str(Count) + CurrentChar else: Compressed += CurrentChar CurrentChar = Data[i] Count = 1 if Count > 1: Compressed += str(Count) + CurrentChar else: Compressed += CurrentChar return Compressed
PastPaper.markingScheme
Award marks as follows: - 1 Mark: Correct check for empty/base case len(Data) == 0. - 1 Mark: Correctly initialising Compressed, CurrentChar, and Count. - 1 Mark: Loop correctly iterates through all characters of the input string Data. - 1 Mark: Checking if Count > 1 inside the loop's else branch. - 1 Mark: Appending only CurrentChar inside the loop's else branch when Count is 1. - 1 Mark: Correctly resetting Count to 1 and updating CurrentChar to Data[i] inside the else branch. - 1 Mark: Correctly applying the identical Count > 1 conditional logic to the final run after the loop completes. - 1 Mark: Correctly returning the fully compiled Compressed string.
PastPaper.question 2 · practical
9 PastPaper.marks
An amateur programmer is developing a board game in which an 8x8 grid is represented as a 2-dimensional array. They have written the following subroutine to update a cell on the board: SUBROUTINE UpdateCell(Grid, Row, Col, Val) Grid[Row, Col] <- Val ENDSUBROUTINE However, during testing, they notice two major bugs: 1) The changes made to the Grid inside the subroutine do not persist outside of it. 2) If the player inputs a Row or Col value outside the range 0 to 7 (inclusive), the program crashes with an out-of-bounds error. Write a modified, robust subroutine called UpdateCellSecure in block-structured pseudocode. Your subroutine must meet the following requirements: - It must accept the 2D array Grid as a parameter, ensuring any modifications to it persist outside the subroutine. - It must accept Row, Col, and Val as parameters. - It must accept an additional parameter Success, which must also persist its changed value outside the subroutine. - It must check if Row and Col are both within the valid bounds of the 8x8 grid (0 to 7 inclusive). - If the indices are valid, it must update the Grid at the specified position, set Success to True, and complete the subroutine. - If the indices are invalid, it must make no changes to the Grid, set Success to False, and complete the subroutine.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Below is the correct pseudocode solution:
SUBROUTINE UpdateCellSecure(byRef Grid, byVal Row, byVal Col, byVal Val, byRef Success) IF Row >= 0 AND Row <= 7 AND Col >= 0 AND Col <= 7 THEN Grid[Row, Col] <- Val Success <- True ELSE Success <- False ENDIF ENDSUBROUTINE
This design correctly specifies the parameter passing mechanisms (using byRef for parameters whose modifications need to persist, and byVal for those that do not). It also correctly incorporates range validation to prevent out-of-bounds execution errors.
PastPaper.markingScheme
Award marks as follows (Max 9 marks total): - 1 mark: Correct subroutine header defining 'UpdateCellSecure' with all 5 parameters. - 1 mark: Explicitly defining the 'Grid' parameter as passed by reference (e.g., using 'byRef' or equivalent language keyword). - 1 mark: Explicitly defining the 'Success' parameter as passed by reference. - 1 mark: Defining 'Row', 'Col', and 'Val' parameters as passed by value (either explicitly using 'byVal' or by default). - 1 mark: Writing a conditional validation check that tests both lower bounds (Row >= 0 and Col >= 0). - 1 mark: Writing a conditional validation check that tests both upper bounds (Row <= 7 and Col <= 7). - 1 mark: Performing array modification 'Grid[Row, Col] <- Val' only within the valid branch of the conditional block. - 1 mark: Setting 'Success' to True when the update is performed. - 1 mark: Setting 'Success' to False in an alternative branch when range validation fails.
PastPaper.question 3 · practical
13 PastPaper.marks
An \(8 \times 8\) grid represents a warehouse floor where a robot moves to collect items. The grid is stored as a 2D array of characters named `WarehouseGrid`. Free spaces are represented by the character `'.'` and obstacles are represented by `'#'`.
Write a subroutine `ValidateAndCalculateDistance` in a language of your choice that: 1. Receives three parameters: `WarehouseGrid` (the 2D array of size \(8 \times 8\)), `StartRow` (integer), `StartCol` (integer), and `Movements` (a string where each character represents a directional move: 'N' for North, 'S' for South, 'E' for East, 'W' for West). 2. Tracks the robot's current row and column coordinates, starting at `(StartRow, StartCol)`. 3. For each character/move in the `Movements` string: - Adjusts the current coordinates accordingly: North decreases Row by 1, South increases Row by 1, East increases Col by 1, West decreases Col by 1. - Validates if the new coordinate is outside the boundaries of the grid (valid row and column indices are \(0\) to \(7\) inclusive). If out-of-bounds, the subroutine must immediately return `-1`. - Validates if the cell at the new coordinate contains an obstacle (`'#'`). If it hits an obstacle, the subroutine must immediately return `-2`. 4. If all moves in the string are successfully processed without out-of-bounds errors or obstacle collisions, the subroutine must calculate the final Manhattan Distance from the start position to the final position using the formula: \(\text{Distance} = |\text{StartRow} - \text{CurrentRow}| + |\text{StartCol} - \text{CurrentCol}|\) 5. Returns this integer distance value.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Here is a complete solution implemented in Python:
### Walkthrough: 1. **Initialization**: We copy `StartRow` and `StartCol` into mutable tracking variables, `currentRow` and `currentCol`. 2. **Iteration**: A loop processes each direction character from the `Movements` string. 3. **Coordinate Update**: Using selective structure (`if/elif`), we update the position. Changing row coordinate coordinates corresponds to North/South moves (-1/+1), and column coordinates corresponds to East/West moves (+1/-1). 4. **Out-of-Bounds Check**: Immediately after updating, we verify if either coordinate is below 0 or above 7. If true, the loop is terminated instantly with return `-1`. 5. **Obstacle Collision Check**: Next, the cell's value is retrieved from `WarehouseGrid`. If it equals `'#'`, we return `-2`. 6. **Distance Calculation**: If the loop finishes without returning, the Manhattan distance is calculated using absolute differences (`abs`) and returned.
PastPaper.markingScheme
### Marking Scheme (Total: 13 Marks)
- **[1 Mark]**: Correct subroutine header with matching parameters (`WarehouseGrid`, `StartRow`, `StartCol`, `Movements`). - **[1 Mark]**: Initialisation of temporary coordinate tracking variables (`currentRow`, `currentCol`) to the start values. - **[2 Marks]**: Loop correctly iterates over every element/character in the `Movements` variable. - **[2 Marks]**: Correct implementation of conditional logic to update coordinates for all 4 moves (North, South, East, West). - **[2 Marks]**: Boundary checks correctly implemented to ensure `currentRow` and `currentCol` are between 0 and 7 inclusive. Returns `-1` immediately on violation. - **[2 Marks]**: Obstacle collision check correctly implemented (retrieving value from grid index `[currentRow][currentCol]`). Returns `-2` immediately on finding `'#'`. - **[2 Marks]**: Correct formula implementation for Manhattan Distance using absolute differences after loop completion. - **[1 Mark]**: Correct return of the calculated distance value when no violations occur.
Paper 2 (Written Theory)
Answer all questions. Time allowed: 1 hour 30 minutes. Covers standard theoretical units.
31 PastPaper.question · 76 PastPaper.marks
PastPaper.question 1 · multiple_choice
2 PastPaper.marks
A mono audio signal is sampled at a frequency of 8 kHz using an 8-bit sample resolution. What is the minimum storage size in kibibytes (KiB) required to store a 40-second recording of this signal, assuming no metadata or compression is applied?
1 mark for calculating the total file size in bytes (320,000 bytes). 1 mark for dividing the bytes by 1024 to obtain the correct size in kibibytes (312.5 KiB).
PastPaper.question 2 · multiple_choice
2 PastPaper.marks
A computer system represents numbers using a two's complement fixed-point binary representation with a 4-bit integer part (the leftmost bit being the sign bit) and a 3-bit fractional part. What is the denary value of the binary pattern \(1011.011_2\) under this representation?
A.-5.375
B.-4.625
C.-3.375
D.-11.375
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Under a two's complement fixed-point representation with a 4-bit integer part and 3-bit fractional part, the bit weights from left to right are: \(-2^3, 2^2, 2^1, 2^0, 2^{-1}, 2^{-2}, 2^{-3}\) which corresponds to: \(-8, 4, 2, 1, 0.5, 0.25, 0.125\)
Alternatively, converting using the flip-and-add-1 method: 1. Flip the bits: \(0100.100\) 2. Add the value of the least significant bit (\(2^{-3} = 0.125\)): \(0100.101\) 3. Calculate magnitude: \(4 + 0.5 + 0.125 = 4.625\) 4. Apply negative sign: \(-4.625\).
PastPaper.markingScheme
1 mark for establishing the correct bit weights or recognizing that the integer part value is negative (starts with -8). 1 mark for arriving at the correct denary value of -4.625.
PastPaper.question 3 · multiple_choice
2 PastPaper.marks
Which of the following processor registers holds the memory address of the next instruction to be fetched from main memory, and which register holds the actual instruction that is currently being decoded and executed?
A.Memory Address Register (MAR) and Memory Buffer Register (MBR)
B.Program Counter (PC) and Current Instruction Register (CIR)
C.Program Counter (PC) and Memory Buffer Register (MBR)
D.Memory Address Register (MAR) and Current Instruction Register (CIR)
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The Program Counter (PC) stores the address of the next instruction to be fetched from primary memory. The Current Instruction Register (CIR) holds the actual instruction currently being decoded and executed. Hence, option B is correct.
PastPaper.markingScheme
1 mark for identifying the PC as holding the address of the next instruction. 1 mark for identifying the CIR as holding the instruction currently being decoded.
PastPaper.question 4 · multiple_choice
2 PastPaper.marks
Which of the following is the simplest form of the Boolean expression \(\overline{A + B} + (A \cdot \bar{B})\)?
A.\(\bar{A}\)
B.\(\bar{B}\)
C.\(A + \bar{B}\)
D.0
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Let's simplify the Boolean expression step-by-step:
1. Apply De Morgan's Law to the first term: \(\overline{A + B} = \bar{A} \cdot \bar{B}\)
2. Rewrite the expression: \((\bar{A} \cdot \bar{B}) + (A \cdot \bar{B})\)
3. Factor out \(\bar{B}\) using the distributive law: \(\bar{B} \cdot (\bar{A} + A)\)
4. Apply the identity law \(\bar{A} + A = 1\): \(\bar{B} \cdot (1) = \bar{B}\)
Therefore, the simplest form is \(\bar{B}\).
PastPaper.markingScheme
1 mark for correctly applying De Morgan's Law to get \(\bar{A} \cdot \bar{B}\). 1 mark for factoring out \(\bar{B}\) to obtain the simplified answer of \(\bar{B}\).
PastPaper.question 5 · multiple_choice
2 PastPaper.marks
Which of the following statements best describes an assembly language in comparison to machine code and high-level languages?
A.It is a high-level, declarative language that uses structured English commands to define what a program should achieve without specifying how.
B.It is a low-level language that is directly executed by the processor's hardware control unit without requiring any prior translation or assembly.
C.It is a low-level language that uses mnemonics to represent individual machine instructions, requiring a one-to-one translation to machine code using an assembler.
D.It is an imperative language that requires a complex compiler to perform optimization and convert block structures into equivalent system calls.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Assembly language is a low-level programming language where there is a direct one-to-one relationship between the assembly instructions and equivalent machine code instructions. It uses mnemonic codes (such as ADD, SUB, LDR) instead of raw binary, and needs an assembler to translate it into machine code so that the processor can execute it.
PastPaper.markingScheme
1 mark for identifying assembly language as a low-level mnemonic language. 1 mark for noting the one-to-one mapping requiring an assembler for translation to machine code.
PastPaper.question 6 · multiple_choice
2 PastPaper.marks
An XOR gate has two inputs, A and B. Its output is connected to one input of a two-input NAND gate. The other input of this NAND gate is connected to input B. Under which of the following combinations of inputs A and B will the final output of the NAND gate be 0?
A.A = 0, B = 0
B.A = 0, B = 1
C.A = 1, B = 0
D.A = 1, B = 1
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Let's analyze the logic circuit step-by-step: 1. The output of the XOR gate is \(X = A \oplus B\). 2. The inputs to the NAND gate are \(X\) and \(B\). 3. The final output is \(Y = \overline{X \cdot B} = \overline{(A \oplus B) \cdot B}\).
Let's evaluate \(Y\) for each input combination: - If \(A = 0, B = 0\): \(X = 0 \oplus 0 = 0\). \(Y = \overline{0 \cdot 0} = 1\). - If \(A = 0, B = 1\): \(X = 0 \oplus 1 = 1\). \(Y = \overline{1 \cdot 1} = 0\). - If \(A = 1, B = 0\): \(X = 1 \oplus 0 = 1\). \(Y = \overline{1 \cdot 0} = 1\). - If \(A = 1, B = 1\): \(X = 1 \oplus 1 = 0\). \(Y = \overline{0 \cdot 1} = 1\).
Thus, the final output \(Y\) is 0 only when \(A = 0\) and \(B = 1\).
PastPaper.markingScheme
1 mark for demonstrating a correct trace of intermediate XOR outputs. 1 mark for identifying that the inputs must be A = 0, B = 1 to output 0 from the NAND gate.
PastPaper.question 7 · Theory
1.6 PastPaper.marks
Convert the denary number \(-75\) into an 8-bit two's complement binary integer.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To convert \(-75\) into 8-bit two's complement binary: 1. Convert the positive value \(+75\) to binary. \(75 = 64 + 8 + 2 + 1\), which is \(01001011_2\). 2. Invert all the bits of the positive binary representation to get the one's complement: \(10110100_2\). 3. Add 1 to the result to get the two's complement: \(10110100_2 + 1 = 10110101_2\). Alternatively, using binary place values: \(-128 + 32 + 16 + 4 + 1 = -75\), which directly yields \(10110101_2\).
PastPaper.markingScheme
1 mark: Correct conversion of \(+75\) to binary (\(01001011\)) OR correct setting of place values with a single calculation error. 0.6 marks: Correct final 8-bit two's complement binary representation (\(10110101\)).
PastPaper.question 8 · Theory
1.6 PastPaper.marks
Convert the unsigned fixed-point binary number \(1101.011_2\) (where 4 bits are used for the integer part and 3 bits for the fractional part) into its denary representation.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To convert \(1101.011_2\) into denary, determine the place value of each bit position: - Integer part: \(2^3 (8)\), \(2^2 (4)\), \(2^1 (2)\), \(2^0 (1)\). This gives \(1 \times 8 + 1 \times 4 + 0 \times 2 + 1 \times 1 = 13\). - Fractional part: \(2^{-1} (0.5)\), \(2^{-2} (0.25)\), \(2^{-3} (0.125)\). This gives \(0 \times 0.5 + 1 \times 0.25 + 1 \times 0.125 = 0.375\). Combine the two parts: \(13 + 0.375 = 13.375\).
PastPaper.markingScheme
1 mark: Correct conversion of either the integer part (13) or the fractional part (0.375). 0.6 marks: Correctly combined final denary value (13.375).
PastPaper.question 9 · Theory
1.6 PastPaper.marks
Add the following two 8-bit unsigned binary integers: \(10110100_2\) and \(01101011_2\). State the 8-bit binary result and whether an overflow has occurred.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Perform the binary addition: ``` 10110100 + 01101011 ---------- (1)00011111 ``` The sum of the two numbers is \(100011111_2\). Because this is a 9-bit number, the eighth bit carry generates an overflow condition. The 8-bit result is \(00011111_2\) and overflow has occurred because the correct mathematical result (271) cannot be represented in 8 bits (maximum 255).
PastPaper.markingScheme
1 mark: Correctly performing binary addition to get the binary sum \(00011111\) (even if 9th bit is shown or ignored). 0.6 marks: Correctly stating that overflow has occurred because the sum exceeds the capacity of an 8-bit register.
PastPaper.question 10 · Theory
1.6 PastPaper.marks
Convert the denary fraction \(9.625\) into an unsigned fixed-point binary representation with 5 bits for the integer part and 4 bits for the fractional part.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. Convert the integer part, \(9\), to a 5-bit binary number: \(9 = 8 + 1\), which is \(01001_2\). 2. Convert the fractional part, \(0.625\), to a 4-bit binary fraction: - \(0.625 \ge 0.5 (2^{-1}) \rightarrow\) bit is 1. Remainder = 0.125 - \(0.125 < 0.25 (2^{-2}) \rightarrow\) bit is 0. Remainder = 0.125 - \(0.125 \ge 0.125 (2^{-3}) \rightarrow\) bit is 1. Remainder = 0 - remaining bit \(2^{-4} \rightarrow\) bit is 0. This gives \(.1010_2\). 3. Combine both parts: \(01001.1010_2\).
PastPaper.markingScheme
1 mark: Correct conversion of either the integer part to 5 bits (01001) or the fractional part to 4 bits (1010). 0.6 marks: Correct complete fixed-point representation (01001.1010).
PastPaper.question 11 · Theory
1.6 PastPaper.marks
Perform an arithmetic shift right by 3 places on the 8-bit two's complement binary number \(11001000_2\) and convert the final binary result to denary.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. Perform the arithmetic shift right by 3 places on \(11001000_2\). Since it is an arithmetic shift, the sign bit (the MSB, which is 1) is preserved and shifted into the vacated positions: - Shift 1: \(11100100\) - Shift 2: \(11110010\) - Shift 3: \(11111001\) 2. Convert the resulting binary number \(11111001_2\) to denary: Using place values: \(-128 + 64 + 32 + 16 + 8 + 1 = -7\). (Verification: Original number is \(-128 + 64 + 8 = -56\). Dividing \(-56\) by \(2^3 = 8\) gives \(-7\).)
PastPaper.markingScheme
1 mark: Correct binary representation after shifting 3 places arithmetically (\(11111001\)). 0.6 marks: Correct conversion of that binary number to denary (\(-7\)).
PastPaper.question 12 · written
2.5 PastPaper.marks
An audio technician records a stereo (2-channel) soundtrack using a sampling rate of 32 kHz and a sample resolution of 16 bits. The recording lasts exactly 256 seconds.
Calculate the file size of the uncompressed audio recording in Mebibytes (MiB). Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To calculate the file size of an uncompressed audio recording:
1. Identify the key components from the question: - Sampling rate = \(32\text{ kHz} = 32,000\text{ Hz}\) - Sample resolution = \(16\text{ bits} = 2\text{ bytes}\) - Number of channels = \(2\) (stereo) - Duration = \(256\text{ seconds}\)
2. Calculate the total size in bytes: \(\text{File Size} = \text{Sampling Rate} \times \text{Bytes per Sample} \times \text{Channels} \times \text{Duration}\) \(\text{File Size} = 32,000 \times 2 \times 2 \times 256 = 32,768,000\text{ bytes}\)
3. Convert bytes to Mebibytes (MiB) where \(1\text{ MiB} = 2^{20}\text{ bytes} = 1,048,576\text{ bytes}\): \(\text{File Size in MiB} = \frac{32,768,000}{1,048,576} = 31.25\text{ MiB}\)
PastPaper.markingScheme
- **1 Mark**: Correct calculation of the total size in bytes (\(32,768,000\text{ bytes}\)) or equivalent correct expression in bits (\(262,144,000\text{ bits}\)). - **1 Mark**: Correct conversion method of dividing by \(2^{20}\) (or \(1,048,576\)) to get MiB. - **0.5 Marks**: Correct final answer of 31.25 (accept "31.25 MiB").
PastPaper.question 13 · written
2.5 PastPaper.marks
A server needs to back up a virtual machine image of size 12.5 GiB (where \(1\text{ GiB} = 2^{30}\text{ bytes}\)) to an SSD storage array. The SSD array has a continuous write speed of 400 MiB/s (where \(1\text{ MiB} = 2^{20}\text{ bytes}\)).
Calculate how many seconds it will take to complete this write operation. Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To find the time taken to write the data, we must first align the storage units:
2. Calculate the time taken: \(\text{Time} = \frac{\text{Total Size in MiB}}{\text{Write Speed in MiB/s}}\) \(\text{Time} = \frac{12,800}{400} = 32\text{ seconds}\)
PastPaper.markingScheme
- **1 Mark**: Correct conversion of the image size from GiB to MiB (\(12,800\text{ MiB}\)). - **1 Mark**: Correct method shown for dividing the total size in MiB by the transfer rate in MiB/s (\(12,800 / 400\)). - **0.5 Marks**: Correct final answer of 32 (accept "32 seconds").
PastPaper.question 14 · written
2.5 PastPaper.marks
A high-fidelity digital audio stream is recorded with a sampling rate of 96 kHz, 24 bits of sample resolution, and 6 audio channels.
Calculate the bit rate of this uncompressed digital audio stream in Megabits per second (Mbps). Use the standard decimal prefix where \(1\text{ Mbps} = 1,000,000\text{ bits per second}\). Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To calculate the bit rate of the audio stream:
1. Use the formula: \(\text{Bit Rate} = \text{Sampling Frequency (Hz)} \times \text{Sample Resolution (bits)} \times \text{Number of Channels}\)
2. Substitute the values: \(\text{Bit Rate} = 96,000\text{ Hz} \times 24\text{ bits} \times 6\text{ channels}\) \(\text{Bit Rate} = 13,824,000\text{ bits per second (bps)}\)
3. Convert to Megabits per second (Mbps): \(\text{Bit Rate in Mbps} = \frac{13,824,000}{1,000,000} = 13.824\text{ Mbps}\)
PastPaper.markingScheme
- **1 Mark**: Correct calculation of the bit rate in bits per second (\(13,824,000\text{ bps}\)). - **1 Mark**: Correct method for converting bps to Mbps by dividing by \(1,000,000\). - **0.5 Marks**: Correct final answer of 13.824 (accept "13.824 Mbps").
PastPaper.question 15 · written
2.5 PastPaper.marks
A processor's data bus has a width of 64 bits and operates at a clock frequency of 800 MHz.
Calculate the maximum theoretical transfer bandwidth of this data bus in Gigabytes per second (GB/s). Use the standard decimal prefix where \(1\text{ GB} = 10^9\text{ bytes}\). Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To find the maximum transfer bandwidth of the bus:
1. Convert the bus width from bits to bytes: \(\text{Bus Width} = \frac{64\text{ bits}}{8} = 8\text{ bytes}\)
2. Express the clock frequency in Hz: \(\text{Frequency} = 800\text{ MHz} = 800,000,000\text{ Hz}\)
3. Calculate the bandwidth in bytes per second: \(\text{Bandwidth} = 8\text{ bytes} \times 800,000,000\text{ Hz} = 6,400,000,000\text{ bytes/s}\)
4. Convert to Gigabytes per second (GB/s): \(\text{Bandwidth in GB/s} = \frac{6,400,000,000}{1,000,000,000} = 6.4\text{ GB/s}\)
PastPaper.markingScheme
- **1 Mark**: Correct conversion of data bus width to bytes (\(8\text{ bytes}\)) and frequency to Hz (\(800 \times 10^6\text{ Hz}\)). - **1 Mark**: Correctly calculating the byte-rate transfer per second (\(6,400,000,000\text{ bytes/s}\)). - **0.5 Marks**: Correct final answer of 6.4 (accept "6.4 GB/s").
PastPaper.question 16 · Logic Circuit and Boolean Algebra
2.5 PastPaper.marks
Simplify the following Boolean expression: \( Q = \overline{A \cdot B} \cdot (A + B) \). Show your intermediate steps clearly.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. Apply De Morgan's Law to the first term: \( \overline{A \cdot B} = \overline{A} + \overline{B} \). 2. Substitute back into the expression: \( Q = (\overline{A} + \overline{B}) \cdot (A + B) \). 3. Expand the brackets: \( Q = \overline{A}\cdot A + \overline{A}\cdot B + \overline{B}\cdot A + \overline{B}\cdot B \). 4. Since any variable ANDed with its inverse is 0 (\( X \cdot \overline{X} = 0 \)), this simplifies to: \( Q = 0 + \overline{A}\cdot B + A\cdot\overline{B} + 0 = \overline{A}\cdot B + A\cdot\overline{B} \). 5. This is the expression for the XOR operation, which can also be written as: \( Q = A \oplus B \).
PastPaper.markingScheme
1 mark: Correctly applying De Morgan's Law to the first term to obtain \( \overline{A} + \overline{B} \). 1 mark: Expanding the brackets correctly and simplifying terms using the identity \( X \cdot \overline{X} = 0 \). 0.5 marks: Reaching the final correct simplified expression: \( \overline{A}\cdot B + A\cdot\overline{B} \) or \( A \oplus B \).
PastPaper.question 17 · Logic Circuit and Boolean Algebra
2.5 PastPaper.marks
A logic circuit has three inputs, \(A\), \(B\), and \(C\). The output \(Y\) is defined by the following description: \(Y\) is active (1) if \(A\) and \(B\) are active, OR if \(B\) is NOT active and \(C\) is active.
1. Represent this circuit as a standard Boolean expression using algebraic notation. 2. Determine the output value of \(Y\) when inputs are \(A = 1\), \(B = 0\), and \(C = 1\).
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. Convert the word description into algebraic notation: 'AND' is represented by multiplication (\(\cdot\)), 'OR' is represented by addition (\(+\)), and 'NOT' is represented by an overbar. Thus, the expression is: \( Y = A \cdot B + \overline{B} \cdot C \). 2. Substitute the input values (\(A = 1, B = 0, C = 1\)) into the expression: \( Y = 1 \cdot 0 + \overline{0} \cdot 1 \) \( Y = 0 + 1 \cdot 1 \) \( Y = 0 + 1 = 1 \).
PastPaper.markingScheme
1 mark: Correct Boolean expression \( Y = A \cdot B + \overline{B} \cdot C \) (or equivalent algebraic notation such as \( AB + \overline{B}C \)). 1 mark: Showing clear evidence of substituting the input values into the expression. 0.5 marks: Stating the correct final output value of 1 (or True).
PastPaper.question 18 · Logic Circuit and Boolean Algebra
2.5 PastPaper.marks
Using Boolean algebraic identities and/or De Morgan's Laws, simplify the following expression to its simplest form. Show all intermediate steps. \( P = \overline{\overline{X} + Y} + \overline{X} \cdot \overline{Y} \)
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. Apply De Morgan's Law to the first term: \( \overline{\overline{X} + Y} = \overline{\overline{X}} \cdot \overline{Y} \). 2. Apply the double negation rule (\( \overline{\overline{X}} = X \)) to simplify the first term to: \( X \cdot \overline{Y} \). 3. Substitute this back into the expression: \( P = X \cdot \overline{Y} + \overline{X} \cdot \overline{Y} \). 4. Factor out the common term \( \overline{Y} \): \( P = (X + \overline{X}) \cdot \overline{Y} \). 5. Use the identity \( X + \overline{X} = 1 \): \( P = 1 \cdot \overline{Y} = \overline{Y} \).
PastPaper.markingScheme
1 mark: Correctly applying De Morgan's Law and double negation to simplify the first term to \( X \cdot \overline{Y} \). 1 mark: Factoring out the common term to obtain \( (X + \overline{X}) \cdot \overline{Y} \). 0.5 marks: Correctly applying the identity \( X + \overline{X} = 1 \) to reach the final simplified expression \( \overline{Y} \).
PastPaper.question 19 · Logic Circuit and Boolean Algebra
2.5 PastPaper.marks
An automatic greenhouse window controller activates an alarm system \(S\) when temperature and humidity parameters meet specific logic conditions. The alarm output \(S\) is triggered (1) if: - Sensor \(A\) is active (1) AND sensor \(B\) is inactive (0), - OR if sensor \(B\) is active (1) AND sensor \(C\) is active (1).
Write a complete Boolean algebraic expression for \(S\) in terms of inputs \(A\), \(B\), and \(C\).
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. Express the first condition (Sensor A active AND sensor B inactive) as a Boolean product: \( A \cdot \overline{B} \). 2. Express the second condition (Sensor B active AND sensor C active) as a Boolean product: \( B \cdot C \). 3. Combine both conditions with an OR operator (+) as either condition can trigger the alarm: \( S = A \cdot \overline{B} + B \cdot C \).
PastPaper.markingScheme
1 mark: Correct representation of the first condition as \( A \cdot \overline{B} \) (or equivalent standard notation like \( A\overline{B} \)). 1 mark: Correct representation of the second condition as \( B \cdot C \) (or equivalent standard notation like \( BC \)). 0.5 marks: Combining both terms with the OR operator to produce the final complete expression \( S = A \cdot \overline{B} + B \cdot C \).
PastPaper.question 20 · short-answer
2 PastPaper.marks
During the fetch stage of the fetch-decode-execute cycle, describe how the Program Counter (PC) and the Memory Address Register (MAR) interact.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
At the beginning of the fetch stage, the Program Counter (PC) holds the address of the next instruction to be fetched. This address is copied from the PC to the Memory Address Register (MAR) via the internal processor bus, allowing the processor to prepare to read that specific instruction from main memory.
PastPaper.markingScheme
1 mark: State that the address or value in the PC is copied into the MAR. 1 mark: State that the PC holds the address of the next instruction to be fetched or executed.
PastPaper.question 21 · short-answer
2 PastPaper.marks
Describe two differences between the Harvard architecture and the Von Neumann architecture.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
In a Von Neumann architecture, both program instructions and data share the same physical memory space and the same system buses, which can cause a bottleneck. In contrast, a Harvard architecture maintains physically separate storage and separate signal paths/buses for instructions and data, enabling simultaneous access to both.
PastPaper.markingScheme
1 mark: Mentioning separate memory structures (or address spaces) for instructions and data in Harvard versus shared memory in Von Neumann. 1 mark: Mentioning separate system buses (data and address buses) in Harvard versus shared buses in Von Neumann (or explaining that Harvard allows simultaneous instruction/data access whereas Von Neumann is sequential).
PastPaper.question 22 · short-answer
2 PastPaper.marks
Explain why a computer processor utilizes a unidirectional address bus but a bidirectional data bus.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The address bus is unidirectional because address signals only need to travel in one direction: from the processor to memory or input/output controllers to specify a location. The data bus must be bidirectional because data needs to flow in both directions: into the processor during a read operation, and out from the processor during a write operation.
PastPaper.markingScheme
1 mark: Clarifying that the address bus is unidirectional because memory/IO addresses are only generated/sent by the processor. 1 mark: Clarifying that the data bus is bidirectional to facilitate both read (receiving data) and write (sending data) operations.
PastPaper.question 23 · short-answer
2 PastPaper.marks
A processor has an address bus width of 24 bits. Calculate the maximum number of unique memory addresses that this processor can directly reference. Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
With an address bus width of 24 bits, the total number of unique addressable locations is represented by \(2^{24}\). Calculating this value gives: \(2^{24} = 16,777,216\) unique addresses.
PastPaper.markingScheme
1 mark: Showing correct working of \(2^{24}\) (or equivalent representation, e.g., \(2^{10} \times 2^{14}\)). 1 mark: Correct integer value of \(16,777,216\) (also accept 16,777,216 addresses, or 16Mi / 16 Meg addresses).
PastPaper.question 24 · Assembly Language Program Writing
4 PastPaper.marks
Write a program in assembly language using the AQA standard assembly language instruction set to find the larger of two values stored in memory.
Your program should: - Load the values from memory locations labeled NUM1 and NUM2. - Compare the two values. - Store the larger of the two values into the memory location labeled MAX. If the two values are equal, store that value in MAX. - Stop execution using the HALT instruction.
You may assume registers R1 and R2 are available for use.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To complete this task, the program performs the following steps:
1. Load the value from memory location `NUM1` into register `R1` using `LDR R1, NUM1`. 2. Load the value from memory location `NUM2` into register `R2` using `LDR R2, NUM2`. 3. Compare the two values using `CMP R1, R2`. 4. Branch conditionally: if `R1` is greater than `R2` (`BGT R1_LARGER`), we jump to the label where `R1` is stored in `MAX`. 5. If the condition is false, the program falls through to `STR R2, MAX`, which handles cases where `R2` is larger or equal. 6. Use an unconditional branch `B FINISH` to bypass the alternative storage block. 7. Provide the label `R1_LARGER:` followed by `STR R1, MAX` to handle the case where `R1` is larger. 8. Terminate the program with the `HALT` instruction at the end of execution.
PastPaper.markingScheme
Award marks as follows: - **1 Mark**: Correctly loads both values from memory locations `NUM1` and `NUM2` into registers using `LDR`. - **1 Mark**: Compares the two register values using the `CMP` instruction. - **1 Mark**: Correct use of a conditional branch (e.g. `BGT`, `BLT`) to split execution flow based on the comparison. - **1 Mark**: Correctly stores the maximum value to `MAX` using `STR` on both logical paths and terminates program flow cleanly using `HALT` (without falling through to execute both store operations).
PastPaper.question 25 · short_answer
2.5 PastPaper.marks
Explain how a passive RFID (Radio Frequency Identification) tag is powered and how it transmits its data back to an RFID reader.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. The reader emits electromagnetic/radio waves through its antenna. 2. When the passive tag enters this range, the waves induce an electrical current in the tag's antenna (electromagnetic induction), which powers the tag's microchip. 3. The powered microchip modulates the signal and reflects it back to the reader (known as backscatter), transmitting its unique identifier or data.
PastPaper.markingScheme
Award marks as follows: 1 Mark: For explaining that the reader emits an electromagnetic field / radio frequency waves. 1 Mark: For explaining that this field induces an electrical current in the tag's antenna to power the microchip. 0.5 Marks: For explaining that the tag modulates and reflects (backscatters) the signal back to the reader to transmit its data.
PastPaper.question 26 · short_answer
2.5 PastPaper.marks
Explain how a CD-ROM drive uses a laser and the physical properties of an optical disc to read stored digital data.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. A low-powered laser is focused onto the spiral track of pits and lands on the reflective surface of the spinning CD. 2. A photodetector measures the intensity of the reflected light. 3. Lands reflect the light directly back, whereas pits scatter the light. The transitions between pits and lands cause a change in light intensity which is registered as a binary 1, while no change represents a binary 0.
PastPaper.markingScheme
Award marks as follows: 1 Mark: For stating that a laser is shone onto the spinning surface containing pits and lands. 1 Mark: For explaining that lands reflect light and pits scatter light, which is detected by a photodetector. 0.5 Marks: For explaining that the transitions between pits and lands represent binary 1s and the flat areas represent binary 0s (or that changes in reflection intensity are converted into binary signals).
A regional health authority plans to introduce an AI-driven triage system in its emergency departments. The system will use historical patient data, vital signs, and symptoms entered by a receptionist to automatically categorise patients (e.g., immediate, urgent, non-urgent) to determine their priority for seeing a doctor. This system is intended to reduce waiting times and help manage staff shortages. Discuss the individual (moral/ethical), legal, and cultural issues and opportunities associated with the implementation of this AI-driven triage system. In your answer you should refer to: 1) The moral and ethical responsibilities of the health authority and medical staff. 2) Legal concerns, including data protection (such as the GDPR / Data Protection Act) and liability if things go wrong. 3) Cultural shifts in trust towards automated systems in healthcare. You will be assessed on your ability to construct a well-structured, balanced, and coherent argument.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To gain high marks, candidates must address three distinct dimensions: **1. Moral and Ethical Aspects:** Opportunities include objective triaging, reducing human cognitive fatigue, and clinical priority optimization. Issues include algorithmic bias where historical data contains systemic healthcare biases, automation bias leading to staff blindly trusting the machine, and the erosion of empathy. **2. Legal Aspects:** Opportunities include clear digital logs for accountability and decision-making audits. Issues include strict compliance with data protection laws (e.g., GDPR / UK Data Protection Act 2018) concerning sensitive biometric/health data, and the explicit restriction under GDPR Article 22 against automated decision-making without human review. Liability issues arise regarding who is responsible for misdiagnoses (the software vendor, NHS trust, or clinical operator). **3. Cultural Aspects:** Opportunities include the shift toward tech-enabled modern healthcare. Issues include public skepticism of machine-led triage, linguistic or cultural barriers in how symptoms are described by diverse patient populations, and resistance from medical professionals who feel their diagnostic expertise is undervalued. A high-scoring essay will synthesise these aspects into a balanced conclusion.
PastPaper.markingScheme
**Level 3 (9-12 marks):** Candidate shows a comprehensive and detailed understanding of ethical, legal, and cultural dimensions. Discusses both benefits/opportunities and issues/drawbacks. Integrates relevant terminology correctly (e.g., GDPR, systemic bias, liability, automation bias). Well-structured, coherent, and ends with a reasoned evaluation. **Level 2 (5-8 marks):** Candidate addresses at least two of the dimensions (ethical, legal, cultural) with some detail, or all three with limited depth. The response has a clear structure but may be unbalanced (e.g., focusing heavily on legal issues and neglecting cultural ones). **Level 1 (1-4 marks):** Candidate presents isolated points from one or two dimensions without coherent structure. Understanding is superficial with minimal use of correct terminology. **Specific Points to credit:** *Ethical:* Bias in training data; triage objectivity; moral responsibility for medical errors. *Legal:* GDPR compliance for sensitive health data; right to human intervention; liability of NHS vs software developers. *Cultural:* Public trust in AI triage; digital divide and language barriers; professional resistance from clinical staff.
PastPaper.question 28 · Written
1.75 PastPaper.marks
A small design agency with 5 workstations is deciding between a peer-to-peer and a client-server network architecture. Explain one reason why a client-server network would provide better data security and integrity for their design files compared to a peer-to-peer network.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
In a client-server network, data files are stored on a central server, which allows backup operations to be automated and managed centrally. Security credentials, user access rights, and antivirus updates are also administered from this single central server, ensuring consistent security policies across all workstations. In contrast, a peer-to-peer network relies on individual users to manage their own file sharing permissions and backups on their local machines, which increases the risk of data loss or unauthorised access due to human error.
PastPaper.markingScheme
1 mark: For identifying that data and user access are managed centrally (e.g. central backup or centralised access rights). 0.75 marks: For explaining how this improves security/integrity compared to a P2P network (e.g. prevents reliance on individual users to perform backups or secure their own devices, ensuring consistent policies).
PastPaper.question 29 · Written
1.75 PastPaper.marks
In wireless networking, the 'hidden node problem' can lead to high rates of packet collision. Explain how the Request to Send/Clear to Send (RTS/CTS) protocol is used to solve this problem.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
When a node wishes to transmit, it sends a Request to Send (RTS) frame to the wireless Access Point (AP). If the AP is free, it replies with a Clear to Send (CTS) broadcast frame. Because the CTS is broadcasted by the AP, all other nodes within range of the AP (including those hidden from the transmitting node) receive it and know to defer their transmissions for a specified duration, thus avoiding collisions.
PastPaper.markingScheme
1 mark: For stating that a node sends an RTS and the Access Point responds with a CTS broadcast to all nodes in its range. 0.75 marks: For explaining that other nodes (even if hidden from the sender) receive the CTS and defer/delay their transmissions to prevent collisions.
PastPaper.question 30 · Written
1.75 PastPaper.marks
A local area network is constructed using a central switch with individual cables running to each workstation. However, the network operates logically as a bus. Explain how a network can be physically a star but logically a bus.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Physically, the network is a star because every workstation is connected via its own dedicated cable to a central device (the switch/hub). Logically, it behaves as a bus because the underlying protocol broadcasts data packets to all nodes simultaneously along a single logical path, meaning only one device can transmit at a time and all nodes receive the transmission, mirroring a physical bus.
PastPaper.markingScheme
1 mark: Explaining the physical star layout (each node connected individually to a central hub/switch). 0.75 marks: Explaining the logical bus behaviour (the transmission behaves as if it is broadcast to all nodes on a single shared logical channel, where collisions can occur or CSMA/CD protocols are applied).
PastPaper.question 31 · Written
1.75 PastPaper.marks
A network administrator decides to disable the broadcasting of the Service Set Identifier (SSID) on a wireless access point. Explain the purpose of an SSID and how disabling its broadcast provides a basic level of security.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The SSID is a unique, alphanumeric identifier that acts as the name of a wireless network. Disabling the SSID broadcast means that the network name will not appear in the list of available networks shown to nearby devices. To connect, a user must manually enter the exact SSID, which deters casual intruders or wardrivers from discovering and attempting to access the network.
PastPaper.markingScheme
1 mark: Stating the purpose of an SSID (to uniquely identify/name a wireless network for client connection). 0.75 marks: Explaining that disabling the broadcast hides the network name from standard scans/device searches, preventing casual unauthorised access attempts (though not stopping sophisticated attackers who can sniff the SSID from active traffic).