An original Thinka practice paper modelled on the structure and difficulty of the Jun 2022 Cambridge OCR GCSE Computer Science - J277 paper. Not affiliated with or reproduced from Cambridge.
Section J277/01 Computer Systems
Answer all the questions. Do not use a calculator.
19 Question · 80 marks
Question 1 · multiple_choice
4 marks
A network technician is setting up systems for an office and needs to configure different protocols. Match the network protocols (1-4) to their correct primary functions (W-Z). Protocols: 1. IMAP (Internet Message Access Protocol), 2. SMTP (Simple Mail Transfer Protocol), 3. HTTPS (Hypertext Transfer Protocol Secure), 4. FTP (File Transfer Protocol). Functions: W. Encrypts web page data and authenticates the web server. X. Used to send emails from a client to a mail server. Y. Used to download files from a server to a client over a network. Z. Retrieves emails from a mail server while keeping the emails on the server. Which of the following options shows the correct matching?
A.1 = Z, 2 = X, 3 = W, 4 = Y
B.1 = X, 2 = Z, 3 = W, 4 = Y
C.1 = Z, 2 = X, 3 = Y, 4 = W
D.1 = Y, 2 = W, 3 = Z, 4 = X
Show answer & marking schemeHide answer & marking scheme
Worked solution
The correct matching is Option A. 1 matches Z: IMAP retrieves emails from a mail server while leaving a copy on the server. 2 matches X: SMTP is used for sending/transferring outgoing emails. 3 matches W: HTTPS provides secure, encrypted web communication and server authentication. 4 matches Y: FTP is used to transfer files between computers over a network.
Marking scheme
Award 4 marks for the correct selection of Option A. Mark breakdown: 1 mark for correctly matching IMAP to its description (Z). 1 mark for correctly matching SMTP to its description (X). 1 mark for correctly matching HTTPS to its description (W). 1 mark for correctly matching FTP to its description (Y).
Question 2 · multiple_choice
4 marks
Match the registers of the Von Neumann CPU architecture (1-4) to their correct descriptions (W-Z). Registers: 1. Program Counter (PC), 2. Memory Address Register (MAR), 3. Memory Data Register (MDR), 4. Accumulator (ACC). Descriptions: W. Stores the immediate results of calculations carried out by the Arithmetic Logic Unit (ALU). X. Holds the address of the next instruction to be fetched from memory. Y. Holds the actual data or instruction that has been fetched from memory or is about to be written. Z. Holds the memory address of the current instruction or data being read from or written to. Which of the following options shows the correct matching?
A.1 = X, 2 = Y, 3 = Z, 4 = W
B.1 = X, 2 = Z, 3 = Y, 4 = W
C.1 = Z, 2 = X, 3 = Y, 4 = W
D.1 = X, 2 = Z, 3 = W, 4 = Y
Show answer & marking schemeHide answer & marking scheme
Worked solution
The correct matching is Option B. 1 matches X: The Program Counter (PC) holds the memory address of the next instruction. 2 matches Z: The Memory Address Register (MAR) holds the memory address of the current instruction/data being accessed. 3 matches Y: The Memory Data Register (MDR) holds the actual data or instruction fetched or written. 4 matches W: The Accumulator (ACC) holds the immediate results of operations from the ALU.
Marking scheme
Award 4 marks for the correct selection of Option B. Mark breakdown: 1 mark for Program Counter (PC) matching X. 1 mark for Memory Address Register (MAR) matching Z. 1 mark for Memory Data Register (MDR) matching Y. 1 mark for Accumulator (ACC) matching W.
Question 3 · multiple_choice
4 marks
Match the secondary storage devices (1-4) to their correct characteristics and common use cases (W-Z). Secondary Storage Devices: 1. Solid State Drive (SSD), 2. Magnetic Tape, 3. Blu-ray Disc, 4. USB Flash Drive. Characteristics / Use Cases: W. High capacity, slowest sequential access, very cheap per gigabyte, used primarily for offline long-term backups and archiving. X. Medium capacity, optical storage media, uses a blue laser, cheap per disc, commonly used for distributing high-definition movies. Y. High speed, non-volatile, silent with no moving parts, relatively expensive per gigabyte, used as the primary internal storage drive in modern laptops. Z. Highly portable, solid-state, small physical size, durable, low power consumption, typically used for transferring personal files between home and school. Which of the following options shows the correct matching?
A.1 = Y, 2 = W, 3 = X, 4 = Z
B.1 = Y, 2 = X, 3 = W, 4 = Z
C.1 = Z, 2 = W, 3 = X, 4 = Y
D.1 = W, 2 = Y, 3 = Z, 4 = X
Show answer & marking schemeHide answer & marking scheme
Worked solution
The correct matching is Option A. 1 matches Y: SSDs are high speed, non-volatile, silent, and serve as internal storage. 2 matches W: Magnetic Tape is the standard medium for offline long-term archive backups due to its high capacity and slow sequential access. 3 matches X: Blu-ray is an optical storage medium that uses a blue laser for high-definition media. 4 matches Z: A USB Flash Drive is solid-state, highly portable, durable, and ideal for quick file transfers.
Marking scheme
Award 4 marks for the correct selection of Option A. Mark breakdown: 1 mark for Solid State Drive (SSD) matching Y. 1 mark for Magnetic Tape matching W. 1 mark for Blu-ray Disc matching X. 1 mark for USB Flash Drive matching Z.
Question 4 · Conversions
4 marks
Add the following two 8-bit binary numbers: \(01011100\) and \(00111010\). Give your final answer in 8-bit binary and then convert your binary answer into hexadecimal. Show your working.
Show answer & marking schemeHide answer & marking scheme
Step 2: Split the 8-bit binary result into two 4-bit nibbles: - Left nibble: \(1001\) - Right nibble: \(0110\)
Step 3: Convert each nibble to hexadecimal: - \(1001\) in denary is \(8 + 0 + 0 + 1 = 9\), which is \(9\) in hex. - \(0110\) in denary is \(0 + 4 + 2 + 0 = 6\), which is \(6\) in hex.
Combining the two hex digits gives \(96\).
Marking scheme
1 mark for showing correct binary carry bits during the addition process. 1 mark for the correct 8-bit binary result: \(10010110\). 1 mark for showing a valid method of converting the binary result to hexadecimal (e.g. splitting into nibbles \(1001\) and \(0110\) or converting to denary first: \(128 + 16 + 4 + 2 = 150\)). 1 mark for the correct hexadecimal answer: \(96\).
Question 5 · Short Answer
4 marks
Describe the specific roles of the Program Counter (PC) and the Memory Address Register (MAR) during the Fetch stage of the Fetch-Decode-Execute cycle.
Show answer & marking schemeHide answer & marking scheme
Worked solution
During the fetch stage, the CPU needs to retrieve the next instruction from primary memory (RAM). 1. The Program Counter (PC) holds the memory address of the next instruction that needs to be fetched. 2. This memory address is copied from the PC into the Memory Address Register (MAR). 3. The MAR now holds the address of the current instruction to be read from RAM. 4. The PC is then incremented by 1, so it points to the memory address of the next instruction for the subsequent cycle.
Marking scheme
Award up to 4 marks: - 1 mark for stating that the Program Counter (PC) holds the address of the next instruction to be fetched. - 1 mark for stating that the address from the PC is copied into the Memory Address Register (MAR). - 1 mark for stating that the MAR holds the address of the instruction/data that is currently being fetched/read from RAM. - 1 mark for stating that the PC is incremented (by 1) to point to the next instruction.
Question 6 · Conversions
4 marks
A podcast host records a mono audio file. The audio is recorded with a sample rate of \(20,000\text{ Hz}\) and a bit depth of \(8\text{ bits}\). The recording lasts for \(30\text{ seconds}\). Calculate the file size of the recording in kilobytes (KB). Show your working. (Note: You may use \(1\text{ KB} = 1000\text{ bytes}\)).
Show answer & marking schemeHide answer & marking scheme
Worked solution
Step 1: Use the formula for sound file size: \(\text{File Size in bits} = \text{Sample Rate} \times \text{Bit Depth} \times \text{Duration (seconds)} \times \text{Number of Channels}\)
Step 2: Substitute the values into the formula (mono = 1 channel): \(\text{File Size} = 20,000 \times 8 \times 30 \times 1\) \(\text{File Size} = 4,800,000\text{ bits}\)
Step 3: Convert bits to bytes by dividing by 8: \(4,800,000 / 8 = 600,000\text{ bytes}\)
Step 4: Convert bytes to kilobytes by dividing by 1000: \(600,000 / 1000 = 600\text{ KB}\)
Marking scheme
Award up to 4 marks: - 1 mark for showing correct formula or substitution of values: \(20,000 \times 8 \times 30\). - 1 mark for correctly calculating the total bits (\(4,800,000\text{ bits}\)) or showing an equivalent byte calculation (e.g. \(20,000 \times 30 = 600,000\text{ bytes}\)). - 1 mark for dividing the total number of bits by 8 to convert to bytes (\(600,000\text{ bytes}\)). - 1 mark for dividing bytes by 1000 to reach the correct final answer of \(600\text{ KB}\). (Accept \(585.94\text{ KB}\) if divided by 1024).
Question 7 · Short Answer
4 marks
The TCP/IP model uses a layered protocol stack. Identify two layers of the TCP/IP model and describe one purpose of each of these identified layers.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The TCP/IP model consists of four layers. Correct layers and descriptions include: 1. Application Layer: Provides interfaces/services for network applications (e.g., HTTP for web browsing, SMTP for email). 2. Transport Layer: Breaks data down into packets, adds sequence numbers, and checks for transmission errors (using TCP). 3. Internet / Network Layer: Adds IP addresses (source and destination) to route packets across different networks. 4. Link / Network Access / Physical Layer: Converts packet data into physical signals (electrical, light, or radio waves) and controls the hardware transmission over physical mediums using MAC addresses.
Marking scheme
Award up to 4 marks: - 1 mark for each correct TCP/IP layer identified (Max 2 marks): Application, Transport, Internet (or Network), Link (or Network Access/Physical). - 1 mark for each correct description matching the identified layer (Max 2 marks).
Question 8 · Short Answer
4 marks
A web application is vulnerable to SQL injection attacks.
a) Explain how an SQL injection attack is carried out. (2 marks)
b) Identify two methods that developers could use to prevent or mitigate SQL injection attacks. (2 marks)
Show answer & marking schemeHide answer & marking scheme
Worked solution
Part a: SQL injection happens when an attacker types malicious SQL statements directly into user input text boxes (e.g., a username or search input field). If the application does not validate the input, the SQL database runs this text as a command rather than plain data, allowing unauthorized database queries.
Part b: To prevent this, developers can use: - Input validation: Ensuring input matches a strict format. - Input sanitisation: Stripping out special characters (such as apostrophes or quotes) that are used in SQL. - Parameterized queries (prepared statements): Treating inputs as values, not executable code. - Database privileges: Limiting database permissions of the web application user account.
Marking scheme
Part a (Max 2 marks): - 1 mark for stating that malicious SQL commands/code are entered into a user input field / web form. - 1 mark for explaining that this code is executed by the database to access, modify, bypass, or delete data without authorization.
Part b (Max 2 marks): - 1 mark per valid prevention technique named (Max 2 marks): Input validation, input sanitisation, parameterized queries / prepared statements, restricting database privileges.
Question 9 · Short Answer
4 marks
A student uses a magnetic hard disk drive (HDD) and notices their computer is running slowly.
a) Identify the utility software tool that would help improve the performance of a magnetic HDD. (1 mark)
b) Describe how this utility software tool reorganises the files to improve performance. (2 marks)
c) Explain why this utility software tool should not be used on a Solid State Drive (SSD). (1 mark)
Show answer & marking schemeHide answer & marking scheme
Worked solution
a) Disk defragmentation (or defragger) utility.
b) As files are created, modified, and deleted, they become fragmented and scattered across different physical sectors of the drive. The defragmentation tool rearranges these files so that all the parts of a single file are stored contiguously (next to each other) on the disk. This reduces the movement of the read/write head, lowering seek times and speeding up read/write performance.
c) SSDs use flash memory and have no moving parts, so fragmented files do not slow down their performance. Running a defragmentation utility on an SSD causes unnecessary write cycles, which wears down the flash memory and shortens the SSD's lifespan.
Marking scheme
Award up to 4 marks: - 1 mark for identifying Disk Defragmentation/Defragmenter utility in part a. - 2 marks in part b: 1 mark for explaining that scattered/fragmented files are reorganised so that files are stored contiguously / in consecutive sectors; 1 mark for explaining that this reduces the physical movement of the read/write head / decreases seek times. - 1 mark in part c: for stating that SSDs have no moving parts (so fragmentation does not slow access) OR that defragmentation performs unnecessary write cycles that shorten the SSD's finite lifespan.
Question 10 · Short Answer
4 marks
Explain two differences between Random Access Memory (RAM) and Read Only Memory (ROM).
Show answer & marking schemeHide answer & marking scheme
Worked solution
RAM and ROM are both types of primary storage but serve different purposes: 1. Volatility: RAM is volatile, meaning it loses all its stored data when the computer's power is turned off. ROM is non-volatile, meaning it retains its data even when the device is powered down. 2. Read/Write ability: RAM is read/write, allowing the CPU to read instructions and quickly write new data to it. ROM is read-only, meaning its contents are written during manufacture and cannot easily be altered by user actions. 3. Content: RAM holds the operating system, currently running applications, and temporary user data. ROM holds start-up instructions, such as the BIOS or bootstrap loader.
Marking scheme
Award up to 4 marks: - 2 marks for the first clear comparative difference (1 mark for describing RAM, 1 mark for describing ROM). - 2 marks for the second clear comparative difference (1 mark for describing RAM, 1 mark for describing ROM).
Acceptable comparisons include: - Volatile (RAM) vs Non-volatile (ROM). - Read/Write capability (RAM) vs Read-only capability (ROM). - Stores active programs/OS data currently in use (RAM) vs Stores startup instructions/BIOS (ROM).
Question 11 · Short Answer
4 marks
A local primary school is upgrading all of its classroom computers and needs to dispose of the old systems.
Describe two environmental issues associated with the disposal of old computer equipment, and suggest one way the school could reduce their environmental footprint during this upgrade.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Environmental Issues: 1. Toxic Substances: E-waste contains heavy metals (such as lead, mercury, and cadmium) and other toxins. If placed in standard landfills, these chemicals can leach into the surrounding soil and groundwater, harming local ecosystems and drinking water. 2. Shipping Pollution: E-waste is frequently sent to developing nations. This often leads to burning computer plastics to extract valuable metals, releasing toxic fumes into the atmosphere and poisoning local air quality.
Ways to Reduce Footprint: - Donate the old computers to charities, community projects, or lower-income families so they continue to be used, preventing them from entering the waste cycle. - Refurbish or upgrade key parts of the existing systems (e.g., adding SSDs or upgrading RAM) rather than buying entirely new computers. - Send the devices to a specialized, certified e-waste recycling plant that extracts valuable resources safely without sending toxic residues to landfill.
Marking scheme
Award up to 4 marks: - Up to 2 marks for environmental issues (1 mark per distinct issue described): e.g., toxic chemicals (such as lead/mercury) leaching into soil or water supplies from landfills; physical space taken up in landfills; toxic smoke/pollution from incinerating plastic computer casings; hazardous components being sent to developing nations where safe recycling facilities do not exist. - Up to 2 marks for the footprint reduction strategy: 1 mark for identifying a valid strategy (e.g., donating, upgrading, certified recycling); 1 mark for explaining why this reduces the environmental footprint (e.g., donating keeps computers in use longer and prevents the manufacturing of new ones, certified recycling reclaims valuable metals safely).
Question 12 · Short Answer
4 marks
A computer system uses 8-bit registers. Convert the denary number 154 into 8-bit binary, and then convert that binary value into hexadecimal. Show your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
To convert 154 to binary, use the place values: 128, 64, 32, 16, 8, 4, 2, 1. 154 >= 128 (yes, remainder 26) so 1. 26 >= 64 (no) so 0. 26 >= 32 (no) so 0. 26 >= 16 (yes, remainder 10) so 1. 10 >= 8 (yes, remainder 2) so 1. 2 >= 4 (no) so 0. 2 >= 2 (yes, remainder 0) so 1. 0 >= 1 (no) so 0. This gives the binary: 10011010. To convert to hex, split the binary into two 4-bit nibbles: 1001 and 1010. 1001 in denary is 9, which is 9 in hex. 1010 in denary is 10, which is A in hex. Combining them gives 9A.
Marking scheme
1 mark for showing binary conversion working (e.g. division by 2 or place values). 1 mark for correct binary representation (10011010). 1 mark for showing hex conversion working (e.g. splitting into nibbles). 1 mark for correct hexadecimal representation (9A).
Question 13 · Short Answer
4 marks
A digital audio recording has a sample rate of 44,000 Hz, a bit depth of 16 bits, uses a single channel (mono), and has a duration of 10 seconds. Calculate the file size of the recording in kilobytes (KB). Show your working. Assume 1 KB = 1,000 bytes.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Calculate total bits: 44,000 Hz * 16 bits * 10 seconds * 1 channel = 7,040,000 bits. 2. Convert bits to bytes by dividing by 8: 7,040,000 / 8 = 880,000 bytes. 3. Convert bytes to kilobytes by dividing by 1,000: 880,000 / 1,000 = 880 KB.
Marking scheme
1 mark for correct calculation of total bits (7,040,000 bits) or formula setup. 1 mark for dividing the total bits by 8 to convert to bytes. 1 mark for dividing the byte total by 1,000 (or 1,024) to convert to KB. 1 mark for correct final answer of 880 KB (or 859.38 KB if 1,024 is used).
Question 14 · Short Answer
4 marks
The CPU architecture uses various registers. Identify two registers in the Von Neumann architecture, and explain the specific role of each.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Two typical registers used are: 1. Program Counter (PC): Holds the address of the next instruction to be fetched from memory. 2. Memory Address Register (MAR): Holds the address of the current memory location being read from or written to.
Marking scheme
1 mark for identifying the first correct register (e.g. PC, MAR, MDR, Accumulator). 1 mark for describing its correct role. 1 mark for identifying the second correct register. 1 mark for describing its correct role.
Question 15 · Short Answer
4 marks
The TCP/IP stack consists of four distinct layers. Identify two of these layers, and describe the main function or purpose of each.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The four layers are Application, Transport, Internet, and Link. Example: 1. Transport Layer splits data into packets and adds packet sequence numbers. 2. Internet Layer handles the routing of packets across the network by adding IP addresses.
Marking scheme
1 mark for identifying the first correct TCP/IP layer (Application, Transport, Internet/Network, or Link/Network Interface). 1 mark for explaining its function. 1 mark for identifying the second correct TCP/IP layer. 1 mark for explaining its function.
Question 16 · Short Answer
4 marks
SQL injection is a common security vulnerability. Explain how a SQL injection attack is carried out on a database, and identify one defensive technique that can prevent it.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An SQL injection attack is carried out when an attacker inputs malicious SQL commands into a user input field (like a login form). If the input is not validated or sanitized, the server passes this input directly to the database, where it is executed as a command. This allows the attacker to bypass login credentials or read/modify unauthorized database tables. This can be prevented by using parameterized queries (prepared statements), input validation, or input sanitization.
Marking scheme
1 mark for explaining that malicious SQL code is input into text/input boxes. 1 mark for explaining that the SQL code is run/executed by the database due to lack of input validation. 1 mark for describing the consequence (unauthorized data access, database manipulation). 1 mark for naming a valid prevention method (parameterized queries, input validation, or input sanitization).
Question 17 · Short Answer
4 marks
A school network manager needs secondary storage for two different tasks: Task A: Making weekly backups of the school's central server. Task B: Providing students with a storage device to carry homework to and from school. Identify the most suitable storage technology (Magnetic, Optical, or Solid State) for each task, and justify your choice.
Show answer & marking schemeHide answer & marking scheme
Worked solution
For Task A, Magnetic storage is best because server backups require massive capacities and magnetic drives offer very low cost per gigabyte. For Task B, Solid State storage (such as a USB flash drive) is best because students require a highly portable, durable device with no moving parts to withstand transport, with fast transfer speeds.
Marking scheme
1 mark for identifying Magnetic storage for Task A. 1 mark for justifying Task A (e.g., high capacity or low cost per GB). 1 mark for identifying Solid State storage for Task B. 1 mark for justifying Task B (e.g., portable, durable, or high read/write speed).
Question 18 · Short Answer
4 marks
A designer is saving a high-quality vector logo for a business client. Describe the difference between lossy and lossless compression, and explain why lossless compression is the better choice for this specific task.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Lossy compression permanently discards some data to reduce file size, which can degrade quality. Lossless compression reduces file size without losing any data, allowing the original file to be reconstructed perfectly. Lossless compression is better for a logo because logos require precise colors, high contrast, and sharp edges. Lossy compression would cause blurriness or artifacts around the edges, making the logo look unprofessional.
Marking scheme
1 mark for explaining lossy compression (permanent data loss, quality reduction). 1 mark for explaining lossless compression (no data loss, perfect reconstruction). 1 mark for stating that logos require sharp edges/precise colors. 1 mark for explaining that lossy compression causes visual degradation or artifacts around the edges of the logo.
Question 19 · Extended Response Discussion
8 marks
A national supermarket chain, 'QuickBuy', is planning to replace all of its traditional staffed checkout counters with an automated AI-powered smart shopping system. In this new system, customers use computer-vision cameras and sensors to track the items they take from shelves, and their bank accounts are automatically billed when they walk out of the store. This change will completely eliminate the need for checkout staff.
Discuss the impact of QuickBuy's decision to implement this automated system. Your discussion should address: - Ethical and cultural issues - Environmental issues - Legal issues
Show answer & marking schemeHide answer & marking scheme
Worked solution
Indicative Content:
1. Ethical and Cultural Impacts: - Job Losses: Significant redundancy of low-skilled checkout workers. While new high-skilled jobs (IT maintenance, AI monitoring) are created, existing staff may not have the skills, leading to social inequality and unemployment. - Social Isolation: Some customers, particularly the elderly or lonely, value the human interaction of talking to a cashier. Removing this harms community well-being. - Digital Divide / Accessibility: Tech-illiterate, visually impaired, or disabled customers may find the automated environment confusing or unusable, alienating them from basic shopping. - Convenience: Shoppers experience frictionless, faster transactions with no queues.
2. Environmental Impacts: - E-Waste: Replacing thousands of traditional electronic cash registers and card machines creates massive quantities of electronic waste which may end up in landfill if not recycled properly. - Energy Footprint: Operating massive sensor arrays, 24/7 high-definition cameras, and continuous cloud-based AI processing servers consumes significant electrical power, increasing carbon emissions. - Resource Depletion: Manufacturing new advanced silicon chips, cameras, and IoT sensors requires mining rare earth metals.
3. Legal Impacts: - Data Protection Act 2018 / GDPR: The supermarket will collect highly personal biometric/tracking data of shoppers. They must legally justify the collection, store it securely, prevent unauthorized access, and ensure data is not kept longer than necessary. - Consent and Privacy: Customers must be clearly informed that they are being tracked by camera-based AI. There must be legal frameworks for handling data of minors (children) entering the store. - Cybersecurity Liabilities: If the database holding payment credentials or customer tracking logs is breached, QuickBuy faces massive legal fines and lawsuits.
Marking scheme
This is an 8-mark extended-response question assessed using a levels-of-response mark scheme.
Level 3 (7-8 marks): - The candidate demonstrates a thorough, balanced, and detailed understanding of all three areas: ethical/cultural, environmental, and legal impacts. - Arguments are well-structured, coherent, and highly relevant to the supermarket scenario. - Consistent and accurate use of appropriate computer science terminology (e.g., GDPR, DPA, e-waste, carbon footprint).
Level 2 (4-6 marks): - The candidate discusses at least two of the three areas in reasonable depth, or covers all three in a more superficial way. - The response is mostly structured, and some points are contextualized to the supermarket scenario. - Some computer science terminology is used correctly.
Level 1 (1-3 marks): - The candidate identifies a few basic impacts but lacks depth, or heavily focuses on only one area (e.g., only discussing job losses). - The answer may be unstructured, consisting of a list of bullet points with little explanation. - Little or no technical terminology is used.
0 marks: - No worthy content or completely unrelated response.
Section J277/02 Computational thinking, algorithms and programming
Answer all questions in Section A and Section B. Do not use a calculator.
18 Question · 79.79999999999998 marks
Question 1 · Logic & Trace Tasks
3.5 marks
A programmer has written the following algorithm using OCR Exam Reference Language: total = 0; for i = 1 to 5; if i MOD 2 == 1 then total = total + (i * 2) else total = total - i endif; next i. Complete a trace of the algorithm. What is the final value of the variable 'total' when the algorithm terminates?
Show answer & marking schemeHide answer & marking scheme
Worked solution
Initially, total = 0. Iteration 1 (i = 1): 1 MOD 2 == 1 is True, so total = 0 + (1 * 2) = 2. Iteration 2 (i = 2): 2 MOD 2 == 1 is False, so total = 2 - 2 = 0. Iteration 3 (i = 3): 3 MOD 2 == 1 is True, so total = 0 + (3 * 2) = 6. Iteration 4 (i = 4): 4 MOD 2 == 1 is False, so total = 6 - 4 = 2. Iteration 5 (i = 5): 5 MOD 2 == 1 is True, so total = 2 + (5 * 2) = 12. Therefore, the final value of total is 12.
Marking scheme
1 mark for correct trace of i=1 and i=2; 1 mark for correct trace of i=3 and i=4; 1.5 marks for correct trace of i=5 and correct final value of 12.
Question 2 · Logic & Trace Tasks
3.5 marks
A logic circuit is described as follows: Input A goes into a NOT gate, producing intermediate output P. P and input B are inputs to an AND gate, producing intermediate output Q. Input B and input C are inputs to an OR gate, producing intermediate output R. Q and R are inputs to an XOR gate, producing the final output Z. Calculate the final value of output Z when the input values are: A = 0, B = 1, C = 0.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Step 1: P = NOT A = NOT 0 = 1. Step 2: Q = P AND B = 1 AND 1 = 1. Step 3: R = B OR C = 1 OR 0 = 1. Step 4: Z = Q XOR R = 1 XOR 1 = 0. Thus, the final value of output Z is 0.
Marking scheme
1 mark for calculating P = 1; 1 mark for calculating Q = 1; 0.5 marks for calculating R = 1; 1 mark for calculating Z = 0.
Question 3 · Logic & Trace Tasks
3.5 marks
An algorithm processes a string to count specific characters: phrase = "COFFEE"; count = 0; for index = 0 to phrase.length - 1; char = phrase.substring(index, 1); if char == "E" or char == "F" then count = count + 2 else count = count - 1 endif; next index. Note: phrase.substring(index, 1) extracts 1 character at the specified index, starting at index 0. State the final value of the variable 'count' after this algorithm runs.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Initial count = 0. Index 0 (char = 'C'): condition False, count = 0 - 1 = -1. Index 1 (char = 'O'): condition False, count = -1 - 1 = -2. Index 2 (char = 'F'): condition True, count = -2 + 2 = 0. Index 3 (char = 'F'): condition True, count = 0 + 2 = 2. Index 4 (char = 'E'): condition True, count = 2 + 2 = 4. Index 5 (char = 'E'): condition True, count = 4 + 2 = 6. The final value is 6.
Marking scheme
1 mark for correctly extracting each character in order; 1 mark for correctly updating count to -2 for non-matching characters; 1.5 marks for correctly updating count to 6 and getting the correct final answer.
Question 4 · Logic & Trace Tasks
3.5 marks
Evaluate the boolean expression: Z = (NOT(A AND B)) OR (C AND (NOT B)) for the following two cases. Case 1: A = True, B = True, C = False. Case 2: A = True, B = False, C = True. State the final evaluated boolean value (True or False) for Case 1 and Case 2 respectively.
Show answer & marking schemeHide answer & marking scheme
Worked solution
For Case 1: NOT(True AND True) OR (False AND NOT True) = NOT(True) OR (False AND False) = False OR False = False. For Case 2: NOT(True AND False) OR (True AND NOT False) = NOT(False) OR (True AND True) = True OR True = True. Therefore, Case 1 evaluates to False, and Case 2 evaluates to True.
Marking scheme
1.5 marks for correct working and final output of Case 1 (False); 2 marks for correct working and final output of Case 2 (True).
Question 5 · Logic & Trace Tasks
3.5 marks
Trace the linear search algorithm: numbers = [12, 45, 19, 27, 33, 19]; target = 19; found = False; index = 0; while index < 6 and found == False; if numbers[index] == target then found = True else index = index + 1 endif; endwhile. What are the final values of variables 'index' and 'found' when the loop finishes?
Show answer & marking schemeHide answer & marking scheme
Worked solution
Initial: index = 0, found = False. Iteration 1: numbers[0] is 12, not equal to target 19, so index becomes 1. Iteration 2: numbers[1] is 45, not equal to target 19, so index becomes 2. Iteration 3: numbers[2] is 19, which matches target 19, so found becomes True. The loop condition is checked: index < 6 (2 < 6 is True) and found == False (True == False is False), so the loop terminates. Final values: index = 2, found = True.
Marking scheme
1 mark for tracing the first iteration; 1 mark for tracing the second iteration; 1.5 marks for tracing the third iteration and identifying correct final values (index = 2, found = True).
Question 6 · Logic & Trace Tasks
3.5 marks
A program contains nested loops to calculate a grid sum: result = 0; for outer = 1 to 3; for inner = 1 to outer; result = result + (outer - inner); next inner; next outer. What is the final value of 'result' when the program finishes executing?
Show answer & marking schemeHide answer & marking scheme
Worked solution
When outer = 1: inner runs from 1 to 1. result = 0 + (1 - 1) = 0. When outer = 2: inner runs from 1 to 2. At inner = 1: result = 0 + (2 - 1) = 1. At inner = 2: result = 1 + (2 - 2) = 1. When outer = 3: inner runs from 1 to 3. At inner = 1: result = 1 + (3 - 1) = 3. At inner = 2: result = 3 + (3 - 2) = 4. At inner = 3: result = 4 + (3 - 3) = 4. Final value is 4.
Marking scheme
1 mark for tracing outer = 1; 1 mark for tracing outer = 2; 1.5 marks for tracing outer = 3 and correctly determining final value 4.
Question 7 · Logic & Trace Tasks
3.5 marks
An algorithm uses division operators: number = 23; binary_string = ""; while number > 0; remainder = number MOD 2; binary_string = str(remainder) + binary_string; number = number DIV 2; endwhile. Show the progression of 'binary_string' and state its final value when the loop terminates.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Iteration 1: remainder = 23 MOD 2 = 1, binary_string = '1' + '' = '1', number = 23 DIV 2 = 11. Iteration 2: remainder = 11 MOD 2 = 1, binary_string = '1' + '1' = '11', number = 11 DIV 2 = 5. Iteration 3: remainder = 5 MOD 2 = 1, binary_string = '1' + '11' = '111', number = 5 DIV 2 = 2. Iteration 4: remainder = 2 MOD 2 = 0, binary_string = '0' + '111' = '0111', number = 2 DIV 2 = 1. Iteration 5: remainder = 1 MOD 2 = 1, binary_string = '1' + '0111' = '10111', number = 1 DIV 2 = 0. The loop terminates. Final value: '10111'.
Marking scheme
1 mark for correct traces of first 2 iterations; 1.5 marks for correct traces of iterations 3 and 4; 1 mark for correct fifth iteration and final binary_string '10111'.
Question 8 · Logic & Trace Tasks
3.5 marks
A single pass of a simple sorting algorithm is performed on the array: data = [15, 8, 22, 14, 6] using the following code: for i = 0 to 3; if data[i] > data[i+1] then temp = data[i]; data[i] = data[i+1]; data[i+1] = temp; endif; next i. What is the state of the 'data' array after this loop finishes?
Show answer & marking schemeHide answer & marking scheme
Worked solution
Initial: [15, 8, 22, 14, 6]. i = 0: 15 > 8 is True, so swap. data becomes [8, 15, 22, 14, 6]. i = 1: 15 > 22 is False, no swap. data remains [8, 15, 22, 14, 6]. i = 2: 22 > 14 is True, so swap. data becomes [8, 15, 14, 22, 6]. i = 3: 22 > 6 is True, so swap. data becomes [8, 15, 14, 6, 22]. Loop ends.
Marking scheme
1 mark for correct state of array after i=0; 1 mark for correct state of array after i=2; 1.5 marks for correct state of array after i=3 and final correct answer.
Question 9 · Logic & Trace Tasks
3.5 marks
An algorithm is written in pseudocode to process three variables: a, b, and c.
``` a = 15 b = 4 c = 1 while a > b a = a - 3 b = b + 1 c = c * 2 endwhile ```
Determine the final values of a, b, and c after the algorithm has completed execution.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let's trace the algorithm step-by-step: - Initial values: a = 15, b = 4, c = 1. - Loop 1: Is a > b? (15 > 4) is True. - a = 15 - 3 = 12 - b = 4 + 1 = 5 - c = 1 * 2 = 2 - Loop 2: Is a > b? (12 > 5) is True. - a = 12 - 3 = 9 - b = 5 + 1 = 6 - c = 2 * 2 = 4 - Loop 3: Is a > b? (9 > 6) is True. - a = 9 - 3 = 6 - b = 6 + 1 = 7 - c = 4 * 2 = 8 - Loop 4: Is a > b? (6 > 7) is False. The loop terminates.
Therefore, the final values are: a = 6, b = 7, c = 8.
Marking scheme
1 mark for correct final value of a (6). 1 mark for correct final value of b (7). 1.5 marks for correct final value of c (8). (Award 1 mark if a clear trace is shown indicating c doubles at least twice but final arithmetic is incorrect).
Question 10 · Logic & Trace Tasks
3.5 marks
A computer system uses the following Boolean logic expression to control a safety valve:
`ValveOpen = (A AND NOT B) OR (NOT C)`
Complete the truth table by determining the state of `ValveOpen` (1 or 0) for each of the following sets of inputs:
1) A = 1, B = 0, C = 1 2) A = 1, B = 1, C = 1 3) A = 0, B = 1, C = 0
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let's evaluate the expression `ValveOpen = (A AND NOT B) OR (NOT C)` for each set of inputs:
1) A = 1, B = 0, C = 1: - NOT B = NOT 0 = 1 - A AND NOT B = 1 AND 1 = 1 - NOT C = NOT 1 = 0 - ValveOpen = 1 OR 0 = 1
2) A = 1, B = 1, C = 1: - NOT B = NOT 1 = 0 - A AND NOT B = 1 AND 0 = 0 - NOT C = NOT 1 = 0 - ValveOpen = 0 OR 0 = 0
3) A = 0, B = 1, C = 0: - NOT B = NOT 1 = 0 - A AND NOT B = 0 AND 0 = 0 - NOT C = NOT 0 = 1 - ValveOpen = 0 OR 1 = 1
Marking scheme
1 mark for correct output 1 for Row 1. 1 mark for correct output 0 for Row 2. 1.5 marks for correct output 1 for Row 3.
Question 11 · Logic & Trace Tasks
3.5 marks
The following pseudocode algorithm processes an array of integers named `scores`:
``` scores = [12, 5, 18, 9, 3] for i = 0 to 3 if scores[i] < scores[i+1] then temp = scores[i] scores[i] = scores[i+1] scores[i+1] = temp endif next i ```
State the contents of the `scores` array after this algorithm has run to completion.
Show answer & marking schemeHide answer & marking scheme
1.5 marks for showing/identifying that elements are shifted to sort in descending order (or identifying the correct swap at i=1). 1 mark for correctly swapping at i=2 resulting in the value 9 moving left. 1 mark for the correct final array order: [12, 18, 9, 5, 3].
Question 12 · Logic & Trace Tasks
3.5 marks
The following algorithm uses a loop to perform division using repeated subtraction:
``` count = 0 num = 23 while num >= 5 num = num - 5 count = count + 1 endwhile ```
State the final values of `count` and `num` after the algorithm finishes executing.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let's trace the algorithm step-by-step: - Initial values: count = 0, num = 23. - Loop 1: Is num >= 5? (23 >= 5) is True. num = 23 - 5 = 18, count = 1. - Loop 2: Is num >= 5? (18 >= 5) is True. num = 18 - 5 = 13, count = 2. - Loop 3: Is num >= 5? (13 >= 5) is True. num = 13 - 5 = 8, count = 3. - Loop 4: Is num >= 5? (8 >= 5) is True. num = 8 - 5 = 3, count = 4. - Loop 5: Is num >= 5? (3 >= 5) is False. The loop terminates.
Therefore, the final values are count = 4 and num = 3.
Marking scheme
1.5 marks for correct final value of count (4). 1.5 marks for correct final value of num (3). Award 1 mark if a trace is present showing division by repeated subtraction is attempted but a minor arithmetic mistake leads to incorrect outputs.
Question 13 · Algorithmic Design & Writing
6.3 marks
A cinema wants to automate its ticket booking system. Standard tickets cost £10.00. The cinema offers discounts based on the customer's age and the day of the week: Children under 12 receive a 50% discount; Seniors (aged 65 and over) receive a 40% discount; On "Tuesday", all customers receive an additional £2.00 discount after any age-based discount has been applied. The final price cannot be less than £0.00. Write an algorithm in pseudocode or OCR Exam Reference Language that inputs the user's age and the day of the week, calculates the final ticket price, and outputs the calculated price.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Example pseudocode: price = 10.00; age = input("Enter age: "); day = input("Enter day: "); if age < 12 then price = price * 0.50 elseif age >= 65 then price = price * 0.60 endif; if day == "Tuesday" then price = price - 2.00 endif; if price < 0.00 then price = 0.00 endif; print("Final price is £" + price)
Marking scheme
1 mark: Prompting and capturing inputs for age and day. 1 mark: Checking if age is under 12 and correctly applying 50% discount. 1 mark: Checking if age is 65 or over and correctly applying 40% discount. 1 mark: Correct selection block to subtract £2.00 if the day is Tuesday. 1 mark: Ensuring final price does not go below £0.00 (e.g. using selection check). 1.3 marks: Outputting the final calculated price with appropriate framing text.
Question 14 · Algorithmic Design & Writing
6.3 marks
A smart greenhouse uses a temperature control system. Sensor readings are taken 4 times a day and stored in a 1D array named `readings` (with indices from 0 to 3). Write an algorithm in pseudocode or OCR Exam Reference Language that iterates through the four elements of the `readings` array, calculates the average temperature, and outputs: "HEATER ON" if the average is below 15; "VENT OPEN" if the average is above 28; "SYSTEM IDEAL" for any other average.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Example pseudocode: total = 0; for i = 0 to 3 total = total + readings[i] next i; average = total / 4; if average < 15 then print("HEATER ON") elseif average > 28 then print("VENT OPEN") else print("SYSTEM IDEAL") endif
Marking scheme
1 mark: Initializing sum variable to 0. 1 mark: Using a loop (e.g. for i = 0 to 3) to iterate through the array indices. 1 mark: Accumulating the values of array elements in the sum variable. 1 mark: Correctly calculating the average by dividing the sum by 4. 1 mark: Implementing a nested or chained selection statement to check if average < 15 and > 28. 1.3 marks: Outputting the correct strings ("HEATER ON", "VENT OPEN", "SYSTEM IDEAL") in the correct branches.
Question 15 · Algorithmic Design & Writing
6.3 marks
A program is required to process high scores stored in a text file named "scores.txt". Each line in the file contains a player's name and their score separated by a comma (for example: "Alice,140"). Write an algorithm in pseudocode or OCR Exam Reference Language that opens the file, reads through each line, finds the name of the player with the highest score, outputs their name, and closes the file. You may assume that the file is not empty and all scores are positive integers.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Example pseudocode: file = open("scores.txt"); highScore = -1; highName = ""; while NOT file.endOfFile() line = file.readLine(); parts = line.split(","); currentName = parts[0]; currentScore = strToInt(parts[1]); if currentScore > highScore then highScore = currentScore; highName = currentName; endif; endwhile; file.close(); print("Highest scoring player: " + highName)
Marking scheme
1 mark: Correctly opening "scores.txt" and closing the file. 1 mark: Initializing high score to a low value (e.g. -1 or 0) and high name to empty string. 1 mark: Correctly implementing a while loop to read each line until the end of the file is reached. 1 mark: Splitting the read line correctly using comma separation to extract name and score. 1 mark: Comparing the current score (cast to integer) against the current high score. 1.3 marks: Updating high score and corresponding high name on a match, and outputting the correct name after the loop finishes.
Question 16 · Algorithmic Design & Writing
6.3 marks
A supermarket awards loyalty points based on the transaction value. Points are awarded on the total amount spent (represented as a real number) as follows: Spending under £10 earns 1 point per full £1 spent; Spending from £10 up to and including £50 earns 1.5 points per full £1 spent; Spending over £50 earns 2 points per full £1 spent. Write an algorithm in pseudocode or OCR Exam Reference Language that inputs the spent amount, calculates the total points earned (which must be output as an integer, discarding any fractional points), and outputs the phrase "Points earned: " followed by the point total.
Show answer & marking schemeHide answer & marking scheme
1 mark: Inputting amount and ensuring it is handled as a real number. 1 mark: Checking if amount is less than 10 and multiplying by 1. 1 mark: Checking if amount is between 10 and 50 inclusive and multiplying by 1.5. 1 mark: Checking if amount is greater than 50 and multiplying by 2. 1 mark: Discarding the fractional part of the calculated points (e.g. using int() or floor function). 1.3 marks: Outputting the final result exactly as "Points earned: " followed by the integer point value.
Question 17 · Algorithmic Design & Writing
6.3 marks
A software application requires users to create a valid username. A username is valid if it contains between 6 and 15 characters (inclusive) and does not contain any spaces. Write an algorithm in pseudocode or OCR Exam Reference Language that prompts the user to enter a username, validates it according to the criteria using a loop, repeats the prompt until a valid username is entered, and finally outputs "Username registered successfully".
Show answer & marking schemeHide answer & marking scheme
Worked solution
Example pseudocode: valid = false; while valid == false username = input("Enter username: "); if username.length >= 6 AND username.length <= 15 AND NOT username.contains(" ") then valid = true else print("Invalid username. Try again.") endif; endwhile; print("Username registered successfully")
Marking scheme
1 mark: Using a loop structure (while or repeat-until) to enable repeated prompting. 1 mark: Prompting and capturing input for username inside the loop. 1 mark: Checking that username length is at least 6. 1 mark: Checking that username length is at most 15. 1 mark: Checking that username does not contain spaces. 1.3 marks: Correctly setting control conditions to exit the loop on valid input and outputting "Username registered successfully".
Question 18 · Algorithmic Design & Writing
6.3 marks
An application stores a list of registered group members in a 1D array of 10 strings named `memberNames`. Write an algorithm in pseudocode or OCR Exam Reference Language to perform a linear search. The algorithm must: prompt the user to input a name to search for, search through the array `memberNames` to find the name, if found, output "Member found at index " followed by the index of that name and stop searching, if the entire array is searched and the name is not found, output "Member not found".
Show answer & marking schemeHide answer & marking scheme
Worked solution
Example pseudocode: searchName = input("Enter member name: "); found = false; index = -1; for i = 0 to 9 if memberNames[i] == searchName then found = true; index = i; break; endif; next i; if found == true then print("Member found at index " + str(index)) else print("Member not found") endif
Marking scheme
1 mark: Capturing user input for the search term. 1 mark: Using a loop that correctly iterates 10 times (from index 0 to 9). 1 mark: Correctly referencing array element using loop variable index (e.g. memberNames[i]). 1 mark: Comparing array element to the search term with selection. 1 mark: Managing a state indicator (e.g. boolean flag or index variable) to track whether the element was found. 1.3 marks: Outputting the index on success and outputting "Member not found" only if the loop completes without finding the element.
Wondering how well you actually know this?
Thinka is an AI practice app for DSE 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.