An original Thinka practice paper modelled on the structure and difficulty of the Nov 2024 (V1) Cambridge IGCSE Computer Science (0478) paper. Not affiliated with or reproduced from Cambridge.
Paper 11 Computer Systems
Answer all questions. Calculators must not be used.
10 Question · 71 marks
Question 1 · short_answer
5 marks
A photographer needs to store high-resolution raw photos for professional editing and lower-resolution versions for her online blog portfolio.
(a) Identify which type of compression (lossy or lossless) is most suitable for storing the raw photos for professional editing. Explain your choice. [3]
(b) Identify which type of compression is most suitable for the photos on the online blog portfolio. Explain your choice. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) Lossless compression. Because raw photos require all original data to be preserved so that no quality is lost during professional editing. Any loss of pixels or colour depth would degrade the final edited product. (b) Lossy compression. Because the files need to be small in size for fast loading on web pages, and the slight reduction in quality is not noticeable to the human eye on a screen.
Marking scheme
(a) Maximum 3 marks: - 1 mark for identifying lossless compression. - 1 mark for explaining that all original data/quality is preserved / no data is lost. - 1 mark for linking to the requirements of professional editing (e.g., maintaining maximum detail/resolution/colour accuracy).
(b) Maximum 2 marks: - 1 mark for identifying lossy compression. - 1 mark for explaining that it significantly reduces file size (for faster web transmission/loading) or that the reduction in quality is acceptable/not noticeable on a standard screen.
Question 2 · short_answer
5 marks
An automated greenhouse system controls the environmental conditions for growing rare tropical plants.
(a) Identify two different sensors that would be used to monitor the conditions in the greenhouse. [2]
(b) Identify two actuators that would be used to change the conditions in the greenhouse. [2]
(c) State the role of the microprocessor in this automated system. [1]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) Two suitable sensors: Temperature sensor, Humidity/Moisture sensor, Light sensor, pH sensor, Carbon dioxide sensor. (b) Two suitable actuators: Heater, Sprinkler/water pump, Fan, Motor (to open/close windows), Artificial light. (c) Role of the microprocessor: It receives data from the sensors, compares these readings to pre-stored preset values, and sends control signals to the actuators if any changes are needed to restore the ideal conditions.
Marking scheme
(a) 1 mark for each correct sensor (max 2). (b) 1 mark for each correct actuator (max 2). (c) 1 mark for stating that the microprocessor compares sensor data to preset values and decides whether to send signals to the actuators.
Question 3 · short_answer
5 marks
Registers and buses are key components of the Von Neumann CPU architecture.
(a) Identify the CPU register that holds the memory address of the *next* instruction to be fetched. [1]
(b) Explain the role of the Memory Data Register (MDR) during the fetch stage of the cycle. [2]
(c) Identify the bus used to transmit signals to coordinate all CPU activities, and state whether this bus is unidirectional, bidirectional, or both. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) Program Counter (PC). (b) During the fetch stage, the instruction stored at the address currently in the MAR is copied into the Memory Data Register (MDR). The MDR acts as a temporary holding buffer before the instruction is sent to the CIR for decoding. (c) Control Bus. It is bidirectional because it transmits control and timing signals from the Control Unit to other computer components, and receives status/interrupt feedback signals from those components back to the CPU.
Marking scheme
(a) 1 mark for Program Counter / PC. (b) Max 2 marks: - 1 mark for stating it temporarily holds the fetched instruction/data. - 1 mark for stating it receives the instruction from the memory location specified by the MAR. (c) Max 2 marks: - 1 mark for identifying the Control Bus. - 1 mark for stating it is bidirectional.
Question 4 · matching
5 marks
Match each storage medium to its correct description. Write the correct letter (A to E) next to each description (1 to 5).
Storage Medium: A - SSD B - Magnetic Tape C - DVD-RAM D - RAM E - ROM
Description: 1. Non-volatile primary memory containing the start-up instructions (bootstrap loader). [1] 2. Volatile primary memory used to hold data and programs currently in use by the CPU. [1] 3. Non-volatile optical storage that allows simultaneous read and write operations. [1] 4. Non-volatile secondary storage that uses flash memory and has no moving parts. [1] 5. Magnetic storage medium that uses serial access, commonly used for offline backups. [1]
Show answer & marking schemeHide answer & marking scheme
Worked solution
1 matches E (ROM) because ROM is non-volatile primary memory that stores the bootstrap loader. 2 matches D (RAM) because RAM is volatile primary memory used for active programs/data. 3 matches C (DVD-RAM) because it is optical and uses concentric tracks to allow concurrent read/write. 4 matches A (SSD) because SSD is solid-state (flash memory, zero moving parts). 5 matches B (Magnetic Tape) because it utilizes serial access and is ideal for offline archives.
Marking scheme
Award 1 mark for each correct match (Total 5 marks): - Description 1: E - Description 2: D - Description 3: C - Description 4: A - Description 5: B
Question 5 · structured
11 marks
A user enters text and multimedia data into a computer system. The system uses various number systems to represent and process this data.
(a) Convert the following denary ASCII character values into 8-bit binary: (i) The character 'D' has the denary value 68. Convert this value to 8-bit binary. [1] (ii) The character 's' has the denary value 115. Convert this value to 8-bit binary. [1]
(b) Convert the following binary ASCII representations into hexadecimal: (i) 01001101 [1] (ii) 01100110 [1]
(c) A sound sample is represented as a 12-bit binary number: 101001101100. (i) Convert this binary number to hexadecimal. Show your working. [2] (ii) Convert the first 8 bits of this number (10100110) to a denary value. Show your working. [2]
(d) Perform a logical left shift of three places on the binary value 00011101. Give the resulting 8-bit binary number. [1]
(e) Two binary numbers are 01011011 and 00101110. Add these two binary numbers together using binary addition. Show all your working. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) (i) 68 in binary: 64 + 4 = 01000100 (ii) 115 in binary: 64 + 32 + 16 + 2 + 1 = 01110011
(b) (i) 01001101 split into nibbles is 0100 (4) and 1101 (D) -> 4D (ii) 01100110 split into nibbles is 0110 (6) and 0110 (6) -> 66
(c) (i) Split 101001101100 into groups of 4 bits from right to left: 1010, 0110, 1100. Convert each nibble: 1010 = A, 0110 = 6, 1100 = C. Result: A6C. (ii) 10100110 converted to denary: \(128 + 32 + 4 + 2 = 166\).
(d) Shift 00011101 left by 3 places. The three left-most bits are discarded and replaced by three zeros on the right: 11101000.
**Part (a)** - (i) 1 mark for 01000100 (accept 1000100) - (ii) 1 mark for 01110011 (accept 1110011)
**Part (b)** - (i) 1 mark for 4D (accept 4d) - (ii) 1 mark for 66
**Part (c)** - (i) 2 marks: - 1 mark for showing correct working (splitting into nibbles: 1010, 0110, 1100) - 1 mark for correct final answer: A6C - (ii) 2 marks: - 1 mark for showing correct working (addition of weights: \(128 + 32 + 4 + 2\)) - 1 mark for correct final answer: 166
**Part (d)** - 1 mark for 11101000
**Part (e)** - 2 marks: - 1 mark for showing correct carries / column addition process - 1 mark for correct binary sum: 10001001
Question 6 · structured
11 marks
A user enters text and multimedia data into a computer system. The system uses various number systems to represent and process this data.
(a) Convert the following denary ASCII character values into 8-bit binary: (i) The character 'D' has the denary value 68. Convert this value to 8-bit binary. [1] (ii) The character 's' has the denary value 115. Convert this value to 8-bit binary. [1]
(b) Convert the following binary ASCII representations into hexadecimal: (i) 01001101 [1] (ii) 01100110 [1]
(c) A sound sample is represented as a 12-bit binary number: 101001101100. (i) Convert this binary number to hexadecimal. Show your working. [2] (ii) Convert the first 8 bits of this number (10100110) to a denary value. Show your working. [2]
(d) Perform a logical left shift of three places on the binary value 00011101. Give the resulting 8-bit binary number. [1]
(e) Two binary numbers are 01011011 and 00101110. Add these two binary numbers together using binary addition. Show all your working. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) (i) 68 in binary: 64 + 4 = 01000100 (ii) 115 in binary: 64 + 32 + 16 + 2 + 1 = 01110011
(b) (i) 01001101 split into nibbles is 0100 (4) and 1101 (D) -> 4D (ii) 01100110 split into nibbles is 0110 (6) and 0110 (6) -> 66
(c) (i) Split 101001101100 into groups of 4 bits from right to left: 1010, 0110, 1100. Convert each nibble: 1010 = A, 0110 = 6, 1100 = C. Result: A6C. (ii) 10100110 converted to denary: \(128 + 32 + 4 + 2 = 166\).
(d) Shift 00011101 left by 3 places. The three left-most bits are discarded and replaced by three zeros on the right: 11101000.
**Part (a)** - (i) 1 mark for 01000100 (accept 1000100) - (ii) 1 mark for 01110011 (accept 1110011)
**Part (b)** - (i) 1 mark for 4D (accept 4d) - (ii) 1 mark for 66
**Part (c)** - (i) 2 marks: - 1 mark for showing correct working (splitting into nibbles: 1010, 0110, 1100) - 1 mark for correct final answer: A6C - (ii) 2 marks: - 1 mark for showing correct working (addition of weights: \(128 + 32 + 4 + 2\)) - 1 mark for correct final answer: 166
**Part (d)** - 1 mark for 11101000
**Part (e)** - 2 marks: - 1 mark for showing correct carries / column addition process - 1 mark for correct binary sum: 10001001
Question 7 · structural
11 marks
A computer's central processing unit (CPU) is based on the Von Neumann architecture.
(a) (i) Identify the register in the CPU that stores the address of the next instruction to be fetched.
(ii) Identify the register in the CPU that stores the instruction currently being decoded.
(b) Describe what happens during the execute stage of the fetch-decode-execute cycle.
(c) State the name of one component in the CPU, other than a register, that is used during the execute stage.
(d) Buses are used within the CPU to transfer signals and data. Identify three CPU buses by choosing from the list below:
• address • optical • system • logical • accumulator • control • serial • parallel • data • register
(e) A school upgrades its computer systems. The new computers have CPUs with a quad-core processor instead of a dual-core processor, but the clock speed remains unchanged at 3.0 GHz.
Explain the effect this change will have on the performance of the computer.
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) (i) The Program Counter (PC) holds the memory address of the next instruction. (ii) The Current Instruction Register (CIR) holds the instruction currently being decoded. (b) In the execute stage, the CPU carries out the instruction. The Control Unit directs other components (like the ALU) using signals. If an operation requires calculation, the ALU executes it, and the results are loaded into the Accumulator or written to memory. (c) The ALU (Arithmetic Logic Unit) or the CU (Control Unit) is utilized during execution. (d) The three primary CPU system buses are the data bus, address bus, and control bus. (e) Doubling the number of processor cores allows the computer to execute up to four instruction streams in parallel. This significantly increases system performance when running multi-threaded applications, although individual single-threaded tasks will not run any faster because the clock speed is unchanged.
Marking scheme
(a) One mark for each correct register: (i) Program Counter // PC [1] (ii) Current Instruction Register // CIR [1]
(b) Max three marks from: • The decoded instruction is passed as control signals to relevant CPU components [1] • The instruction is carried out / executed [1] • Arithmetic calculations or logic comparisons are performed by the ALU [1] • Results of operations are written to the Accumulator (ACC) // memory [1] • Data may be read from or written to memory locations [1]
(c) One mark for any of the following: • Arithmetic Logic Unit // ALU [1] • Control Unit // CU [1]
(d) One mark for each correct bus identified (Max 3 marks): • address [1] • control [1] • data [1]
(e) Max two marks from: • Multiple instructions can be processed at the same time // parallel processing can occur [1] • Multitasking performance is improved / overall throughput is increased [1] • (However) performance does not scale linearly as some programs cannot utilize multiple cores [1] • Individual program thread speed remains unchanged because clock speed is the same [1]
Question 8 · descriptive
10 marks
A developer is writing a custom inventory management system in a high-level programming language.
(a) Explain two differences between a compiler and an interpreter when translating high-level code. [4]
(b) The developer uses an Integrated Development Environment (IDE) to write the code. Identify two features of an IDE, other than a translator, and explain how each feature helps the developer write code more efficiently. [4]
(c) State two benefits of writing the software in a high-level language rather than a low-level language. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) 1. A compiler translates the entire source code into machine code all at once, whereas an interpreter translates and executes the source code line-by-line. 2. A compiler produces an independent executable file (.exe), whereas an interpreter does not produce an executable file and requires the source code to run the program. 3. A compiler reports all syntax errors at the end of the translation process, whereas an interpreter stops execution the moment it encounters an error.
(b) 1. Prettyprinting / Syntax Highlighting: Color-codes keywords, variables, and comments, which makes the code easier to read and helps the developer quickly spot missing brackets or syntax mistakes. 2. Auto-completion / Auto-suggestion: Predicts and suggests built-in functions or variables as the developer types, which saves development time and reduces spelling errors. 3. Error Diagnostics: Highlights syntax errors in real-time as the developer is writing code, allowing immediate correction.
(c) 1. High-level language code is easier to read, write, and maintain because it uses English-like statements. 2. High-level languages are portable (machine-independent) and can run on different CPU architectures without major modification.
Marking scheme
(a) Max 4 marks, 2 marks per difference. For each difference, 1 mark for the compiler characteristic and 1 mark for the corresponding interpreter characteristic. - Compiler translates the entire program at once (1) whereas interpreter translates line-by-line (1). - Compiler creates an executable file (1) whereas interpreter does not / requires the source code to run (1). - Compiler reports all errors at the end (1) whereas interpreter stops execution immediately at the first error (1). - Compiled code runs faster once translated (1) whereas interpreted code runs slower as it translates during execution (1).
(b) Max 4 marks, 2 marks per feature. 1 mark for identifying the feature, 1 mark for explaining how it helps. Features include: - Prettyprinting / Syntax highlighting (1) makes the structure of the code clearer / easier to identify syntax elements (1). - Auto-completion / Auto-suggestion (1) reduces spelling mistakes / increases typing speed (1). - Error diagnostics (1) alerts the developer to syntax errors immediately while writing (1). - Auto-correction (1) corrects minor typing errors automatically (1). - Code folding (1) allows the developer to collapse sections of code to navigate the file more easily (1).
(c) Max 2 marks, 1 mark per benefit. - Easier/quicker to write/read/debug because it uses English-like syntax (1). - Portable / machine independent (1). - Programmer does not need to understand CPU architecture/registers (1). - Offers standard libraries/built-in functions (1).
Question 9 · structured
4 marks
An operating system uses memory management to ensure the computer system runs efficiently.
Describe the role of the operating system in memory management.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The operating system controls memory allocation. It tracks all memory locations (such as RAM addresses) and assigns them to processes that need to execute. It ensures processes do not corrupt each other's memory spaces. When a process finishes, the operating system deallocates that memory to make it available for other programs. It also manages virtual memory when the RAM is insufficient.
Marking scheme
Award 1 mark per correct point, up to a maximum of 4 marks: - Allocates memory space/RAM to active processes and applications. - Deallocates memory space when a process terminates or is closed. - Tracks all memory locations and records which process is currently using them. - Prevents processes from overwriting or interfering with each other's memory space (enforcing security boundaries). - Manages virtual memory (swapping pages of data between RAM and secondary storage when RAM capacity is exceeded).
Question 10 · structured
4 marks
Blockchain is a decentralised, distributed ledger technology used to record transactions across many computers.
Explain how a blockchain ensures that transactions are secure and cannot be altered once they are recorded.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Blockchain achieves immutability through cryptographic hashing and decentralisation. Each block contains a block hash and the hash of the preceding block. Changing a single transaction alters that block's hash, breaking the link to the next block. Because the entire ledger is distributed across a network of nodes, a majority consensus must be reached to update or validate any data, making fraudulent alterations nearly impossible.
Marking scheme
Award 1 mark per correct point, up to a maximum of 4 marks: - Transactions are grouped into blocks, where each block contains a unique cryptographic hash. - Each block also contains the hash of the previous block, creating a secure chronological chain. - Attempting to change a transaction alters that block's hash, immediately breaking the cryptographic chain. - The ledger is shared/distributed across a peer-to-peer network, meaning there is no single point of failure. - Consensus mechanisms (such as agreement by a majority of network nodes) are required to validate new blocks and reject unauthorized modifications.
Ready to test yourself?
Turn these notes into exam-style practice. Get unlimited AI questions on this topic with instant marking and explanations.
Answer all questions. Calculators must not be used.
11 Question · 71 marks
Question 1 · short_answer
3 marks
A new online banking system requires customers to set up a numeric passcode. The passcode must contain exactly six digits. Identify three different validation checks that can be performed on the passcode during input.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Length check: to ensure that the input is exactly six characters long. 2. Type check: to ensure that only numeric digits (0-9) are entered. 3. Presence check: to ensure that the passcode field is not left empty.
Marking scheme
One mark for each correct validation check identified, up to a maximum of three marks. Acceptable answers include: Length check, Type/Character check, Presence check, Range check.
Question 2 · short_answer
3 marks
In pseudocode, various operators are used to perform different tasks. Classify each of the following operators as Arithmetic, Relational, or Logical: 1) AND 2) <> 3) MOD
Show answer & marking schemeHide answer & marking scheme
Worked solution
1) AND is a Logical operator used for Boolean logic operations. 2) <> is a Relational operator used to compare if two values are not equal. 3) MOD is an Arithmetic operator used to find the remainder of a division.
Marking scheme
One mark for each correct classification. 1) Logical (1 mark). 2) Relational / Comparison (1 mark). 3) Arithmetic (1 mark).
Question 3 · short_answer
3 marks
Explain the difference between normal, extreme, and abnormal test data when testing an algorithm that accepts integers between 1 and 100 inclusive.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Normal test data represents valid values within the normal expected range (e.g. 50). Extreme test data represents valid values at the outer limits of the range (e.g. 1 and 100). Abnormal test data represents invalid values that should be rejected by the algorithm (e.g. -5, 105, or 'abc').
Marking scheme
One mark for each correct explanation. Normal: valid data within the range (1 mark). Extreme: valid data at the limits/boundaries (1 mark). Abnormal: invalid data outside the range or of the wrong type (1 mark).
Question 4 · short_answer
3 marks
Verification is used to ensure that data has not been changed during entry. Describe how the double-entry method of verification works.
Show answer & marking schemeHide answer & marking scheme
Worked solution
In double-entry verification, the same data is entered twice, often on separate input fields or by different operators. The computer system compares the two entries character-by-character. If there is any mismatch, the system displays an error message and prompts the user to re-enter the data.
Marking scheme
One mark for each description point, up to a maximum of three. - Data is entered twice (1 mark). - The computer system compares both entries (1 mark). - If they do not match, an error is flagged / user is forced to re-enter (1 mark).
Question 5 · short_answer
3 marks
Top-down design is a common design technique used in the software development life cycle. Explain what is meant by top-down design.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Top-down design involves taking a complex problem and breaking it down into smaller, simpler, and more manageable sub-problems (decomposition). This process continues step-by-step until each sub-problem performs a single identifiable task that is easy to code, test, and maintain as an independent module.
Marking scheme
One mark for each valid explanation point, up to a maximum of three. - Breaking down a main problem into smaller sub-problems / decomposition (1 mark). - Continuing the process until modules are manageable / perform a single task (1 mark). - Each module can be programmed / tested / maintained independently (1 mark).
Question 6 · Pseudocode dry-run tracing and algorithm correction tasks
8 marks
A program is designed to filter student test scores. The scores of 8 students are stored in a one-dimensional (1D) array named `StudentScores`.
The algorithm counts how many students passed the test (score of 50 or above) and how many achieved a distinction (score of 85 or above).
```pseudocode 01 DECLARE StudentScores : ARRAY[1:8] OF INTEGER 02 StudentScores[1] ← 45 03 StudentScores[2] ← 70 04 StudentScores[3] ← 88 05 StudentScores[4] ← 50 06 StudentScores[5] ← 92 07 StudentScores[6] ← 30 08 StudentScores[7] ← 85 09 StudentScores[8] ← 64 10 PassCount ← 0 11 DistCount ← 0 12 Index ← 1 13 REPEAT 14 IF StudentScores[Index] >= 50 15 THEN 16 PassCount ← PassCount + 1 17 IF StudentScores[Index] >= 85 18 THEN 19 DistCount ← DistCount + 1 20 ENDIF 21 ENDIF 22 Index ← Index + 1 23 UNTIL Index > 8 24 OUTPUT PassCount, DistCount ```
(a) Complete the dry-run trace table for the algorithm. Do not leave any rows blank where a variable changes value.
(b) The algorithm needs to be updated to calculate the percentage of students who passed (PassCount out of the total 8 students).
Write pseudocode statements to calculate this percentage, store it in a variable named `PassPercentage`, and output the result with a suitable message.
[3]
Show answer & marking schemeHide answer & marking scheme
Worked solution
Part (a): - The loop starts with `Index = 1`. `StudentScores[1]` is 45 (no change in counts). - `Index = 2`: `StudentScores[2]` is 70 (PassCount becomes 1). - `Index = 3`: `StudentScores[3]` is 88 (PassCount becomes 2, DistCount becomes 1). - `Index = 4`: `StudentScores[4]` is 50 (PassCount becomes 3). - `Index = 5`: `StudentScores[5]` is 92 (PassCount becomes 4, DistCount becomes 2). - `Index = 6`: `StudentScores[6]` is 30 (no change in counts). - `Index = 7`: `StudentScores[7]` is 85 (PassCount becomes 5, DistCount becomes 3). - `Index = 8`: `StudentScores[8]` is 64 (PassCount becomes 6). - `Index = 9`: Loop terminates since `Index > 8` is true. The output is `6, 3`.
Part (b): We calculate the percentage by dividing the pass count by 8 and multiplying by 100: `PassPercentage ← (PassCount / 8) * 100` Then output the calculated percentage with a message: `OUTPUT "The pass percentage is ", PassPercentage`
Marking scheme
Part (a) [5 marks total]: - 1 mark for correct tracing of `Index` incrementing from 1 to 9. - 1 mark for correct values in the `PassCount` column (final value 6). - 1 mark for correct values in the `DistCount` column (final value 3). - 1 mark for correct row alignment showing changes corresponding to the array element index. - 1 mark for correct final output value of `6, 3` in the `OUTPUT` column.
Part (b) [3 marks total]: - 1 mark for correct division of `PassCount` by 8. - 1 mark for correct multiplication by 100 to get a percentage value. - 1 mark for correct `OUTPUT` statement containing the variable `PassPercentage` and a clear text message.
Question 7 · Pseudocode dry-run tracing and algorithm correction tasks
8 marks
An algorithm has been written in pseudocode to calculate and output the ticket price for a theme park visitor based on their age.
The requirements are: - Standard ticket price is $20.00. - Visitors under 5 years old enter free ($0.00). - Visitors aged 5 to 16 inclusive get a 50% discount ($10.00). - Visitors aged 65 and over get a 40% discount ($12.00). - The process is repeated until a sentinel value of -1 is entered for the age.
```pseudocode 01 REPEAT 02 OUTPUT "Please enter visitor age: " 03 INPUT VisitorAge 04 IF Age = -1 05 THEN 06 IF Age < 5 07 THEN 08 Price ← 0.00 09 ELSE 10 IF Age >= 5 OR Age <= 16 11 THEN 12 Price ← 10.00 13 ELSE 14 IF Age >= 65 15 THEN 16 Price ← 12.00 17 ELSE 18 Price ← 20.00 19 ENDIF 20 ENDIF 21 ENDIF 22 OUTPUT "Ticket price: $", Price 23 ENDIF 24 WHILE Age = -1 ```
(a) Identify the line numbers of four errors in the pseudocode and suggest a correction for each error.
[4]
(b) Identify the age range that qualifies for the $12.00 ticket price once the errors are corrected.
[2]
(c) Complete the trace table for the corrected algorithm using this input data: `8, 3, 72, -1`
| Age | Price | OUTPUT | |---|---|---| | | | |
[2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
Part (a): - Line 03: The variable is input as `VisitorAge`, but used as `Age` everywhere else. Thus, the input statement must be corrected to use `Age`. - Line 04: The logic is inverted. It checks `IF Age = -1`, which means it would only calculate the price if the quit sentinel -1 is input. This needs to be changed to `IF Age <> -1` to calculate prices for valid inputs. - Line 10: The conditional connector `OR` makes the condition always true (any age is either >= 5 or <= 16). It must be changed to `AND` so that only ages 5 to 16 inclusive match. - Line 24: A `REPEAT` loop must end with `UNTIL`, not `WHILE`. So the correct loop termination statement is `UNTIL Age = -1`.
Part (b): The condition for the 40% discount is `Age >= 65`. Hence, visitors aged 65 and older qualify for the $12.00 price.
Part (c): - Input `8`: Fits `Age >= 5 AND Age <= 16`. `Price` = 10.00. Output: "Ticket price: $10.00". - Input `3`: Fits `Age < 5`. `Price` = 0.00. Output: "Ticket price: $0.00". - Input `72`: Fits `Age >= 65`. `Price` = 12.00. Output: "Ticket price: $12.00". - Input `-1`: The outer IF condition prevents calculation, loop ends at `UNTIL Age = -1`.
Marking scheme
Part (a) [4 marks total]: - 1 mark for identifying Line 03 and correcting it to `INPUT Age`. - 1 mark for identifying Line 04 and correcting it to `IF Age <> -1` (accept: `IF Age > -1` or `Age >= 0`). - 1 mark for identifying Line 10 and correcting it to `Age >= 5 AND Age <= 16`. - 1 mark for identifying Line 24 and correcting it to `UNTIL Age = -1`.
Part (b) [2 marks total]: - 1 mark for identifying that the age must be 65 or older. - 1 mark for formal range definition (e.g., `Age >= 65`).
Part (c) [2 marks total]: - 1 mark for correct tracing of inputs `8`, `3`, and `72` with matching prices. - 1 mark for correct final output messages and correct termination on `-1`.
Question 8 · Pseudocode dry-run tracing and algorithm correction tasks
8 marks
The following pseudocode algorithm performs a bubble sort on a 4-element one-dimensional (1D) array named `Num`.
```pseudocode 01 Num[1] ← 4 02 Num[2] ← 2 03 Num[3] ← 7 04 Num[4] ← 1 05 Boundary ← 3 06 REPEAT 07 Swap ← FALSE 08 FOR Index ← 1 TO Boundary 09 IF Num[Index] > Num[Index + 1] 10 THEN 11 Temp ← Num[Index] 12 Num[Index] ← Num[Index + 1] 13 Num[Index + 1] ← Temp 14 Swap ← TRUE 15 ENDIF 16 NEXT Index 17 Boundary ← Boundary - 1 18 UNTIL Swap = FALSE OR Boundary = 0 ```
(a) Complete the dry-run trace table for this algorithm. Show the updated array elements when a swap occurs.
(b) State the purpose of the variable `Swap` in this bubble sort algorithm.
[1]
(c) Explain how the line `Boundary ← Boundary - 1` improves the efficiency of the sorting process.
[1]
Show answer & marking schemeHide answer & marking scheme
Worked solution
Part (a): - Initial Array state: `[4, 2, 7, 1]`. - Pass 1 (`Boundary = 3`): - `Swap` is set to `FALSE`. - `Index = 1`: `Num[1]` (4) > `Num[2]` (2) is True. Swapped. Array becomes `[2, 4, 7, 1]`. `Swap = TRUE`. - `Index = 2`: `Num[2]` (4) > `Num[3]` (7) is False. No swap. - `Index = 3`: `Num[3]` (7) > `Num[4]` (1) is True. Swapped. Array becomes `[2, 4, 1, 7]`. `Swap = TRUE`. - `Boundary` is decremented to 2. - Pass 2 (`Boundary = 2`): - `Swap` is set to `FALSE`. - `Index = 1`: `Num[1]` (2) > `Num[2]` (4) is False. No swap. - `Index = 2`: `Num[2]` (4) > `Num[3]` (1) is True. Swapped. Array becomes `[2, 1, 4, 7]`. `Swap = TRUE`. - `Boundary` is decremented to 1. - Pass 3 (`Boundary = 1`): - `Swap` is set to `FALSE`. - `Index = 1`: `Num[1]` (2) > `Num[2]` (1) is True. Swapped. Array becomes `[1, 2, 4, 7]`. `Swap = TRUE`. - `Boundary` is decremented to 0. - Loop terminates as `Boundary = 0` is True.
Part (b): The variable `Swap` serves as a boolean flag. It allows the algorithm to check if any modifications were made to the array elements order during a run. If no elements were swapped, sorting is complete.
Part (c): By decrementing `Boundary`, the inner loop limits its search and stops before reaching the rightmost elements, which are guaranteed to be sorted in their proper positions already. This saves unnecessary comparisons.
Marking scheme
Part (a) [6 marks total]: - 1 mark for initializing the first pass with `Boundary = 3` and setting `Swap` to `FALSE`. - 1 mark for correct trace of Pass 1 swaps (elements `[2, 4, 7, 1]` then `[2, 4, 1, 7]`) and `Swap` set to `TRUE`. - 1 mark for correct trace of Pass 2 with `Boundary = 2` showing swap to `[2, 1, 4, 7]`. - 1 mark for correct trace of Pass 3 with `Boundary = 1` showing swap to `[1, 2, 4, 7]`. - 1 mark for correct trace of `Boundary` values decrementing (`3`, then `2`, then `1`, then `0`). - 1 mark for correctly stopping the trace when `Boundary = 0` is reached.
Part (b) [1 mark total]: - 1 mark for explaining that it flags whether any items changed places (or indicates if early termination is possible when no swaps happen).
Part (c) [1 mark total]: - 1 mark for explaining that it prevents re-comparing elements that are already sorted at the end of the array.
Question 9 · structured
7 marks
Consider a logic circuit with three inputs, A, B and C, and an output, X. Inputs A and B are the inputs to an AND gate. Input C is the input to a NOT gate. The output from the AND gate and the output from the NOT gate are the inputs to an XOR gate. (a) Write the Boolean logic expression for this logic circuit. Do not try to simplify your expression. X = ... (b) Complete the truth table for the described logic circuit with the columns A, B, C, and output X.
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) First, find the output of the first two gates: - The AND gate has inputs A and B, giving: A AND B - The NOT gate has input C, giving: NOT C These two intermediate outputs are then combined using an XOR gate, giving the final expression: (A AND B) XOR (NOT C).
(b) To complete the truth table, we evaluate the expression for each row: - For A=0, B=0, C=0: (0 AND 0) XOR (NOT 0) = 0 XOR 1 = 1 - For A=0, B=0, C=1: (0 AND 0) XOR (NOT 1) = 0 XOR 0 = 0 - For A=0, B=1, C=0: (0 AND 1) XOR (NOT 0) = 0 XOR 1 = 1 - For A=0, B=1, C=1: (0 AND 1) XOR (NOT 1) = 0 XOR 0 = 0 - For A=1, B=0, C=0: (1 AND 0) XOR (NOT 0) = 0 XOR 1 = 1 - For A=1, B=0, C=1: (1 AND 0) XOR (NOT 1) = 0 XOR 0 = 0 - For A=1, B=1, C=0: (1 AND 1) XOR (NOT 0) = 1 XOR 1 = 0 - For A=1, B=1, C=1: (1 AND 1) XOR (NOT 1) = 1 XOR 0 = 1
Marking scheme
(a) Max 3 marks: - 1 mark for: A AND B - 1 mark for: NOT C - 1 mark for combining with XOR to give: (A AND B) XOR (NOT C) (or equivalent)
(b) Max 4 marks: - 4 marks for 8 correct outputs - 3 marks for 6 or 7 correct outputs - 2 marks for 4 or 5 correct outputs - 1 mark for 2 or 3 correct outputs
Correct output column values (from top to bottom): 1, 0, 1, 0, 1, 0, 0, 1
Question 10 · database
10 marks
A local bicycle rental shop has set up a new database table called BikeRentals to store details of the bicycles available for hire. Part of this table is given.
| BikeID | Model | Available | FrameSize | DailyRate | WeightKg | | --- | --- | --- | --- | --- | --- | | B01 | Mountain | Yes | M | 20.00 | 14.5 | | B02 | Road | Yes | L | 25.00 | 8.5 | | B03 | Electric | No | M | 40.00 | 22.0 | | B04 | Hybrid | Yes | S | 15.00 | 13.0 | | B05 | Mountain | No | L | 20.00 | 15.0 | | B06 | Electric | Yes | L | 40.00 | 23.5 | | B07 | Road | No | S | 25.00 | 8.2 | | B08 | Hybrid | No | M | 15.00 | 13.5 |
(a) State the number of records in this part of the database table.
(b) (i) Give the name of the field that would be used for the primary key. (ii) State the reason for choosing this field for the primary key.
(c) Write the output from this structured query language (SQL) statement: SELECT BikeID, WeightKg FROM BikeRentals WHERE DailyRate = 20.00;
(d) (i) Complete this SQL statement to display only the model of all the bikes that are currently not available (Available is 'No'). SELECT ....................................................................................... FROM ....................................................................................... WHERE ....................................................................................... ;
(ii) Explain how one of the lines in your statement in part (d)(i) could be changed to display the same information.
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) There are exactly 8 rows of data listed under the header row in the provided portion of the table, representing 8 distinct records.
(b) (i) BikeID is the most suitable primary key. (ii) A primary key must contain a unique value for every single record in the table so that each entity can be uniquely identified. BikeID consists of codes like B01, B02, etc., which are guaranteed to be unique for each bike.
(c) The query filters records where DailyRate is 20.00. Looking at the table, records B01 and B05 have DailyRate = 20.00. The SELECT statement only requests BikeID and WeightKg, so the output displays: B01 14.5 B05 15.0
(d) (i) To show only the model name of bikes that are not available: SELECT Model FROM BikeRentals WHERE Available = 'No';
(ii) Instead of checking if Available is directly equal to 'No', we can logically invert the condition to check if it is NOT equal to 'Yes' using the NOT operator or the inequality operator. For example: WHERE NOT Available = 'Yes' or WHERE Available <> 'Yes'.
Marking scheme
(a) One mark for: - 8
(b) (i) One mark for: - BikeID
(ii) One mark for: - Unique identifier / uniquely identifies each record
(c) One mark for each correct line of output (max 2): - B01 14.5 - B05 15.0
(d) (i) One mark for each correct line (max 3): - SELECT Model - FROM BikeRentals - WHERE Available = 'No' (accept logical equivalent such as Available = False or NOT Available = 'Yes')
(ii) One mark for each point (max 2): - Identify that the WHERE clause can check for NOT Available = 'Yes' / Available = False / Available <> 'Yes' - Explain that this produces the same result by identifying all bikes that are not available.
Question 11 · programming
15 marks
A library has 150 children who participate in a summer reading challenge. Children's names are stored in the one-dimensional (1D) array ChildName[] Each child's total of books read is stored in another one-dimensional (1D) array BooksRead[] The position of each child's data in the two arrays is the same. For example, the child stored at index 10 in ChildName[] and at index 10 in BooksRead[] is the same.
The library awards a special prize to the children who have the top three highest book totals. The library also awards certificates to all children who read 12 or more books.
Write a program that meets the following requirements: • allows the book counts to be input twice and verifies that the inputs match • sorts the arrays BooksRead[] and ChildName[] in descending order of books read • outputs the child names and book counts of the children with the top three highest book totals and identifies them as Gold, Silver and Bronze • stores the names of all the children who will receive a certificate in the array SuperReader[] • outputs a message stating the number of certificates to be printed.
You must use pseudocode or program code and add comments to explain how your code works.
You do not need to initialise the data in the array ChildName[] You do not need to declare any arrays or variables; you may assume that this has already been done.
All inputs and outputs must contain suitable messages.
Show answer & marking schemeHide answer & marking scheme
// Input and verification of books read FOR Index <- 1 TO ChallengeSize REPEAT PRINT "Please enter the books read for ", ChildName[Index] INPUT Books1 PRINT "Please re-enter the books read" INPUT Books2 IF Books1 <> Books2 THEN PRINT "Error: Book counts do not match, please try again." ENDIF UNTIL Books1 = Books2 BooksRead[Index] <- Books1 NEXT Index
// Sorting in descending order using Bubble Sort Last <- ChallengeSize REPEAT Swap <- FALSE FOR Index <- 1 TO Last - 1 IF BooksRead[Index] < BooksRead[Index + 1] THEN TempBooks <- BooksRead[Index] BooksRead[Index] <- BooksRead[Index + 1] BooksRead[Index + 1] <- TempBooks
Swap <- TRUE ENDIF NEXT Index Last <- Last - 1 UNTIL NOT Swap OR Last = 1
// Output top three readers FOR Index <- 1 TO 3 OUTPUT Position[Index], ": ", ChildName[Index], " with ", BooksRead[Index], " books read" NEXT Index
// Identify certificate winners and count Count <- 0 FOR Index <- 1 TO ChallengeSize IF BooksRead[Index] >= 12 THEN Count <- Count + 1 SuperReader[Count] <- ChildName[Index] ENDIF NEXT Index
OUTPUT "Total number of certificates to be printed: ", Count
Marking scheme
AO2: Apply knowledge and understanding of the principles and concepts of computer science to a given context, including the analysis and design of computational or programming problems (Max 9 Marks)
• 1–3 Marks: At least one programming technique has been used (such as input, output, selection, iteration). Some data has been stored, but not always appropriately. • 4–6 Marks: Some programming techniques used are appropriate to the problem. More than one technique is applied to the scenario (e.g. input verification, sorting, filtering). Some of the data structures chosen are appropriate and store some of the data required. • 7–9 Marks: The range of programming techniques used is appropriate to the problem. All criteria stated for the scenario have been covered by the use of appropriate programming techniques. The data structures chosen are appropriate and store all the data required.
AO3: Provide solutions to problems by evaluating computer systems, making reasoned judgements, and presenting conclusions (Max 6 Marks)
• 1–2 Marks: Program seen with few/no relevant comments. Some identifier names are appropriate. The solution is illogical and/or inaccurate in many places, attempting at least one of the requirements. • 3–4 Marks: Program seen with some relevant comments. The majority of identifiers are appropriately named. The solution is mostly logical and accurate, meeting most of the requirements. • 5–6 Marks: The program has been fully commented with meaningful identifiers used throughout. The program is in a logical order and accurate, performing all the tasks given in the scenario.
Wondering how well you actually know this?
thinka is an AI practice app for IGCSE & IB students: unlimited questions, instant auto-marking, and detailed step-by-step solutions. 100,000+ students use it to confirm they actually know it, not just think they do.