Cambridge IAS-Level · PastPaper.sampleTitle

MetadataPastPaper.sampleTitle

Thinka Jun 2025 (V3) Cambridge International A Level-Style Mock — Computer Science (9618)

150 PastPaper.marks210 PastPaper.minutes2025
An original Thinka practice paper modelled on the structure and difficulty of the Jun 2025 (V3) Cambridge International A Level Computer Science (9618) paper. Not affiliated with or reproduced from Cambridge.

Paper 1: Theory Fundamentals

Answer all questions. Calculators must not be used. Total marks: 75.
7 PastPaper.question · 74.9 PastPaper.marks
PastPaper.question 1 · Structured
10.7 PastPaper.marks
This question is about data representation.

(a) Convert the 8-bit two's complement binary integer `11010110` to denary. Show your working. (2 marks)

(b) Show how the denary value `-43` is represented as an 8-bit two's complement binary integer. (2 marks)

(c) Explain why the Unicode character set was introduced to replace the ASCII character set in modern computer systems. (3 marks)

(d) Write the hexadecimal representation of the binary byte `11010110`. (2 marks)

(e) Perform binary addition on the following two unsigned 8-bit binary integers: `01101100` and `01010101`. State if overflow occurs. (2 marks)
PastPaper.showAnswers

PastPaper.workedSolution

(a) For 11010110 in two's complement, the most significant bit (MSB) is 1 (representing -128):
-128 + 64 + 16 + 4 + 2 = -42.
Alternative working: Invert the bits of 11010110 to get 00101001, add 1 to get 00101010. Convert 00101010 to denary: 32 + 8 + 2 = 42. Since original MSB was 1, the value is -42.

(b) To represent -43:
1. Find binary representation of +43: 32 + 8 + 2 + 1 = 00101011
2. Invert the bits: 11010100
3. Add 1: 11010101
Final 8-bit binary: 11010101

(c) ASCII uses 7 bits (or 8 bits for extended ASCII), restricting the character set to a maximum of 128 (or 256) unique characters. This is only sufficient for English and limited western European characters. Unicode uses 16 or 32 bits, allowing for over a million unique characters. This accommodates characters from all active global languages, scientific symbols, and emojis in a single, unified encoding scheme.

(d) Split 11010110 into two nibbles:
- 1101 = 13 in denary = D in hexadecimal
- 0110 = 6 in denary = 6 in hexadecimal
Hexadecimal representation: D6

(e) Addition:
01101100
+ 01010101
----------
11000001
Working: 0+1=1; 0+0=0; 1+1=0 carry 1; 1+0+1=0 carry 1; 0+1+1=0 carry 1; 1+0+1=0 carry 1; 1+1=0 carry 1; 0+0+1=1.
Since this is unsigned 8-bit addition, the result is 11000001 (193 in denary). No overflow occurs for unsigned representation because the sum fits inside 8 bits (no carry out from the MSB).

PastPaper.markingScheme

(a) 1 mark for correct method (showing negative MSB weight or correct inversion process), 1 mark for correct denary value (-42).
(b) 1 mark for binary representation of +43 or correct bit-inversion step, 1 mark for correct final answer (11010101).
(c) 1 mark for identifying ASCII limitations (7/8 bits, max 128/256 characters), 1 mark for explaining Unicode capabilities (16/32 bits, millions of characters), 1 mark for explaining global language support / unified standard.
(d) 1 mark for correct conversion of each nibble (D and 6), 1 mark for final correct representation (D6).
(e) 1 mark for correct binary sum (11000001), 1 mark for stating that no unsigned overflow occurs (or identifying that 193 is within 0-255 range).
PastPaper.question 2 · Structured
10.7 PastPaper.marks
This question is about Assembly Language and the CPU.

A processor's instruction set includes the following commands:
- `LDD `: Direct addressing. Load the content of the specified memory address into the Accumulator (ACC).
- `LDX `: Indexed addressing. Load the content of the address (specified address + Index Register) into ACC.
- `LDI `: Immediate addressing. Load the constant value into ACC.
- `STO `: Store the content of ACC at the specified memory address.
- `ADD `: Add the content of the specified memory address to ACC.
- `INC `: Increment the specified register (ACC or IX) by 1.

Assume the initial state of memory and the Index Register (IX) is as follows:
- Address `200`: 45
- Address `201`: 12
- Address `202`: 88
- Address `203`: 31
- Index Register (IX): 2

(a) Trace the following assembly program segment, showing the contents of the registers and memory locations where appropriate, and state the final values in the Accumulator (ACC) and Index Register (IX). (5 marks)

```assembly
LDI 2
STO 204
LDX 200
ADD 204
INC IX
INC ACC
```

(b) Describe the role of the following registers during the fetch stage of the Fetch-Execute cycle: (6 marks)
1. Program Counter (PC)
2. Memory Buffer Register (MBR) / Memory Data Register (MDR)
PastPaper.showAnswers

PastPaper.workedSolution

(a) Trace table evaluation:
1. `LDI 2` -> ACC becomes 2.
2. `STO 204` -> The value in ACC (2) is stored at memory location 204. (Memory[204] = 2)
3. `LDX 200` -> Address calculated: 200 + IX = 200 + 2 = 202. Value at memory 202 is 88. ACC becomes 88.
4. `ADD 204` -> Content of address 204 (which is 2) is added to ACC. ACC becomes 88 + 2 = 90.
5. `INC IX` -> IX is incremented by 1. IX becomes 3.
6. `INC ACC` -> ACC is incremented by 1. ACC becomes 91.
Final Register Values: ACC = 91, IX = 3.

(b) Register Roles in the Fetch Stage:
1. Program Counter (PC):
- Holds the memory address of the next instruction to be fetched.
- Its contents are copied to the Memory Address Register (MAR) at the start of the fetch cycle.
- It is then incremented to point to the address of the next sequential instruction.
2. Memory Buffer/Data Register (MBR/MDR):
- Receives and holds the instruction data read from memory (from the address located in MAR) via the data bus.
- Temporarily stores this instruction code before it is copied to the Current Instruction Register (CIR) for decoding.

PastPaper.markingScheme

(a) 1 mark for correctly tracking STO 204 (updating memory[204] to 2), 1 mark for correct address calculation of LDX 200 (pointing to 202 and loading 88), 1 mark for correct addition execution (90 in ACC), 1 mark for final ACC value (91), 1 mark for final IX value (3).
(b) Program Counter (PC) (Max 3 marks): 1 mark for stating it holds the address of the next instruction; 1 mark for stating its address is copied to the MAR; 1 mark for stating it is incremented during the fetch cycle.
Memory Buffer Register (MBR/MDR) (Max 3 marks): 1 mark for stating it temporarily holds data/instructions retrieved from memory; 1 mark for stating it gets the data from the memory location specified by MAR; 1 mark for stating that the instruction is transferred from MBR/MDR to the Current Instruction Register (CIR).
PastPaper.question 3 · Structured
10.7 PastPaper.marks
This question is about relational databases.

A local sports organization manages clubs and member registration using a relational database. They have designed three tables as follows:

`tblMember` (`MemberID`, `FirstName`, `LastName`, `DateOfBirth`)
`tblClub` (`ClubID`, `ClubName`, `WeeklyFee`)
`tblRegistration` (`MemberID`, `ClubID`, `DateJoined`)

(a) Identify the relationship structures and key configurations: (5 marks)
1. State the primary key(s) and any foreign key(s) in the table `tblRegistration`.
2. State the type of relationship (e.g., 1-to-many) between `tblMember` and `tblRegistration`.
3. State the type of relationship between `tblClub` and `tblRegistration`.

(b) Write an SQL query to retrieve the `FirstName` and `LastName` of all members who registered for the club named 'Swimming' on or after '2023-01-01'. (6 marks)
PastPaper.showAnswers

PastPaper.workedSolution

(a) Relationships and keys:
1. Primary Key in `tblRegistration`: Composite Primary Key consisting of (`MemberID`, `ClubID`).
Foreign Keys in `tblRegistration`:
- `MemberID` which links to `tblMember(MemberID)`
- `ClubID` which links to `tblClub(ClubID)`
2. The relationship between `tblMember` and `tblRegistration` is 1-to-many (1:M).
3. The relationship between `tblClub` and `tblRegistration` is 1-to-many (1:M).

(b) SQL query:
```sql
SELECT tblMember.FirstName, tblMember.LastName
FROM tblMember
INNER JOIN tblRegistration ON tblMember.MemberID = tblRegistration.MemberID
INNER JOIN tblClub ON tblRegistration.ClubID = tblClub.ClubID
WHERE tblClub.ClubName = 'Swimming'
AND tblRegistration.DateJoined >= '2023-01-01';
```
Alternative working using implicit join syntax:
```sql
SELECT FirstName, LastName
FROM tblMember, tblRegistration, tblClub
WHERE tblMember.MemberID = tblRegistration.MemberID
AND tblRegistration.ClubID = tblClub.ClubID
AND ClubName = 'Swimming'
AND DateJoined >= '2023-01-01';
```

PastPaper.markingScheme

(a) 1. 1 mark for identifying composite/compound key containing both MemberID and ClubID. 1 mark for specifying MemberID is a foreign key, 1 mark for specifying ClubID is a foreign key.
2. 1 mark for identifying 1-to-many (1:M) relationship.
3. 1 mark for identifying 1-to-many (1:M) relationship.

(b) 1 mark for: SELECT FirstName, LastName (or with table prefixes)
1 mark for: FROM tblMember (plus joins/additional tables)
1 mark for: INNER JOIN / linking tblMember and tblRegistration on MemberID
1 mark for: INNER JOIN / linking tblRegistration and tblClub on ClubID
1 mark for: WHERE ClubName = 'Swimming'
1 mark for: AND DateJoined >= '2023-01-01' (accept correct date formats, e.g. #2023-01-01# or '01/01/2023')
PastPaper.question 4 · Structured
10.7 PastPaper.marks
This question is about programming algorithms and software testing.

The following pseudocode module scans an array of strings containing usernames. It is designed to count how many usernames are valid. To be valid, a username must have a length greater than 8 characters AND must contain no numeric digits ('0' to '9').

```pseudocode
CONSTANT MAX_USERS = 5
DECLARE Usernames : ARRAY[1..MAX_USERS] OF STRING
DECLARE ValidCount : INTEGER
DECLARE i, j : INTEGER
DECLARE HasDigit : BOOLEAN
DECLARE CurrentChar : CHAR

ValidCount <- 0
FOR i <- 1 TO MAX_USERS
IF LENGTH(Usernames[i]) > 8 THEN
HasDigit <- FALSE
FOR j <- 1 TO LENGTH(Usernames[i])
CurrentChar <- MID(Usernames[i], j, 1)
IF CurrentChar >= "0" AND CurrentChar <= "9" THEN
HasDigit <- TRUE
ENDIF
NEXT j
IF HasDigit = FALSE THEN
ValidCount <- ValidCount + 1
ENDIF
ENDIF
NEXT i
```

(a) Assume the array `Usernames` is initialized with the following values:
`["AdminUser123", "SuperDeveloper", "Guest", "CodeMaster", "User_99"]`

Trace the execution of this algorithm and state:
1. The final value of `ValidCount`. (2 marks)
2. The number of times the outer loop condition is checked and executed. (1 mark)
3. The total number of times the inner loop (`FOR j...`) is executed when `i = 2`. (2 marks)

(b) State the exact data type that should be used to declare the loop variables `i` and `j`. (1 mark)

(c) Software testing is essential to ensure this module behaves correctly. Compare white-box testing and black-box testing, and explain how each would be applied to test this algorithm. (5 marks)
PastPaper.showAnswers

PastPaper.workedSolution

(a) Trace tracking:
- `i = 1`: Usernames[1] is "AdminUser123". Length is 12 (> 8). Runs inner loop. It has digits ('1','2','3'), so `HasDigit` becomes TRUE. `ValidCount` remains 0.
- `i = 2`: Usernames[2] is "SuperDeveloper". Length is 14 (> 8). Runs inner loop 14 times. No digits are found, `HasDigit` remains FALSE. `ValidCount` is incremented to 1.
- `i = 3`: Usernames[3] is "Guest". Length is 5. Condition `LENGTH(Usernames[i]) > 8` is FALSE. Inner loop is skipped.
- `i = 4`: Usernames[4] is "CodeMaster". Length is 10 (> 8). Runs inner loop 10 times. No digits found, `HasDigit` remains FALSE. `ValidCount` is incremented to 2.
- `i = 5`: Usernames[5] is "User_99". Length is 7. Condition is FALSE. Inner loop is skipped.

Answers:
1. Final value of `ValidCount` = 2
2. The outer loop is executed 5 times (for i = 1 to 5).
3. For `i = 2`, the length of "SuperDeveloper" is 14, so the inner loop is executed exactly 14 times.

(b) INTEGER

(c) Comparison and Application:
- Black-box testing tests the program without access to or knowledge of the internal code structure. It is based on specifications/requirements. To apply it, a tester would input various test cases (e.g. usernames < 8 chars, exactly 8 chars, > 8 chars with digits, > 8 chars without digits) and verify if the actual value of `ValidCount` matches the expected output.
- White-box testing tests the internal structural logic and paths of the code. The tester has access to the pseudocode/source code. To apply it, the tester would design test inputs to ensure every branch/path is covered—for example, ensuring that the `IF CurrentChar >= "0"` condition is evaluated to both TRUE and FALSE, and ensuring the `IF LENGTH(Usernames[i]) > 8` block is both entered and bypassed.

PastPaper.markingScheme

(a) 1. 2 marks for correct final value of ValidCount (2). (1 mark for a trace that correctly processes at least 3 elements but miscounts the final total).
2. 1 mark for stating that the outer loop executes 5 times.
3. 2 marks for stating 14 times (the length of the string "SuperDeveloper"). 1 mark for identifying the correct index but off-by-one error (e.g., 13 or 15).
(b) 1 mark for: INTEGER
(c) 1 mark for defining Black-box testing (no access to source code; testing inputs vs expected outputs).
1 mark for defining White-box testing (access to source code; testing logic paths, statements, and conditions).
1 mark for applying Black-box to the scenario (e.g. testing border conditions like length 8, length 9, usernames with digits).
1 mark for applying White-box to the scenario (e.g. ensuring path coverage for both branches of digit check/length check).
1 mark for clear structural comparison in the explanation.
PastPaper.question 5 · Structured
10.7 PastPaper.marks
This question is about user-defined data types and composite structures in pseudocode.

A library management system stores information about its books. Each book is represented as a structured data record called `Book` with the following attributes:
- `ISBN`: a unique text code of 13 characters
- `Title`: the title of the book
- `Price`: the cost of the book (real/decimal number)
- `InStock`: a binary status indicating if the book is available

(a) Write pseudocode to define the user-defined record type `Book`. (4 marks)

(b) Write pseudocode to declare a 1D array named `LibraryInventory` that can store up to 500 records of type `Book`. (2 marks)

(c) Write a pseudocode procedure `PrintInStock` which takes the `LibraryInventory` array as a parameter, loops through all 500 records, and prints/outputs the `Title` and `Price` of every book that is currently in stock (`InStock = TRUE`). (5 marks)
PastPaper.showAnswers

PastPaper.workedSolution

(a) Record definition:
```pseudocode
TYPE Book
DECLARE ISBN : STRING
DECLARE Title : STRING
DECLARE Price : REAL
DECLARE InStock : BOOLEAN
ENDTYPE
```
Note: Accept alternative standard data type names, e.g., `DECIMAL` / `DOUBLE` for `Price` and `BOOL` for `InStock`.

(b) Array declaration:
```pseudocode
DECLARE LibraryInventory : ARRAY[1..500] OF Book
```
Note: Accept index range starting from 0 (e.g., `0..499`) if adjusted consistently.

(c) Procedure implementation:
```pseudocode
PROCEDURE PrintInStock(Inventory : ARRAY OF Book)
DECLARE i : INTEGER
FOR i <- 1 TO 500
IF Inventory[i].InStock = TRUE THEN
OUTPUT Inventory[i].Title, Inventory[i].Price
ENDIF
NEXT i
ENDPROCEDURE
```

PastPaper.markingScheme

(a) 1 mark for correct structure start/end (TYPE Book ... ENDTYPE).
1 mark for declaring ISBN and Title as STRING (or CHAR array).
1 mark for declaring Price as REAL (or FLOAT/DECIMAL).
1 mark for declaring InStock as BOOLEAN.

(b) 1 mark for proper array declaration syntax (DECLARE ArrayName : ARRAY[...] OF).
1 mark for correct dimensions (1..500 or 0..499) and data type (Book).

(c) 1 mark for correct procedure header and end (PROCEDURE PrintInStock(...) ... ENDPROCEDURE).
1 mark for declaring loop index variable (i : INTEGER).
1 mark for correct loop control iterating through all elements (1 to 500).
1 mark for correct logical check on the object property (IF Inventory[i].InStock = TRUE THEN).
1 mark for correct OUTPUT statement referencing individual properties (.Title, .Price).
PastPaper.question 6 · Structured
10.7 PastPaper.marks
This question is about system software.

(a) The operating system (OS) is responsible for managing system resources. Describe how an operating system performs the following two tasks: (6 marks)
1. Memory Management
2. Process Scheduling

(b) Explain the difference between utility software and application software. Give one example of each to support your explanation. (5 marks)
PastPaper.showAnswers

PastPaper.workedSolution

(a) 1. Memory Management:
- The OS allocates and deallocates memory space to active programs/processes dynamically.
- It keeps track of every memory location, recording whether it is free or allocated to a specific process.
- It implements virtual memory systems (using techniques like paging or segmentation) to allow processes to execute when there is insufficient physical RAM.
- It ensures memory protection, preventing processes from writing to or accessing memory allocated to other programs or the OS kernel itself.

2. Process Scheduling:
- The OS decides which process in the ready queue receives access to the CPU and for how long, using specific scheduling algorithms (e.g., Round Robin, First Come First Served, Shortest Job First).
- It handles interrupts generated by hardware or software, stopping the current process to run high-priority service routines.
- It manages context switching, saving the state of the current running process and loading the state of the next process to enable multitasking.

(b) Comparison:
- Utility software: System software designed to help maintain, optimize, configure, and protect the computer system. It works behind the scenes on infrastructure-level operations, rather than performing tasks directly for end-user projects.
- Example: Antivirus software, disk defragmenters, file compression tools, backup utilities.
- Application software: Programs designed to help end-users perform specific tasks, projects, or entertainment-focused activities (such as writing documents or editing photos).
- Example: Word processors, web browsers, photo editors, spreadsheet applications.

PastPaper.markingScheme

(a) Memory Management (Max 3 marks):
- 1 mark for allocation/deallocation of memory blocks to active programs.
- 1 mark for memory protection/preventing cross-process interference.
- 1 mark for virtual memory / paging / segmentation implementation.
Process Scheduling (Max 3 marks):
- 1 mark for using algorithms (e.g. Round Robin) to determine CPU time share.
- 1 mark for handling context switching / saving and loading states.
- 1 mark for processing interrupts.

(b) Comparison (Max 5 marks):
- 1 mark for utility definition (system optimization/maintenance/protection).
- 1 mark for correct utility example (e.g., firewall, defragmenter, zip tool).
- 1 mark for application definition (user-centric software to perform specific tasks).
- 1 mark for correct application example (e.g., MS Word, Chrome, Photoshop).
- 1 mark for a clear comparative statement contrasting their focus (system infrastructure support vs end-user productivity).
PastPaper.question 7 · Structured
10.7 PastPaper.marks
This question is about data security, integrity, and transmission validation.

(a) Compare data security and data integrity. State clearly how they differ in purpose and give one method used to achieve each. (4 marks)

(b) Data is being transmitted across a local area network. To detect errors, the system adds an even parity bit as the most significant bit (the 8th bit) of each transmitted character byte.
1. The character 'E' has the 7-bit ASCII representation `1000101`. Identify the value of the parity bit that must be added to make it even parity. Explain your answer. (3 marks)
2. Explain how the receiving computer uses the parity bit to detect transmission errors, and state one key limitation of using a simple parity check. (4 marks)
PastPaper.showAnswers

PastPaper.workedSolution

(a) Comparison:
- Data Security is about protecting data against unauthorized access, theft, loss, or corruption. The main goal is confidentiality and restriction of unauthorized access.
- Method: Encryption, firewalls, user permissions/passwords.
- Data Integrity is about ensuring that data remains accurate, consistent, and complete throughout its lifecycle. The main goal is to prevent accidental corruption or data entry errors.
- Method: Validation checks (e.g., range check) or verification checks (e.g., checksum, parity check).

(b) 1. Parity calculation:
- The 7-bit representation is `1000101`.
- Count the number of 1s in this representation: there are three 1s (which is an odd number).
- For even parity, the total number of 1s in the complete 8-bit byte must be an even number.
- Therefore, the parity bit must be set to `1` (which makes the total number of 1s equal to 4, an even number).

2. Parity check detection and limitations:
- Detection: When the receiving computer gets the 8-bit byte, it counts the total number of 1s in it. If even parity is used, and the count of 1s is odd, the receiver knows that a transmission error has occurred and requests a retransmission.
- Limitation: A simple parity check cannot detect errors if an even number of bits are flipped/corrupted in transit (e.g., if two bits are swapped or flipped, the overall count of 1s still preserves its even/odd parity status, hiding the error).

PastPaper.markingScheme

(a) 1 mark for defining security (protection from unauthorized access/theft).
1 mark for security method (e.g. encryption/firewall).
1 mark for defining integrity (maintaining correctness/accuracy/completeness).
1 mark for integrity method (e.g. validation rules/checksums).

(b) 1. 1 mark for counting three 1s in the ASCII character.
1 mark for identifying the correct parity bit as 1.
1 mark for explaining that setting it to 1 results in 4 ones, which is an even number.
2. 1 mark for receiver counting the number of 1s upon arrival.
1 mark for stating that an odd count indicates an error has occurred (since even parity is expected).
1 mark for stating the limitation: cannot detect if an even number of bits flip.
1 mark for explaining that flipped pairs keep the parity bit matching despite data corruption.

Paper 2: Fundamental Problem-solving and Programming Skills

Answer all questions. Refer to the enclosed insert for list of standard pseudocode functions. Total marks: 75.
7 PastPaper.question · 74.9 PastPaper.marks
PastPaper.question 1 · Pseudocode Construction & Analysis
10.7 PastPaper.marks
An airline wants to track frequent flyer accounts. Each passenger is represented by a record of type Passenger:

TYPE Passenger
DECLARE PassengerID : STRING
DECLARE Name : STRING
DECLARE MilesAccumulated : INTEGER
DECLARE Tier : STRING
ENDTYPE

An array Fliers : ARRAY[1:500] OF Passenger stores passenger data. Write a pseudocode procedure UpdateTiers() which iterates through the array and updates the Tier field of each passenger based on MilesAccumulated:
- Under 10000 miles: "Bronze"
- 10000 to 50000 miles (inclusive): "Silver"
- Over 50000 miles: "Gold"

The procedure should also count and output the total number of gold tier members.
PastPaper.showAnswers

PastPaper.workedSolution

To complete this procedure, we need to loop through all 500 records in the 1D array 'Fliers'. For each passenger, we access their 'MilesAccumulated' field using the dot notation 'Fliers[i].MilesAccumulated'. We use conditional nested IF-THEN-ELSE statements to compare this value and assign the correct string to the 'Tier' field. If the passenger's miles exceed 50000, we update their status to 'Gold' and increment our running count of gold members. Finally, the procedure outputs the calculated count.

PastPaper.markingScheme

1 mark: Correct PROCEDURE header and ENDPROCEDURE
1 mark: Loop from 1 to 500 using FOR/TO/NEXT
1 mark: Proper indexing of Fliers[i]
2 marks: Correct condition for Bronze (< 10000) and Silver (10000 to 50000)
2 marks: Correct condition and assignment for Gold (> 50000)
1 mark: Initializing GoldCount to 0
1 mark: Incrementing GoldCount inside the correct condition branch
1.7 marks: OUTPUT of GoldCount after the loop completes.
PastPaper.question 2 · Pseudocode Construction & Analysis
10.7 PastPaper.marks
Write a pseudocode function ValidatePassword(Password : STRING) RETURNS BOOLEAN that validates an employee's password based on the following three rules:
1. It must be exactly 8 characters long.
2. It must start with an uppercase letter (A to Z).
3. It must end with a digit (0 to 9).

Use standard pseudocode string functions such as LENGTH(Str) and MID(Str, Start, Length).
PastPaper.showAnswers

PastPaper.workedSolution

The function starts by verifying the length of the string 'Password' using LENGTH(Password). If it is not exactly 8 characters, it immediately returns FALSE. Next, it extracts the first character using MID(Password, 1, 1) and checks if it falls within the character range 'A' to 'Z'. If not, it returns FALSE. Finally, it extracts the eighth character using MID(Password, 8, 1) and checks if it is a digit between '0' and '9'. If all conditions are satisfied, it returns TRUE.

PastPaper.markingScheme

1 mark: Correct FUNCTION header with parameters, return type, and ENDFUNCTION
1 mark: Correct use of LENGTH() function
1.7 marks: Check if length is exactly 8 (returns FALSE if not)
2 marks: Correct extraction and validation of first character (uppercase check)
2 marks: Correct extraction and validation of last character at index 8 (digit check)
1 mark: Returns FALSE if any rule fails
2 marks: Returns TRUE if all rules are satisfied
PastPaper.question 3 · Pseudocode Construction & Analysis
10.7 PastPaper.marks
A school class's seating arrangement is tracked in a 2D array Seating : ARRAY[1:6, 1:5] OF STRING. If a seat is unoccupied, it contains the string "EMPTY".

Write a pseudocode function CountEmptySeats() RETURNS INTEGER that counts and returns the number of empty seats. Then, write a procedure FindStudent(StudentName : STRING) that searches the array for StudentName and outputs the Row and Column where they are seated. If the student is not in the seating plan, output "Not found".
PastPaper.showAnswers

PastPaper.workedSolution

For CountEmptySeats(), nested loops iterate through all elements of the 2D array Seating[1..6, 1..5]. Each time 'EMPTY' is found, the count variable increments, and this count is returned. For FindStudent, we search for the StudentName across the array. When a match is found, we output its Row and Col indices, and set a flag Found to TRUE. If the loops complete and Found remains FALSE, we output 'Not found'.

PastPaper.markingScheme

1 mark: CountEmptySeats() header and ENDFUNCTION
1 mark: Nested loop structure (1 to 6, 1 to 5) in CountEmptySeats()
1 mark: Correct conditional comparison and counter increment
1 mark: Returning the correct count
1 mark: FindStudent() header, parameters, and ENDPROCEDURE
1 mark: Use of nested loop structure in FindStudent()
1.7 marks: Proper comparison Seating[Row, Col] = StudentName
1 mark: Tracking matching state with a Boolean flag 'Found'
1 mark: Outputs the indices Row and Column when found
1 mark: Output 'Not found' if the flag is still FALSE after the search
PastPaper.question 4 · Pseudocode Construction & Analysis
10.7 PastPaper.marks
A text file named Scores.txt contains alternate lines of student names (STRING) and test scores (INTEGER). Write a pseudocode procedure ProcessScores(PassMark : INTEGER) that performs the following actions:
1. Opens the file Scores.txt for reading.
2. Creates/opens a new file named Passed.txt for writing.
3. Reads the records line by line.
4. Writes the name of any student who achieved a score greater than or equal to PassMark to Passed.txt.
5. Closes both files.
PastPaper.showAnswers

PastPaper.workedSolution

The procedure opens 'Scores.txt' in READ mode and 'Passed.txt' in WRITE mode. It uses a WHILE loop to read pairs of values (StudentName on one line, TestScore on the next) until the end of the input file (EOF) is reached. If the TestScore is greater than or equal to the PassMark, the corresponding StudentName is written to 'Passed.txt'. Finally, both files are closed to free system resources.

PastPaper.markingScheme

1 mark: Correct procedure declaration with PassMark parameter
1 mark: Open 'Scores.txt' for READ and 'Passed.txt' for WRITE
1.7 marks: Correct EOF loop condition on 'Scores.txt'
2 marks: Alternating READFILE commands for StudentName and TestScore in correct sequence
1 mark: Correct condition TestScore >= PassMark
2 marks: Correct WRITEFILE command writing only StudentName to Passed.txt
1 mark: Closing both files correctly
1 mark: Declaring variables with correct local scope and types
PastPaper.question 5 · Pseudocode Construction & Analysis
10.7 PastPaper.marks
A library system maintains a 1D array LibraryBooks : ARRAY[1:1000] OF STRING. Elements that are unused contain the string "FREE". Write a pseudocode function AddBook(NewISBN : STRING) RETURNS BOOLEAN that searches through LibraryBooks. If it finds a "FREE" element, it must insert the NewISBN at that position and return TRUE. If the array is full and no "FREE" element exists, the function must return FALSE.
PastPaper.showAnswers

PastPaper.workedSolution

The function starts by initializing a boolean flag Inserted to FALSE and an Index counter to 1. A WHILE loop is used to iterate through the array as long as the Index is within bounds (<= 1000) and the book has not been inserted. If the value at LibraryBooks[Index] is "FREE", we update that element with NewISBN and set Inserted to TRUE, which terminates the loop. Otherwise, we increment the Index. Finally, the function returns the value of Inserted.

PastPaper.markingScheme

1 mark: Correct function header with parameter and BOOLEAN return type
1 mark: Correct declaration and initialization of loop index and boolean flag
2 marks: Loop condition checking index boundary and search status
2 marks: Correct condition matching "FREE" string
2 marks: Correct insertion of NewISBN at the vacant index
1 mark: Loop termination/exit criteria met when element is found
1.7 marks: Returns correct Boolean value (TRUE if inserted, FALSE if full)
PastPaper.question 6 · Pseudocode Construction & Analysis
10.7 PastPaper.marks
A queue is implemented as a linear queue of size 20 using a 1D array Queue : ARRAY[1:20] OF STRING.
Three global variables track the status of the queue:
- HeadPointer : INTEGER (index of the first element)
- TailPointer : INTEGER (index of the next available slot)
- NumItems : INTEGER (count of elements in the queue)

Initially, HeadPointer <- 1, TailPointer <- 1, and NumItems <- 0.
Write a pseudocode procedure Enqueue(NewItem : STRING) to insert an item into the queue. Assume a circular queue structure where pointers wrap around (using index 1 after 20). If the queue is full, output "Queue Overflow".
PastPaper.showAnswers

PastPaper.workedSolution

The Enqueue procedure first checks if the queue is full by comparing NumItems to the maximum size (20). If it is full, it outputs 'Queue Overflow'. Otherwise, it inserts 'NewItem' at the position indicated by TailPointer and increments the NumItems counter. It then updates TailPointer: if TailPointer is at 20, it wraps around to 1; otherwise, it is incremented by 1.

PastPaper.markingScheme

1 mark: Correct procedure header and parameter type
2 marks: Checks if the queue is full (NumItems = 20) and outputs appropriate message
1 mark: Writes the item at Queue[TailPointer]
1 mark: Increments NumItems counter
2 marks: Checks if TailPointer needs to wrap around (if TailPointer = 20)
2 marks: Sets TailPointer to 1 if wrap-around is needed, else increments TailPointer
0.7 marks: Correct structural layout using IF-THEN-ELSE
PastPaper.question 7 · Pseudocode Construction & Analysis
10.7 PastPaper.marks
Consider the following pseudocode algorithm:

FUNCTION Mystery(Num : INTEGER) RETURNS INTEGER
DECLARE Temp, Result : INTEGER
Result <- 0
WHILE Num > 0 DO
Temp <- Num MOD 10
IF Temp MOD 2 = 0 THEN
Result <- Result + Temp
ENDIF
Num <- Num DIV 10
ENDWHILE
RETURN Result
ENDFUNCTION

Trace the execution of Mystery(4728) by completing a dry run. Create a trace table listing the values of the variables: Num, Temp, and Result at each step of the algorithm.
PastPaper.showAnswers

PastPaper.workedSolution

The function Mystery takes an integer and processes its digits from right to left using modulo 10 (MOD 10) to extract the last digit, and integer division by 10 (DIV 10) to remove the last digit. If a digit is even (Temp MOD 2 = 0), it is added to 'Result'.
- For '4728':
- Last digit 8: even, Result = 8, Num becomes 472.
- Next digit 2: even, Result = 8 + 2 = 10, Num becomes 47.
- Next digit 7: odd, Result remains 10, Num becomes 4.
- Next digit 4: even, Result = 10 + 4 = 14, Num becomes 0.
- Loop terminates. The final returned value is 14.

PastPaper.markingScheme

2 marks: Correct tracing of the first iteration (Temp = 8, Result = 8, Num = 472)
2 marks: Correct tracing of the second iteration (Temp = 2, Result = 10, Num = 47)
2 marks: Correct tracing of the third iteration (Temp = 7, Result = 10, Num = 4)
2 marks: Correct tracing of the fourth iteration (Temp = 4, Result = 14, Num = 0)
1 mark: Loop termination correct (when Num becomes 0)
1.7 marks: Final returned value of 14 correct

PastPaper.sampleCTATitle

PastPaper.sampleCTADescription

PastPaper.sampleStickyMessage

PastPaper.stickyCtaText