IB DP · Thinka-original Practice Paper

2023 IB DP Computer Science Practice Paper with Answers

Thinka May 2023 HL (TZ1) IB Diploma Programme-Style Mock — Computer Science

130 marks190 mins2023
An original Thinka practice paper modelled on the structure and difficulty of the May 2023 HL (TZ1) IB Diploma Programme Computer Science paper. Not affiliated with or reproduced from IB.

Paper 1 Section A

Answer all questions.
9 Question · 24.599999999999998 marks
Question 1 · Short Answer
2.7 marks
Explain one consequence of failing to perform thorough beta testing before releasing a new software application to the public.
Show answer & marking scheme

Worked solution

Beta testing involves releasing a pre-release version to a select group of target users in real-world environments. Without it, diverse system compatibilities and edge cases remain untested. This can lead to critical bugs post-release, resulting in negative user feedback, increased customer support demands, and the urgent need to deploy expensive, emergency hotfixes.

Marking scheme

Award [1 mark] for identifying a valid consequence (e.g., reputational damage, high support costs, critical bugs). Award [1 mark] for explaining the mechanism (e.g., because real-world user environments are highly diverse and unsimulated in developer environments). Award [0.7 marks] for linking this directly to the organizational impact (e.g., loss of revenue or high cost of emergency patch cycles).
Question 2 · Short Answer
2.7 marks
Outline the function of the Program Counter (PC) register during the fetch-execute cycle.
Show answer & marking scheme

Worked solution

During the Fetch phase, the CPU copies the memory address stored in the Program Counter (PC) to the Memory Address Register (MAR). The PC is then automatically incremented by the control unit to point to the address of the next instruction in sequence, ensuring continuous execution of the program.

Marking scheme

Award [1 mark] for stating that the PC holds or stores the address of the next instruction to be executed. Award [1 mark] for explaining that its value is copied or transferred to the Memory Address Register (MAR) during the fetch stage. Award [0.7 marks] for noting that it increments or updates automatically to point to the subsequent instruction.
Question 3 · Short Answer
2.7 marks
Explain the necessity of protocols in network communication.
Show answer & marking scheme

Worked solution

Without a common protocol, receiving devices would not know how to interpret incoming electrical, optical, or radio signals, how to extract data packets, how to perform error checking, or how to handle flow control. Standardized rules guarantee compatibility and error-free delivery between diverse hardware and software architectures.

Marking scheme

Award [1 mark] for defining a protocol as a standardized set of rules. Award [1 mark] for explaining that it ensures interoperability or compatibility between different hardware and software configurations. Award [0.7 marks] for mentioning a specific function such as error checking, flow control, or packet formatting.
Question 4 · Short Answer
2.7 marks
Distinguish between a bubble sort and a selection sort algorithm in terms of how they compare and swap elements.
Show answer & marking scheme

Worked solution

Bubble sort works by continuous adjacent comparisons and swaps throughout each pass, gradually moving the largest or smallest elements to the end of the list. In contrast, selection sort performs multiple comparisons to locate the minimum or maximum value in the unsorted portion of the list, but only performs a single swap at the end of each pass once the target element is identified.

Marking scheme

Award [1 mark] for describing bubble sort's mechanism (adjacent comparisons and multiple swaps per pass). Award [1 mark] for describing selection sort's mechanism (scanning for min/max and swapping once per pass). Award [0.7 marks] for explicitly contrasting the frequency of swaps or the focus of the comparisons (adjacent vs global scan).
Question 5 · Short Answer
2.7 marks
Outline one advantage and one disadvantage of using a dynamic linked list compared to a static array.
Show answer & marking scheme

Worked solution

A dynamic linked list allocates memory as nodes are added, meaning there is no fixed upper limit, unlike a static array which has a predetermined size. However, linked lists do not support direct indexing (meaning access by index is \(O(n)\) instead of \(O(1)\) for arrays) and require additional memory for storing pointers in each node.

Marking scheme

Award [1 mark] for a valid advantage (e.g., dynamic size, efficient insertions/deletions). Award [1 mark] for a valid disadvantage (e.g., pointer overhead, lack of random access / sequential search required). Award [0.7 marks] for linking these properties back to performance or resource utilization.
Question 6 · Short Answer
2.7 marks
Explain how virtual memory is used by an operating system when physical RAM is fully utilized.
Show answer & marking scheme

Worked solution

When physical RAM is exhausted, the operating system allocates space on secondary storage (such as a hard disk or solid-state drive) known as swap space. Through paging, inactive memory blocks are transferred to the disk, allowing active processes to run. If the swapped-out data is requested again, a page fault occurs, prompting the OS to swap out other data to bring the requested data back into physical RAM.

Marking scheme

Award [1 mark] for explaining that virtual memory uses secondary storage to simulate primary memory. Award [1 mark] for describing the process of paging or swapping inactive memory blocks from RAM to the storage drive. Award [0.7 marks] for explaining that this allows programs larger than physical memory to execute, despite slower processing speeds.
Question 7 · Short Answer
2.7 marks
Identify the distinct roles of a sensor and an actuator within an automated greenhouse ventilation control system.
Show answer & marking scheme

Worked solution

A sensor functions as an input device, continually monitoring physical characteristics of the environment (such as a temperature sensor measuring the greenhouse air temperature) and sending data to the processor. An actuator functions as an output device, receiving commands from the central processor and converting electrical energy into physical action (such as starting a motor to lift open the ventilation panels).

Marking scheme

Award [1 mark] for defining the role of the sensor as an input/measurement device transforming physical stimuli into data. Award [1 mark] for defining the role of the actuator as an output/action device transforming data commands into physical movement. Award [0.7 marks] for contextualizing both within the greenhouse ventilation system.
Question 8 · Short Answer
2.7 marks
Compare a direct changeover system implementation method with a phased introduction implementation method.
Show answer & marking scheme

Worked solution

Direct changeover replaces the old system instantly with the new one. If the new system fails, there is no backup, representing high risk, but it avoids running duplicate systems. Phased introduction implements the new system in parts (e.g., one module or department at a time), which allows issues to be isolated and resolved with lower overall risk, although it requires running both systems concurrently for a period.

Marking scheme

Award [1 mark] for describing direct changeover and its characteristics (instantaneous, high risk, fast/inexpensive). Award [1 mark] for describing phased introduction and its characteristics (modular rollout, lower risk, slower/complex). Award [0.7 marks] for providing a clear comparative point, such as contrasting the level of operational risk against implementation cost or time.
Question 9 · Short Answer
3 marks
In a packet-switched network, a router is responsible for directing data traffic. State three distinct roles performed by a router to ensure packets successfully reach their destination.
Show answer & marking scheme

Worked solution

A router performs three key functions: First, it receives incoming packets and inspects their headers to extract the destination IP address. Second, it consults its routing table, which contains network topology information, to determine the most efficient next hop or network interface for the packet based on metrics like distance or congestion. Third, it forwards the packet from the incoming interface to the appropriate outgoing interface, sending it closer to its final destination.

Marking scheme

Award [1] mark for each distinct role identified, up to a maximum of [3] marks: [1 mark] for reading or inspecting the packet header to find the destination IP; [1 mark] for consulting a routing table or applying algorithms to determine the optimal path or next hop; [1 mark] for forwarding the packet to the appropriate output interface or next node.

Paper 1 Section B

Answer all questions.
5 Question · 75 marks
Question 1 · Structured
15 marks
A local regional hospital is planning to transition from its old paper-based medical records system to a modern centralized electronic health record (EHR) database system. (a) Identify two stakeholders who should be consulted during the planning phase of this transition. [2] (b) Explain one advantage and one disadvantage of using direct changeover as the installation method for this new system. [4] (c) Outline how data could be lost or corrupted during the migration process, and describe one measure the hospital can implement to mitigate this risk. [3] (d) Explain how user acceptance testing (UAT) can improve the usability and effectiveness of the new EHR system. [4] (e) State two reasons why a system prototype would be developed during the early stages of the design process. [2]
Show answer & marking scheme

Worked solution

(a) Stakeholders: Doctors, nurses, administrative clerks, IT support technicians, or hospital management. (b) Advantage of direct changeover: The changeover is rapid and immediate, which reduces operational costs of maintaining dual systems. Disadvantage: If the new system fails, there is no backup system, which could lead to critical disruption of patient care. (c) Data loss/corruption: Can occur due to mismatched database schemas, format incompatibilities, or transfer interruption. Mitigation: Create complete system backups before migration and perform validation checks like database checksums. (d) UAT involves representative healthcare users performing daily operational tasks. This helps reveal non-intuitive controls, workflow bottlenecks, and errors in medical record entries before system launch. (e) Prototypes are built to gather early user feedback and to verify design feasibility.

Marking scheme

(a) [2 marks] Award 1 mark for each identified stakeholder up to 2. (b) [4 marks] Award 2 marks for advantage (1 mark for statement, 1 mark for explanation) and 2 marks for disadvantage (1 mark for statement, 1 mark for explanation). (c) [3 marks] Award 1 mark for identifying a source of data loss/corruption, and 2 marks for a well-described mitigation measure. (d) [4 marks] Award 1 mark per point explaining UAT benefits: identifies real-world interface problems (1), reduces training curve (1), ensures functional alignment (1), gathers genuine feedback from non-technical end-users (1). (e) [2 marks] Award 1 mark per valid reason up to 2: visual representation for feedback, cost-saving detection of flaws, or verifying feasibility.
Question 2 · Structured
15 marks
A manufacturing company uses a local area network (LAN) to connect its administrative computers and factory-floor automated machinery. (a) Define the term 'packet switching'. [2] (b) Explain how the TCP/IP protocol suite ensures reliable delivery of data packets across a network. [4] (c) The company is considering replacing physical cables with a wireless network (WLAN) on the factory floor. (i) Explain two physical or environmental factors on a factory floor that could negatively affect a wireless signal. [4] (ii) Identify and explain one security risk associated with wireless networks compared to wired networks, and state a protocol used to mitigate this risk. [3] (d) Outline the function of a router in a network. [2]
Show answer & marking scheme

Worked solution

(a) Packet switching is a networking method where data is split into packets that are routed independently across optimal paths and then reassembled at the destination. (b) TCP divides data into packets with sequence numbers, performs a handshake to establish a connection, and requires the receiver to send an acknowledgment (ACK). Missing packets trigger a timeout and retransmission. IP handles routing. (c) (i) Factor 1: Metal structures causing signal absorption or reflection. Factor 2: Electromagnetic interference (EMI) from heavy electric motors. (ii) Risk: Interception of data because wireless signals travel through open space. Mitigation: Use WPA3 encryption. (d) A router forwards data packets between different networks by reading destination IP addresses and selecting the best path.

Marking scheme

(a) [2 marks] Award 1 mark for breaking data into packets, 1 mark for independent routing/reassembly. (b) [4 marks] Award 1 mark for sequence numbers, 1 mark for handshake/connection, 1 mark for receiver acknowledgments (ACK), 1 mark for timeout and retransmission of lost packets. (c)(i) [4 marks] Award 2 marks per factor: 1 mark for identifying factor, 1 mark for explanation. (c)(ii) [3 marks] Award 1 mark for security risk (interception), 1 mark for explanation, 1 mark for naming protocol (WPA2/WPA3). (d) [2 marks] Award 1 mark for connecting networks, 1 mark for routing decisions using routing tables/IP addresses.
Question 3 · Structured
15 marks
A climate research station records hourly temperature readings for a month, stored in a 1D array named TEMPS containing 720 real numbers. (a) Construct a pseudocode algorithm that reads the elements of TEMPS and outputs: the starting index of the longest continuous sequence of below-freezing temperatures (less than 0.0), and the length of this sequence (in hours). If multiple sequences have the same maximum length, return the first one. [8] (b) Explain the benefit of modularity when developing complex algorithms. [3] (c) State the average-case and worst-case time complexity, in Big O notation, for a linear search on an array of size N, and justify your answer for the worst-case. [4]
Show answer & marking scheme

Worked solution

(a) Algorithm: MAX_LEN = 0; CUR_LEN = 0; MAX_START = -1; loop I from 0 to 719; if TEMPS[I] < 0.0 then; if CUR_LEN == 0 then CUR_START = I; end if; CUR_LEN = CUR_LEN + 1; if CUR_LEN > MAX_LEN then MAX_LEN = CUR_LEN; MAX_START = CUR_START; end if; else; CUR_LEN = 0; end if; end loop; output 'Length: ', MAX_LEN; output 'Index: ', MAX_START. (b) Modularity breaks code into independent, manageable modules, enhancing readability, allowing team development, simplifying debugging, and facilitating code reuse. (c) Average-case: O(N). Worst-case: O(N). Justification: If the element is at the very end or not in the array, all N elements must be searched, which scales linearly with size.

Marking scheme

(a) [8 marks] Award marks as follows: - Initialize tracking variables (1 mark); - Loop through all 720 elements (1 mark); - Correct condition check for below freezing (1 mark); - Set start index of current sequence correctly (1 mark); - Correctly increment current sequence length (1 mark); - Compare current length with max length and update values only if strictly greater (2 marks); - Reset current length to 0 on non-freezing temperature (1 mark). (b) [3 marks] Award 1 mark per benefit up to 3: modular isolation simplifies testing, reusable parts save time, team division of work, clearer design logic. (c) [4 marks] Award 1 mark for average case O(N), 1 mark for worst case O(N), and 2 marks for explaining that worst-case requires looking at all N elements.
Question 4 · Structured
15 marks
A ticketing queue system for a popular concert is represented using a circular queue of fixed size 10, implemented via a static array named TICKETS. Pointers head and tail track indices, and count tracks the number of elements. (a) Explain the difference between a static queue and a dynamic queue, outlining one advantage of each. [4] (b) Construct a pseudocode algorithm for the enqueue(ticketID) operation in this circular queue. Your algorithm must check for overflow conditions. [6] (c) Describe how a binary search tree (BST) differs from a queue in terms of data organization, and identify one scenario where a BST would be more efficient than a queue. [5]
Show answer & marking scheme

Worked solution

(a) A static queue has a fixed size allocated at compile time. A dynamic queue grows and shrinks at runtime using pointers. Advantage of static: lower memory overhead and execution speed. Advantage of dynamic: prevents overflow errors and manages memory efficiently. (b) Pseudocode: method enqueue(ticketID); if count == 10 then; output 'Overflow'; else; if count == 0 then; head = 0; tail = 0; else; tail = (tail + 1) mod 10; end if; TICKETS[tail] = ticketID; count = count + 1; end if; end method. (c) A queue is linear, sequential, and follows First-In-First-Out (FIFO). A BST is a hierarchical, sorted tree structure. Searching in a queue takes O(N) as elements must be scanned linearly. Searching in a BST takes average O(log N) because half the branches are pruned at each step.

Marking scheme

(a) [4 marks] Award 1 mark for static/dynamic difference, 1 mark for static advantage, 1 mark for dynamic advantage, 1 mark for clear elaboration. (b) [6 marks] Award 1 mark for checking overflow (count == 10), 1 mark for handling initial empty queue (count == 0), 2 marks for modulo calculation of tail, 1 mark for writing element to array, 1 mark for incrementing count. (c) [5 marks] Award 1 mark for queue linear/FIFO explanation, 1 mark for BST hierarchical/sorted explanation, 1 mark for identifying search scenario, 2 marks for comparing search complexities (O(N) vs O(log N)).
Question 5 · Structured
15 marks
An automated greenhouse irrigation system regulates soil moisture levels. It uses a microprocessor, soil moisture sensors, and a water pump valve actuator. (a) Describe the role of a sensor and an actuator in this control system. [4] (b) Distinguish between an open-loop system and a closed-loop feedback control system in this context, explaining why a closed-loop system is more suitable here. [4] (c) Outline the steps of the feedback loop processed by the microprocessor to maintain the soil moisture at a target level of 60%. [4] (d) State three social or environmental ethical considerations when designing automated agricultural control systems. [3]
Show answer & marking scheme

Worked solution

(a) Sensor: measures physical soil moisture levels and sends this raw data as an input signal to the microprocessor. Actuator: takes output control signals from the microprocessor and performs physical work (opening or closing the water pump valve). (b) Open-loop system operates on a preset schedule (e.g. watering 10 minutes daily) without checking soil conditions. Closed-loop system continually measures soil moisture and uses it as feedback to decide whether to water. Closed-loop is superior because it conserves water and prevents plant damage. (c) Microprocessor steps: 1. Read input signal from the sensor. 2. Compare reading to target of 60%. 3. If reading is under 60%, activate the water pump actuator. 4. If reading is 60% or higher, deactivate/keep off the pump. 5. Wait/delay and repeat. (d) Considerations: water conservation/sustainability, potential job losses for manual farmworkers, and reliability (e.g., system failure causing crop death).

Marking scheme

(a) [4 marks] Award 2 marks for sensor (1 mark for measuring physical environment, 1 mark for sending input signal). Award 2 marks for actuator (1 mark for receiving signal, 1 mark for executing mechanical action). (b) [4 marks] Award 1 mark for open-loop description, 1 mark for closed-loop feedback description, 2 marks for explaining why closed-loop is superior (avoids overwatering/underwatering based on external weather). (c) [4 marks] Award 1 mark for each step up to 4: reads sensor data, compares with 60% threshold, outputs control decision to actuator, and implements loop delay before repeating. (d) [3 marks] Award 1 mark for each valid point up to 3: environmental impact of water use, social impact on manual jobs, safety/dependability of system logic.

Paper 3

Answer all questions based on the Case Study.
4 Question · 30 marks
Question 1 · Case Study Structured / Essay
7.5 marks
Explain how a hybrid recommender system, combining content-based filtering and collaborative filtering, can mitigate the "cold-start" problem for new farmers registering on the AgroPredict platform.
Show answer & marking scheme

Worked solution

A hybrid recommender system effectively resolves the cold-start problem which occurs when a new farmer joins with zero historical data. In collaborative filtering, recommendations depend on matching the target user's historical ratings with similar users. Without historical data, this is impossible. Content-based filtering solves this initial stage by prompting the new user for static data during registration, such as regional zip code, average soil pH, and climate zone. The system matches these attributes to crop requirements to generate baseline recommendations. As the farmer inputs real performance data over subsequent seasons, collaborative filtering algorithms (such as K-Nearest Neighbors or Matrix Factorization) gradually take over, blending the two recommendation scores. This hybrid approach ensures the user receives relevant, localized suggestions from day one while benefiting from community-driven collaborative insights over time.

Marking scheme

Maximum 7.5 marks total. Award up to 2 marks for a clear definition of the cold-start problem in the context of agricultural recommender systems (lack of historical crop yield or rating data for new users). Award up to 2 marks for explaining how content-based filtering operates using static registration metadata (climate, soil attributes, regional profile). Award up to 2 marks for demonstrating how the hybrid model integrates both approaches (e.g., weighted combination, switching mechanism). Award up to 1.5 marks for describing the transition dynamic (increasing collaborative weight as user interaction data accumulates over agricultural seasons).
Question 2 · Case Study Structured / Essay
7.5 marks
The AgroPredict platform represents farmer crop ratings using a matrix. Due to the vast number of possible crops and the small number of crops actually planted by individual farmers, this matrix is extremely sparse. Evaluate the use of Matrix Factorization (such as Singular Value Decomposition - SVD) to resolve this sparsity issue, highlighting its technical trade-offs.
Show answer & marking scheme

Worked solution

Matrix Factorization, such as SVD, handles sparsity by projecting both farmers and crops into a shared latent factor space of dimension \(k\). The original sparse rating matrix \(R\) is approximated by the product of two dense matrices: \(U\) (farmer-latent factors) and \(V^T\) (crop-latent factors), such that \(R \approx U \times V^T\). This allows the system to predict a missing value by calculating the dot product of a farmer's latent vector and a crop's latent vector. Evaluation: (1) Advantages: It effectively uncovers hidden patterns (e.g., complex interactions between soil tolerance and climate) that are not explicitly labeled, and it scales better than pure neighborhood-based methods as sparsity increases. (2) Disadvantages: High computational cost to retrain the latent factor matrices when new data is added, meaning real-time updates are difficult. Additionally, the latent factors are mathematical abstractions, making the resulting recommendations a "black box" which reduces explainability for farmers who want to know why a crop was recommended.

Marking scheme

Maximum 7.5 marks total. Award up to 2 marks for explaining the mechanism of Matrix Factorization (decomposition into lower-dimensional latent factor matrices representing farmers and crops). Award up to 2 marks for explaining how SVD resolves the sparsity issue (by mathematically reconstructing missing entries using the dot product of latent vectors). Award up to 2 marks for identifying technical limitations/trade-offs (high computational retraining cost, lack of real-time update capability, and lack of model explainability/transparency). Award up to 1.5 marks for structured synthesis and critical evaluation of its suitability for agricultural recommendations.
Question 3 · Case Study Structured / Essay
7.5 marks
Discuss the ethical implications and potential feedback loops (filter bubbles) that could occur if small-scale farmers rely solely on AgroPredict's automated crop recommendations over multiple seasons.
Show answer & marking scheme

Worked solution

A major ethical and systemic risk of automated recommender systems in agriculture is the feedback loop, analogous to the digital "filter bubble." If the recommender system identifies that Crop A produces high yields in Region X, it will recommend Crop A to all nearby farmers. As more farmers plant Crop A, the algorithm receives more positive feedback data, further reinforcing its recommendation. Over several seasons, this leads to: (1) Ecological Degradation: Continuous farming of a single crop (monoculture) depletes specific soil nutrients, ruins local biodiversity, and increases vulnerability to devastating pest outbreaks. (2) Market Saturation: Simultaneous overproduction of a single crop by all regional farmers drives down market prices, resulting in economic hardship. (3) Loss of Indigenous Knowledge: Farmers may lose traditional crop rotation expertise and rely completely on a black-box proprietary algorithm, leading to technological dependency. Mitigations include incorporating exploration metrics (serendipity) in the loss function to intentionally recommend diverse, non-optimal but ecologically beneficial crop rotations.

Marking scheme

Maximum 7.5 marks total. Award up to 2 marks for explaining the feedback loop mechanism in agricultural recommendations (positive reinforcement of dominant suggestions). Award up to 2 marks for analyzing ecological consequences (monoculture development, rapid soil nutrient depletion, pest vulnerability). Award up to 2 marks for explaining socioeconomic/ethical issues (market over-saturation, price depreciation, and tech dependency/loss of traditional local knowledge). Award up to 1.5 marks for proposing balanced algorithmic mitigations (e.g., adding serendipity/diversity constraints, forcing crop rotation logic into the recommendation engine).
Question 4 · Case Study Structured / Essay
7.5 marks
AgroPredict wants to incorporate real-time IoT soil sensor data (moisture, temperature, NPK levels) to adjust recommendations dynamically. Discuss the technical challenges of choosing between an edge-computing architecture (processing data locally on the farm gateway) versus a centralized cloud-computing architecture for running these recommendation updates.
Show answer & marking scheme

Worked solution

Integrating real-time IoT soil data presents a structural architectural choice: (1) Edge-Computing Architecture: Sensor data is processed locally on a farm gateway device. Pros: Immediate latency-free inference, works completely offline which is critical for rural areas with poor connectivity, and localized data privacy is maintained. Cons: Gateways have limited computational resources (CPU, RAM, storage), meaning they cannot run heavy deep-learning model training locally; they can only perform lightweight model inference. (2) Centralized Cloud-Computing Architecture: Data is transmitted via cellular/satellite networks to centralized servers. Pros: Massive computational scale, allows continuous retraining of the recommendation model using data aggregated from thousands of farms, and facilitates global trend analysis. Cons: Highly dependent on continuous network connectivity; if connection fails, real-time alerts or recommendations cannot be computed. High data transmission costs. A hybrid approach (fog computing) is often optimal, where the edge performs immediate anomaly detection/inference while the cloud handles periodic model updates.

Marking scheme

Maximum 7.5 marks total. Award up to 2 marks for analyzing the edge-computing option (highlighting benefits of offline execution, low latency, and constraints of local hardware power). Award up to 2 marks for analyzing the centralized cloud-computing option (highlighting benefits of massive scale, global data aggregation, and constraints of rural connectivity/bandwidth). Award up to 2 marks for comparing how each choice impacts dynamic recommender models specifically (local lightweight inference vs heavy centralized retraining). Award up to 1.5 marks for proposing and justifying a sensible hybrid/compromise architecture (e.g., Edge for inference, Cloud for training).

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.

Want more questions like this? Practice unlimited on Thinka — instant answers included.

Start Practising Free