An original Thinka practice paper modelled on the structure and difficulty of the Jun 2024 Cambridge OCR GCSE Computer Science - J277 paper. Not affiliated with or reproduced from Cambridge.
PastPaper.section J277/01: Computer Systems
Answer all questions. Calculators are not allowed. Assessment contains short-answer, completion tables, drawing topologies, and a Quality of Extended Response (QER) asterisked essay.
19 PastPaper.question · 65 PastPaper.marks
PastPaper.question 1 · short_answer
2.5 PastPaper.marks
Calculate the file size in Megabytes (MB) of a 3.5 Gigabyte (GB) video file. Show your working. (Note: You may use 1000 or 1024 for your calculation).
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To convert Gigabytes to Megabytes, multiply the value by either 1000 or 1024.
Using 1000: \(3.5 \times 1000 = 3500\text{ MB}\)
Using 1024: \(3.5 \times 1024 = 3584\text{ MB}\)
PastPaper.markingScheme
1 mark for showing correct method (multiplying 3.5 by 1000 or 1024). 1 mark for the correct numerical calculation (3500 or 3584). 0.5 marks for including the correct unit (MB).
PastPaper.question 2 · short_answer
2.5 PastPaper.marks
Describe the specific roles of the Memory Address Register (MAR) and the Memory Data Register (MDR) during the Fetch stage of the Fetch-Decode-Execute cycle.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
During the Fetch stage, the Program Counter (PC) passes the address of the next instruction to the MAR. The CPU then sends a signal to RAM to fetch the instruction stored at that address. The fetched instruction is copied from memory (RAM) into the MDR.
PastPaper.markingScheme
1 mark for stating that the MAR holds the memory location/address of the instruction/data to be fetched. 1 mark for stating that the MDR holds the actual data/instruction that has been retrieved from memory. 0.5 marks for explaining the relationship (e.g., data from the address in MAR is copied into the MDR).
PastPaper.question 3 · short_answer
2.5 PastPaper.marks
A digital audio recorder allows users to adjust both the sampling frequency and the bit depth. Explain how increasing both of these settings affects the quality and file size of the recorded audio.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. Sampling frequency: Increasing this means more samples of the sound wave are taken per second, leading to a more accurate representation (higher quality) and more data stored (larger file size). 2. Bit depth: Increasing this means more bits are allocated per sample, allowing a wider dynamic range and finer volume steps (higher quality) but requiring more bits per sample (larger file size).
PastPaper.markingScheme
1 mark for explaining the effect of increasing sampling frequency on both quality and file size. 1 mark for explaining the effect of increasing bit depth on both quality and file size. 0.5 marks for providing a coherent concluding summary of why more data is captured.
PastPaper.question 4 · short_answer
2.5 PastPaper.marks
Explain the different roles played by the Transmission Control Protocol (TCP) and the Internet Protocol (IP) when transmitting data across the internet.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
TCP is responsible for breaking the data down into packets, numbering them to ensure they can be reassembled in the correct order, and performing error checking to detect lost packets. IP is responsible for adding source and destination IP addresses to packets and routing them across the network.
PastPaper.markingScheme
1 mark for explaining TCP's role (packetization, sequencing, error correction/retransmission). 1 mark for explaining IP's role (addressing, routing packets across networks). 0.5 marks for identifying how they work in tandem to guarantee delivery.
PastPaper.question 5 · short_answer
2.5 PastPaper.marks
An action sports photographer needs a storage device to save high-resolution photos directly from their camera while shooting outdoors. Identify the most suitable type of secondary storage technology (Optical, Magnetic, or Solid State) and explain two reasons why it is the best choice for this environment.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Solid State storage (such as an SD card) is ideal because: 1. It has no moving parts, making it highly durable and shock-resistant if dropped during outdoor sports photography. 2. It has fast read/write speeds, allowing rapid saving of high-resolution image bursts.
PastPaper.markingScheme
0.5 marks for identifying 'Solid State' (or SSD / Flash memory). 1 mark for explaining durability/shock-resistance (due to no moving parts). 1 mark for explaining speed (fast write speed for high-res photos) OR portability (small size, lightweight for carrying outdoors).
PastPaper.question 6 · short_answer
2.5 PastPaper.marks
Explain how an Operating System uses RAM and Virtual Memory to manage system memory when a user attempts to run several resource-heavy programs simultaneously.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The OS manages memory by allocating blocks of RAM to active processes. If the RAM is filled, the OS sets up Virtual Memory, allocating partition space on secondary storage (like an HDD/SSD). Inactive data from RAM is swapped (paged) out to Virtual Memory, freeing up space in RAM for active tasks. When the swapped data is needed again, it is loaded back into RAM.
PastPaper.markingScheme
1 mark for explaining RAM allocation (storing active programs/data for fast access). 1 mark for explaining the role of Virtual Memory (using secondary storage to extend RAM when full). 0.5 marks for explaining the concept of 'swapping' or 'paging' data between RAM and Virtual Memory.
PastPaper.question 7 · short_answer
2.5 PastPaper.marks
A school is replacing all 200 of its desktop computers with low-power thin-client terminals. Explain one positive environmental impact and one negative environmental impact of this upgrade.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Positive impact: Thin clients require far less electrical energy than full desktops, which reduces the school's daily energy usage and lowers its carbon footprint. Negative impact: Disposing of 200 old desktop computers creates a massive amount of electronic waste (e-waste), which may end up in landfills, releasing toxic chemicals if not recycled properly.
PastPaper.markingScheme
1 mark for a clearly explained positive environmental impact (e.g., lower electricity consumption/fewer raw materials to manufacture thin clients). 1 mark for a clearly explained negative environmental impact (e.g., e-waste disposal, carbon footprint of manufacturing and shipping 200 new devices). 0.5 marks for indicating a long-term consequence (e.g., toxic chemicals in landfill, reduction in coal/fossil fuel demand).
PastPaper.question 8 · short_answer
2.5 PastPaper.marks
A microcontroller inside a modern smart washing machine controls its wash cycles. Explain why this microcontroller is classified as an embedded system, identifying two characteristics of embedded systems in your answer.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
An embedded system is a dedicated computer system built within a larger mechanical or electrical system. The washing machine's microcontroller has a single, specific function (controlling the wash programs) rather than being general-purpose. It is typically stored on a single microprocessor chip with software permanently burned into ROM.
PastPaper.markingScheme
1 mark for identifying the first characteristic (e.g., dedicated single-purpose system / built into a larger device). 1 mark for identifying the second characteristic (e.g., limited/no user programming / low power / ROM-based firmware). 0.5 marks for directly linking these characteristics to the washing machine's context (e.g., controlling temperature/spin cycle).
PastPaper.question 9 · short_answer
2 PastPaper.marks
A user records a 10-second audio clip on their mobile device. The audio is sampled at a rate of 100 Hz with a sample resolution (bit depth) of 16 bits. Calculate the file size of the audio recording in bytes. Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To calculate the file size of an audio file, we use the formula: \(\text{File size (bits)} = \text{duration (seconds)} \times \text{sample rate (Hz)} \times \text{bit depth}\)
Substituting the given values: \(\text{File size (bits)} = 10 \times 100 \times 16 = 16,000\text{ bits}\)
To convert the size from bits to bytes, divide by 8: \(\text{File size (bytes)} = 16,000 / 8 = 2,000\text{ bytes}\)
PastPaper.markingScheme
Award up to 2 marks: - 1 mark for showing correct working, multiplying duration, sample rate, and bit depth, then dividing by 8 (e.g., \(10 \times 100 \times 16 / 8\) or \(16,000 / 8\)). - 1 mark for the correct final answer of 2,000 bytes (accept 2000 or 2000B without units if working is shown).
PastPaper.question 10 · short_answer
3 PastPaper.marks
Describe the roles of the Memory Address Register (MAR) and the Memory Data Register (MDR) during the fetch stage of the Fetch-Decode-Execute cycle.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
During the fetch stage of the cycle, the CPU performs the following steps: 1. The memory address of the instruction is copied from the Program Counter (PC) into the Memory Address Register (MAR). 2. The CPU sends a request to RAM using the address specified in the MAR. 3. The actual instruction/data stored at that address in RAM is then copied into the Memory Data Register (MDR).
PastPaper.markingScheme
Award up to 3 marks: - 1 mark for explaining that the MAR stores/holds the memory address of the instruction or data to be fetched. - 1 mark for explaining that the address in the MAR is used to locate/access the data in the main memory (RAM). - 1 mark for explaining that the MDR receives and holds the actual instruction or data that has been fetched from memory.
PastPaper.question 11 · Structured Explanation
4 PastPaper.marks
A computer uses the Von Neumann architecture. During the Fetch-Execute cycle, several registers within the CPU are updated. Explain the specific roles of the Memory Address Register (MAR) and the Memory Data Register (MDR) during the Fetch stage of the cycle.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
During the Fetch stage: 1. The Memory Address Register (MAR) is loaded with the memory address of the instruction currently pointed to by the Program Counter (PC). 2. The CPU sends a request along the address bus to physical RAM using this address. 3. The actual instruction or data stored at that address is retrieved from RAM and sent back via the data bus. 4. This fetched instruction/data is then received and stored in the Memory Data Register (MDR) before being sent to the Instruction Register for decoding.
PastPaper.markingScheme
Award up to 4 marks. - 1 mark for stating that the MAR holds/stores the address of the instruction/data to be fetched. - 1 mark for explaining that this address is sent to main memory (RAM) via the address bus. - 1 mark for stating that the MDR holds the actual data or instruction once it has been fetched from RAM. - 1 mark for explaining that this data travels from RAM to the MDR via the data bus.
PastPaper.question 12 · Structured Explanation
4 PastPaper.marks
An engineer is designing a smart microwave oven that uses an embedded system. Explain two characteristics of embedded systems and describe how each characteristic applies specifically to this smart microwave.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Embedded systems are specialized computers built into larger physical systems. - Characteristic 1: Dedicated/Single Purpose. Unlike a general-purpose PC, the software is written for one job. In a microwave, this means controlling magnetron power, the turntable motor, and timer sensors. - Characteristic 2: Resource Constraints / Real-time response. The system must respond instantly to safety triggers (like opening the door during cooking) and runs on low-power, low-memory hardware to minimize manufacturing cost.
PastPaper.markingScheme
Award up to 4 marks. - 1 mark for identifying a valid characteristic of an embedded system (e.g., dedicated/single-purpose, real-time response, limited UI, program stored in ROM). - 1 mark for applying this characteristic to the smart microwave scenario. - 1 mark for identifying a second valid characteristic. - 1 mark for applying this second characteristic to the smart microwave scenario.
PastPaper.question 13 · Structured Explanation
4 PastPaper.marks
A hand-held gaming console contains both RAM and ROM. Explain the difference between RAM and ROM in this console, referencing their volatility and their typical contents during the console's operation.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
RAM (Random Access Memory) and ROM (Read Only Memory) serve distinct roles in a gaming console: - RAM is volatile primary storage. When the console is on, the active OS processes and currently running game data are copied here from the slower secondary storage so the CPU can access them quickly. Once the power is cut, this data is lost. - ROM is non-volatile primary storage. It cannot be easily written to. It contains the essential boot instructions (BIOS/firmware) that initialize the console's screen, controllers, and memory cards upon startup.
PastPaper.markingScheme
Award up to 4 marks. - 1 mark for stating RAM is volatile AND ROM is non-volatile. - 1 mark for explaining RAM can be read from and written to, whereas ROM is read-only. - 1 mark for explaining what RAM stores in this context (e.g., current game code, temporary player position, active graphics data). - 1 mark for explaining what ROM stores in this context (e.g., the bootloader, BIOS, or initial startup instructions).
PastPaper.question 14 · Structured Explanation
4 PastPaper.marks
A delivery company is installing dashcams (backup camera systems) in all its vehicles to continuously record video footage. Compare the use of Solid State (SSD) storage and Optical storage for this specific application, and explain why Solid State storage is the more appropriate choice.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
In a vehicular environment: - Physical Durability: Solid State storage uses electronic flash memory, making it highly shock-resistant. Optical drives require a laser to precisely read/write on a physical spinning disc, which would fail immediately due to vehicular vibrations. - Form Factor & Capacity: Dashcams must be compact. A microSD card (SSD technology) easily fits inside a tiny camera housing and can hold hundreds of gigabytes, whereas optical discs are physically large and hold very limited data.
PastPaper.markingScheme
Award up to 4 marks. - 1 mark for explaining that SSD has no moving parts making it shock-resistant/durable, whereas optical drives are fragile and prone to skipping due to physical movements/vibrations. - 1 mark for comparing write speeds (SSD is much faster at writing HD video streams continuously than optical). - 1 mark for comparing capacity/size (SSD can store much more data in a tiny form factor suitable for a dashcam). - 1 mark for a clear concluding statement justifying why SSD is appropriate for this specific vehicle environment.
PastPaper.question 15 · Structured Explanation
4 PastPaper.marks
A medical clinic is choosing between a star topology and a full mesh topology for its local area network (LAN). Describe one advantage of using a star topology over a mesh topology, and one advantage of using a mesh topology over a star topology in this clinic.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
- Star Topology Advantage: Lower cost and ease of setup. Each node only needs a single cable connecting to the central switch. Adding a new computer to the clinic's reception requires running only one new cable. - Mesh Topology Advantage: Redundancy. Since every node is connected to every other node, there is no single point of failure. If one path fails, critical patient monitoring data can take alternative paths to reach the server.
PastPaper.markingScheme
Award up to 4 marks. - 1 mark for identifying an advantage of a star topology (e.g., cheaper to install, easier to add new devices, less cabling). - 1 mark for explaining this star advantage in contrast to mesh (e.g., mesh requires a high number of redundant connections making it expensive). - 1 mark for identifying an advantage of a mesh topology (e.g., high redundancy, no single point of failure, high reliability for critical systems). - 1 mark for explaining this mesh advantage in contrast to star (e.g., if the central switch in a star topology fails, the whole network is offline).
PastPaper.question 16 · Structured Explanation
4 PastPaper.marks
Data packets sent across the internet require both an IP address and a MAC address. Explain the different purposes of an IP address and a MAC address when transmitting data across a network.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
IP and MAC addresses operate at different levels of network communication: - IP Address (Logical, Layer 3): Used for routing packets across networks globally. It can change depending on where the device connects to the internet. - MAC Address (Physical, Layer 2): Used to deliver the frame to the specific physical device within the current local network segment. It is permanent and never changes.
PastPaper.markingScheme
Award up to 4 marks. - 1 mark for stating that IP addresses are logical/dynamic and MAC addresses are physical/static (hardcoded into hardware). - 1 mark for explaining that the IP address is used to route packets between different networks / across the internet. - 1 mark for explaining that the MAC address is used to direct data to the specific device on the local network (LAN). - 1 mark for identifying that IP addresses are assigned by software/routers, whereas MAC addresses are unique and assigned by the manufacturer.
PastPaper.question 17 · Structured Explanation
4 PastPaper.marks
A school's online grading portal is vulnerable to brute-force attacks. Describe how a brute-force attack is conducted, and explain two defensive measures the school could implement to prevent or mitigate this threat.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
- How it is conducted: Attackers use dictionary tools or scripts that enter combinations of letters, numbers, and symbols continuously at high speed. - Defensive Measure 1: Lockout threshold. If an account is locked for 30 minutes after 3 failed attempts, it stops rapid automated attempts. - Defensive Measure 2: CAPTCHA. This forces a user to prove they are human, preventing automated bots from making rapid password requests. - Defensive Measure 3: Multi-Factor Authentication (MFA). Even if the password is successfully guessed, access is denied without the second physical token/code.
PastPaper.markingScheme
Award up to 4 marks. - 1 mark for describing a brute-force attack (automated/systematic trial-and-error guessing of credentials). - 1 mark for identifying a valid defensive measure (e.g., account lockout, CAPTCHA, MFA, strong password complexity rule). - 1 mark for explaining how that first measure mitigates the attack (e.g., lockout prevents continuous automated guesses; CAPTCHA stops scripts from interacting with the page). - 1 mark for identifying and explaining a second valid defensive measure.
PastPaper.question 18 · Structured Explanation
4 PastPaper.marks
An operating system uses memory management to handle programs. Explain how the operating system uses virtual memory when the computer's physical RAM is full, and describe one disadvantage of relying on virtual memory.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Virtual memory process: 1. The OS identifies pages of data in RAM that have not been used recently. 2. It writes these pages to a dedicated file on the hard drive or SSD (swap file/virtual memory). 3. It frees up that physical RAM for the active process. 4. When the swapped-out page is needed again, it must be loaded back into RAM, swapping out something else.
Disadvantage: - High read/write latency of secondary storage compared to RAM leads to disk thrashing, reducing overall computer performance.
PastPaper.markingScheme
Award up to 4 marks. - 1 mark for explaining that the OS sets aside space on secondary storage (HDD/SSD) to act as temporary memory extension when RAM is full. - 1 mark for explaining that inactive pages/blocks of data are moved (swapped) from RAM to secondary storage. - 1 mark for explaining that these pages are swapped back into physical RAM when they are required by the CPU. - 1 mark for explaining a valid disadvantage (e.g., secondary storage has slower read/write speeds than RAM, causing system lag/disk thrashing if heavily used).
PastPaper.question 19 · essay
8 PastPaper.marks
A national logistics company is planning to replace its fleet of delivery vans with autonomous drone deliveries.
Discuss the ethical, legal, cultural, and environmental impacts of this change.
In your answer, you should consider: - Ethical issues (such as employment and public safety) - Legal issues (such as privacy and airspace regulations) - Cultural issues (such as social isolation and public acceptance) - Environmental issues (such as emissions and noise pollution)
* This question is marked with an asterisk (*). The quality of your written communication, including structured arguments and technical vocabulary, will be assessed in this response.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To achieve Level 3 (7-8 marks), the candidate must present a well-structured, balanced, and detailed discussion covering all four aspects (ethical, legal, cultural, and environmental). The response should use appropriate technical terminology (e.g., Data Protection Act, carbon emissions, automation, liability) and show a clear understanding of the broader impacts of automated systems.
**Example response points:** - **Ethical issues**: Removing human delivery drivers will lead to significant job losses, which can negatively affect families and local economies. Additionally, there are major safety concerns if a drone experiences hardware or battery failure over crowded residential streets. - **Legal issues**: Drones rely on cameras and sensors to navigate, meaning they will inevitably capture images of people and private properties. This poses serious privacy concerns under the Data Protection Act (2018). Furthermore, companies must comply with strict aviation laws regarding commercial flight paths and restricted airspace. - **Cultural issues**: For many vulnerable or lonely individuals, the delivery driver is their only regular human contact; replacing them with drones increases social isolation. Public perception must also be managed, as many people may feel anxious about drones constantly flying overhead. - **Environmental issues**: On the positive side, drones run on electric batteries, reducing the carbon footprint compared to diesel delivery vans. However, the mass manufacturing of lithium-ion batteries has a harsh environmental impact, and noise pollution from drone propellers could disturb local ecosystems and urban peace.
PastPaper.markingScheme
**Level 3 (7-8 marks):** - Consistently detailed and balanced discussion covering ethical, legal, cultural, and environmental aspects. - Excellent understanding of the transition to autonomous drone delivery. - The answer is logical, well-structured, and consistently uses appropriate specialist terminology (e.g., Data Protection Act, carbon footprint, redundancy, automation). - Subject-specific terminology is used correctly throughout.
**Level 2 (4-6 marks):** - Clear discussion covering at least two or three of the aspects (ethical, legal, cultural, environmental) with some detail. - Shows a reasonable understanding of the impacts of drone deliveries. - The answer has a structured approach, and some technical terms are used appropriately. - Errors in spelling, punctuation, and grammar do not obscure meaning.
**Level 1 (1-3 marks):** - A basic response that covers only one or two aspects in a limited or superficial way. - Demonstrates a limited understanding of the impacts, with little or no technical detail. - The structure of the answer may be weak, with little or no specialist terminology used.
**0 marks:** - No response worthy of credit.
PastPaper.section J277/02: Computational thinking, algorithms and programming
Answer all questions. Section A focus is core logic and programming fundamentals (50 marks). Section B is scenario-based analysis and algorithm writing in pseudocode or high-level languages (30 marks).
20 PastPaper.question · 70 PastPaper.marks
PastPaper.question 1 · MCQ
2 PastPaper.marks
A programmer writes the following algorithm in pseudocode:
x = 3 y = 12 while x < y x = x + 2 y = y - 1 endwhile print(x)
What is the final value printed by this algorithm?
A.7
B.9
C.10
D.11point5
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
We trace the while-loop step-by-step: - Initially, x = 3, y = 12. Since 3 < 12 is True, we enter the loop. - Iteration 1: x becomes 3 + 2 = 5, y becomes 12 - 1 = 11. - Loop check: 5 < 11 is True, we enter the loop. - Iteration 2: x becomes 5 + 2 = 7, y becomes 11 - 1 = 10. - Loop check: 7 < 10 is True, we enter the loop. - Iteration 3: x becomes 7 + 2 = 9, y becomes 10 - 1 = 9. - Loop check: 9 < 9 is False. The loop terminates. - The algorithm prints the value of x, which is 9.
PastPaper.markingScheme
1 mark: Correctly trace the loop conditions and determine that the loop repeats exactly 3 times. 1 mark: State the correct final value of x (9).
PastPaper.question 2 · MCQ
2 PastPaper.marks
An algorithm uses arithmetic operators for integer division (DIV) and remainder division (MOD). What is the value of the following expression?
(23 DIV 5) + (23 MOD 4)
A.6
B.7
C.8
D.9
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. 23 DIV 5 calculates how many times 5 fits fully into 23, which is 4 (since 5 * 4 = 20, with 3 left over). 2. 23 MOD 4 calculates the remainder when 23 is divided by 4, which is 3 (since 4 * 5 = 20, remainder is 3). 3. Adding these two results together: 4 + 3 = 7.
PastPaper.markingScheme
1 mark: Correctly evaluate the components (23 DIV 5 = 4 and 23 MOD 4 = 3). 1 mark: Correct final sum of the values (7).
PastPaper.question 3 · MCQ
2 PastPaper.marks
A binary search algorithm is used to find the number 23 within the following sorted list of integers:
[2, 5, 8, 12, 16, 23, 38, 56, 72]
Assume list indexes start at 0, and the midpoint index is calculated using integer division: mid = (low + high) DIV 2. What is the sequence of values checked by the binary search algorithm?
A.16, 38, 23
B.16, 23
C.12, 38, 23
D.12, 23
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. The array indices are 0 to 8. Initial bounds: low = 0, high = 8. 2. Midpoint 1: (0 + 8) DIV 2 = 4. The value at index 4 is 16. Since 16 < 23, the target is in the right half: low = 5, high = 8. 3. Midpoint 2: (5 + 8) DIV 2 = 6. The value at index 6 is 38. Since 38 > 23, the target is in the left half: low = 5, high = 5. 4. Midpoint 3: (5 + 5) DIV 2 = 5. The value at index 5 is 23. This is our target. Therefore, the values checked are: 16, then 38, then 23.
PastPaper.markingScheme
1 mark: Correctly identify the initial midpoint element (16). 1 mark: Trace the remaining indices accurately to identify the full sequence (16, 38, 23).
In standard pseudocode notation, 2D arrays are referenced as board[row, column], starting from index 0. What is the value of the following expression?
board[2, 0] + board[0, 1]
A.110
B.100
C.90
D.60
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. board[2, 0] accesses the third row (index 2) and the first column (index 0). The value is 70. 2. board[0, 1] accesses the first row (index 0) and the second column (index 1). The value is 20. 3. Adding these values together gives: 70 + 20 = 90.
PastPaper.markingScheme
1 mark: Correct identification of both array elements (board[2,0] = 70 and board[0,1] = 20). 1 mark: Correct calculation of the sum (90).
PastPaper.question 5 · MCQ
2 PastPaper.marks
Evaluate the following boolean expression where A = True, B = False, and C = True:
NOT (A AND B) AND (B OR C)
A.False
B.True
C.None of the above
D.Syntax Error
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. Evaluate the first sub-expression: (A AND B) = (True AND False) = False. 2. Apply NOT: NOT (False) = True. 3. Evaluate the second sub-expression: (B OR C) = (False OR True) = True. 4. Combine with the final AND operator: True AND True = True.
PastPaper.markingScheme
1 mark: Correct evaluation of the constituent clauses (NOT (A AND B) resolves to True, and (B OR C) resolves to True). 1 mark: Correct overall final evaluation of True.
PastPaper.question 6 · MCQ
2 PastPaper.marks
A software program accepts an integer score for an exam, which must be within the range 0 to 100 inclusive. Which set of test data represents exactly one Boundary (limit) value, one Normal (valid) value, and one Erroneous (invalid) value?
A.0, 50, 101
B.-1, 0, 100
C.50, 75, 105
D.0, 100, 101
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Boundary values check the edges of the valid range (0 and 100). Normal values check typical valid inputs inside the boundaries (e.g. 50). Erroneous values check invalid inputs outside the range (e.g. 101 or -1). In option A, 0 is a Boundary value, 50 is a Normal value, and 101 is an Erroneous value.
PastPaper.markingScheme
1 mark: Clearly define the role of Boundary, Normal, and Erroneous data in this context. 1 mark: Select the option containing exactly one of each class (0, 50, 101).
PastPaper.question 7 · MCQ
2 PastPaper.marks
A developer writes a registration form. The username input must be at least 6 characters long and must contain no spaces. Which pair of validation checks should the developer implement for the username field?
A.Length check and Format check
B.Presence check and Range check
C.Length check and Look-up check
D.Range check and Format check
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
A validation check that tests the length of a string (such as ensuring it contains at least 6 characters) is a Length check. A check that ensures a string matches a specific format or does not contain forbidden characters (such as space characters) is best implemented as a Format check.
PastPaper.markingScheme
1 mark: Identify the rule for minimum character length as requiring a Length check. 1 mark: Identify the rule against spaces as requiring a Format check.
PastPaper.question 8 · MCQ
2 PastPaper.marks
A developer writes the following statements in a high-level programming language:
What is the resulting data type and the value of 'result' after execution?
A.Real / Float, value 8.0
B.Integer, value 8
C.String, value "8"
D.Real / Float, value 8.33
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The function stringToInt(num1) converts the string "24" to the integer 24. This integer is divided by the integer 3 using standard division (/), which outputs a Real (floating-point) number rather than an integer. Therefore, the result is 8.0, and its data type is Real/Float.
PastPaper.markingScheme
1 mark: Correctly identify that standard division (/) results in a Real/Float data type. 1 mark: Correctly state the final numerical value of 8.0.
An automated greenhouse ventilation system opens a window (\(W = 1\)) if: - The temperature is high (\(T = 1\)) AND the humidity is low (\(H = 0\)), OR - The manual override switch is ON (\(M = 1\)).
(a) Write a Boolean expression to represent this logic system. [1.5 marks] (b) Describe how this circuit would be drawn, specifying which gates connect to which inputs and how they produce the final output \(W\). [2 marks]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To represent 'humidity is low' we use \(\text{NOT } H\). This is combined with 'temperature is high' (\(T\)) using an AND gate, yielding \(T \text{ AND } \text{NOT } H\). This expression is combined with 'manual override' (\(M\)) using an OR gate. Thus, the Boolean expression is \(W = (T \text{ AND } \text{NOT } H) \text{ OR } M\). In drawing the circuit: 1. Input \(H\) passes through a NOT gate. 2. The output of the NOT gate and input \(T\) are connected to an AND gate. 3. The output of the AND gate and input \(M\) are connected to an OR gate, which outputs \(W\).
PastPaper.markingScheme
(a) [1.5 marks total]: - 0.5 marks for correctly applying NOT to H: \(\text{NOT } H\). - 0.5 marks for combining T and the negated H with an AND gate: \(T \text{ AND } \text{NOT } H\). - 0.5 marks for completing the OR relation with M and equating to W: \(W = ... \text{ OR } M\).
(b) [2 marks total]: - 1 mark for stating that \(H\) goes through a NOT gate and is then input to an AND gate with \(T\). - 1 mark for stating that the final gate is an OR gate with inputs from the AND gate and \(M\).
A student writes the following program in OCR Exam Reference Language to input 5 numbers, calculate their total, and output the result.
```text total = 0 for i = 0 to 4 num = input("Enter a number: ") total = total + num next i print("The total is: " + total) ```
The program contains a runtime error because the `input()` function returns a string. (a) State how to fix this error by rewriting line 3. [1.5 marks] (b) The user wants to change the program to only add the number to `total` if the number is positive (greater than 0). Write the updated loop body (lines 3 and 4) to implement this requirement. [2 marks]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
In OCR Exam Reference Language, input from the console is treated as a string type. To add it mathematically, it must be cast to an integer or real using `strToInt()`. To selectively add only positive numbers, an nested `if` statement is used inside the loop to check if `num > 0` before adding to the running total.
PastPaper.markingScheme
(a) [1.5 marks total]: - 1 mark for identifying that the input must be converted/cast to an integer or real. - 0.5 marks for correct syntax, e.g., `num = strToInt(...)` or `cast(...)`.
(b) [2 marks total]: - 1 mark for correct `if` condition checking `num > 0` (or greater than or equal to 0, though positive strictly means > 0). - 1 mark for enclosing the addition statement inside the `if` and concluding with `endif`.
A program is designed to check if a customer is eligible for a discount: - Customers aged 65 and over get a 20% discount. - Customers aged under 16 get a 10% discount. - All other customers get no discount (0%).
Write a structured algorithm in OCR Exam Reference Language that: - Prompts and inputs the customer's age. - Determines the correct discount percentage. - Outputs the discount percentage with an appropriate message. [3.5 marks]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The algorithm first takes input from the user and casts it to an integer. It then uses structured branching (`if`, `elseif`, `else`, `endif`) to assign the correct discount based on the age range. Finally, it outputs the discount with a clear message.
PastPaper.markingScheme
- 1 mark: Prompting and inputting the age, casting it to an integer. - 1 mark: Correct conditions for the boundaries (checking age >= 65 and age < 16). - 1 mark: Use of a nested/alternative selection structure (`if ... elseif ... else ... endif`). - 0.5 marks: Correct output statement displaying the determined discount.
A database table named `Students` has the fields: `StudentID`, `FirstName`, `LastName`, `YearGroup`, `Attendance`.
(a) Write an SQL query to retrieve and display the `FirstName` and `LastName` of all students who are in `YearGroup` 11 and have an `Attendance` of less than 90. [2 marks] (b) Explain why `StudentID` is used as the primary key in this table rather than `LastName`. [1.5 marks]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
(a) The `SELECT` clause retrieves the required columns (`FirstName` and `LastName`). The `FROM` clause specifies the database table (`Students`). The `WHERE` clause applies the filters with the logical operator `AND` to select students in year group 11 with attendance less than 90. (b) A primary key must uniquely identify every record. Since students can share names or other attributes, a unique identifier like `StudentID` is essential.
PastPaper.markingScheme
(a) [2 marks total]: - 1 mark for correct `SELECT` and `FROM` clauses: `SELECT FirstName, LastName FROM Students`. - 1 mark for correct `WHERE` clause with logical `AND`: `WHERE YearGroup = 11 AND Attendance < 90`.
(b) [1.5 marks total]: - 0.5 marks for stating that `StudentID` is unique / `LastName` is not unique. - 1 mark for explaining that duplicate last names would cause ambiguity/violate primary key rules as a primary key must uniquely identify each record.
The following algorithm takes a user's score and outputs their grade:
```text score = input("Enter score: ") if score >= 80 then print("Grade A") elseif score >= 50 then print("Grade B") else print("Grade C") endif ```
(a) Identify two different boundary test cases that could be used to test this algorithm, and state the expected output for each. [2 marks] (b) Explain the difference between iterative testing and final (terminal) testing. [1.5 marks]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Boundary test cases check the extreme limits of the valid ranges (on or immediately adjacent to the boundaries). For `score >= 80`, the boundary values are 79 and 80. For `score >= 50`, the boundaries are 49 and 50. Iterative testing finds bugs early in development, whereas final testing ensures the fully integrated system meets all overall requirements.
PastPaper.markingScheme
(a) [2 marks total]: - 1 mark for identifying a correct boundary score (e.g., 50, 80, 49, 79). - 1 mark for stating the correct corresponding expected output.
(b) [1.5 marks total]: - 1 mark for describing iterative testing as ongoing during development of code parts. - 0.5 marks for describing final testing as occurring at the end/on the complete product before rollout.
A game developer is writing code to validate a player's age before they can play an online game. The age must be a whole number between 13 and 120 inclusive.
Write a structured algorithm in OCR Exam Reference Language that: - Prompts the user to enter their age. - Validates that the input is within the correct range. - Continues to prompt the user until they enter a valid age. - Outputs a confirmation message once a valid age is accepted. [3.5 marks]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The algorithm uses a defensive design pattern. It uses a `while` loop that keeps prompting the user as long as the inputs fail validation. The input is converted to an integer and checked against the inclusive range bounds (13 and 120) using logical `AND`. If it passes, the loop terminates and a confirmation is printed.
PastPaper.markingScheme
- 1 mark: Initializing a loop variable or using a correct conditional loop structure (e.g. `while age < 13 OR age > 120` or equivalent). - 1 mark: Taking and casting input to integer inside the loop. - 1 mark: Correct logical conditions using logical operator `AND` / `OR` to restrict the age to the 13-120 range inclusive. - 0.5 marks: Printing a confirmation message outside the loop once valid input is entered.
A school library uses a 2D array named overdueBooks to store information about overdue books. Each element in the array is itself an array containing the title of the book (as a string) and the number of days it is overdue (as an integer). For example: overdueBooks = [["The Hobbit", 5], ["Database Design", 12], ["Python Basics", 3]]
The library charges a fine based on the following rules: - If a book is overdue by 7 days or fewer, the fine is #0.20 per day. - If a book is overdue by more than 7 days, the fine is #0.50 per day.
Write an algorithm in pseudocode or a high-level programming language that: 1. Iterates through the overdueBooks array. 2. Calculates the fine for each book based on the days overdue. 3. Calculates and outputs the total fine for all books combined.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
# OCR Exam Reference Language / Pseudocode totalFine = 0.0 for i = 0 to overdueBooks.length - 1 days = overdueBooks[i][1] if days > 7 then fine = days * 0.50 else fine = days * 0.20 endif totalFine = totalFine + fine next i print("Total fine: " + totalFine)
PastPaper.markingScheme
Award up to 5.5 marks as follows: - 1 mark: Initialising a total fine variable (e.g., totalFine = 0) before the loop. - 1 mark: Correctly looping through each element of the overdueBooks array (e.g. from index 0 to length-1). - 1 mark: Accessing the number of days overdue correctly using index [i][1] or equivalent. - 1 mark: Using an if-else structure to check if days are greater than 7. - 1 mark: Correctly calculating the fines (\(0.50 \times \text{days}\) for > 7, and \(0.20 \times \text{days}\) for \(\le 7\)) and adding them to the total. - 0.5 marks: Printing/outputting the final total fine outside the loop with an appropriate label.
A website requires users to create a username that meets specific validation criteria. Write an algorithm in pseudocode or a high-level programming language that takes a string input named username and checks if it meets the following rules: - It must be at least 6 characters long and no more than 12 characters long. - It must not contain any space characters (" ").
The algorithm should output "VALID" if the username meets both criteria, or "INVALID" otherwise.
# Check for spaces for i = 0 to length - 1 if username[i] == " " then hasSpace = true endif next i
if length >= 6 and length <= 12 and hasSpace == false then print("VALID") else print("INVALID") endif
PastPaper.markingScheme
Award up to 5.5 marks as follows: - 1 mark: Obtaining user input or taking username as an input/parameter. - 1 mark: Correctly checking that the length of username is between 6 and 12 inclusive. - 1.5 marks: Checking for space characters (1 mark for loop/search through string, 0.5 marks for flagging if " " is detected). - 1 mark: Using logical operators (AND/NOT) to combine all validation rules correctly. - 1 mark: Outputting "VALID" if all criteria are satisfied, and "INVALID" otherwise.
A text file named scores.txt contains a list of integer test scores, with each score written on a new line. Write an algorithm in pseudocode or a high-level programming language that: 1. Opens the file scores.txt in read mode. 2. Reads each score, keeps a running total of the scores, and counts the number of scores in the file. 3. Closes the file. 4. If there are scores in the file, calculates and outputs the average score. 5. If the file is empty (contains no scores), outputs the message "No scores".
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
# OCR Exam Reference Language / Pseudocode total = 0 count = 0 myFile = open("scores.txt") while NOT myFile.endOfFile() line = myFile.readLine() score = stringToInt(line) total = total + score count = count + 1 endwhile myFile.close()
if count > 0 then average = total / count print("Average: " + average) else print("No scores") endif
PastPaper.markingScheme
Award up to 5.5 marks as follows: - 1 mark: Correctly opening and closing the file "scores.txt". - 1 mark: Using a correct loop structure (e.g. while NOT endOfFile) to read all lines from the file. - 1 mark: Reading the value, casting it to an integer, and adding it to a total variable. - 1 mark: Incrementing a score counter inside the reading loop. - 1 mark: Using a conditional check to ensure count > 0 before performing the division calculation. - 0.5 marks: Printing the calculated average when count > 0, and "No scores" otherwise.
Write an algorithm in pseudocode or a high-level programming language to perform a linear search on a 1D array of integers named numbers. The algorithm should search for a target value named target. - If the target is found, the algorithm should output the index (position) where it was found and stop searching. - If the target is not found after checking the entire array, the algorithm should output "Not found".
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
# OCR Exam Reference Language / Pseudocode found = false index = -1 for i = 0 to numbers.length - 1 if numbers[i] == target then found = true index = i # Optional: exit loop early endif next i
if found == true then print("Found at index " + index) else print("Not found") endif
PastPaper.markingScheme
Award up to 5.5 marks as follows: - 1 mark: Using a loop (for or while) to iterate through the array elements. - 1 mark: Indexing the array correctly (e.g., numbers[i]) within the loop. - 1.5 marks: Conditional statement comparing the current array element to target (e.g., if numbers[i] == target). - 1 mark: Setting a flag (found = true) or updating index variables to record search success. - 1 mark: Correctly outputting the index if found, and "Not found" if the search completes with no match.
A registration program requires a user to enter an age, which must be an integer between 11 and 18 inclusive. Write an algorithm in pseudocode or a high-level programming language that: 1. Prompts the user to input their age. 2. Uses an input validation loop to check if the entered age is valid (integer between 11 and 18 inclusive). 3. If the input is invalid, outputs an error message and prompts the user to enter the age again. 4. Keeps looping until a valid age is entered. 5. Once a valid age is entered, prints "Age accepted".
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
# OCR Exam Reference Language / Pseudocode print("Please enter your age: ") age = stringToInt(input())
while age < 11 or age > 18 print("Error: Age must be between 11 and 18.") print("Please enter your age again: ") age = stringToInt(input()) endwhile
print("Age accepted")
PastPaper.markingScheme
Award up to 5.5 marks as follows: - 1 mark: Prompting the user and taking input for age (converting it to an integer). - 1.5 marks: Creating a while loop with a correct range checking condition (e.g., age < 11 OR age > 18). - 1 mark: Outputting an error message within the loop body. - 1 mark: Prompting the user again and updating the age variable inside the loop (to prevent infinite looping). - 1 mark: Printing "Age accepted" outside/after the loop terminates.
A weather station records the daily temperature for a week in a 1D array named temps, containing exactly 7 elements (representing days 1 to 7). Write an algorithm in pseudocode or a high-level programming language that: 1. Iterates through the temps array. 2. Finds the maximum temperature and the minimum temperature in the array. 3. Outputs both the maximum temperature and the minimum temperature with appropriate descriptive labels.
Award up to 5.5 marks as follows: - 1 mark: Initialising both maxTemp and minTemp to the first item in the array (temps[0]) or appropriate extreme boundaries. - 1 mark: Creating a loop that iterates through the remaining indices of the array (e.g., from index 1 to length-1). - 1 mark: Correct conditional comparison and assignment for finding the maximum temperature. - 1 mark: Correct conditional comparison and assignment for finding the minimum temperature. - 1.5 marks: Outputting both maximum and minimum temperatures with labels (0.75 marks per distinct output).