International Baccalaureate

IB Computer Science HL: questions by topic

506 questions32 papers2019-2026Updated

“The mark schemes being right there saved me so much arguing with myself.”

Hana K.IB DP Year 2, Japan
Sort questions

You’re practising 2019–2020 papers. The 2021–2026 papers, including 2026, need a plan.

Unlock from $6/mo
24 free questions

2020 NovemberPaper 1Question 1Component P1TZ03 marks
Topic 2: Computer organization (earlier syllabus)2.1 Computer organization (earlier syllabus)1.1 Systems in organizations (earlier syllabus)
Loading original question

1. (a) Outline one feature of a word processor that could reduce the amount of typing required when writing letters. [2] (b) State the purpose of technical documentation provided with software. [1]

2020 NovemberPaper 1Question 2Component P1TZ02 marks
B4 Abstract data types (HL only)B4.1 Fundamentals of ADTs
Loading original question

2. Consider the following binary tree. A B C D (a) State the result of inorder traversal of this binary tree. [1] (b) State the result of preorder traversal of this binary tree. [1]

2020 NovemberPaper 1Question 3Component P1TZ03 marks
A1 Computer fundamentalsA1.3 Operating systems and control systems
Loading original question

3. Describe how an operating system uses paging when running a program. [3]

2020 NovemberPaper 1Question 4Component P1TZ04 marks
Topic 1: System fundamentals (earlier syllabus)1.1 Systems in organizations (earlier syllabus)
Loading original question

4. Compare direct changeover with parallel running as a method of implementation. [4]

2020 NovemberPaper 1Question 5Component P1TZ02 marks
Topic 7: Control (earlier syllabus)7.1 Control (earlier syllabus)
Loading original question

5. Outline one feature of autonomous agents. [2]

2020 NovemberPaper 1Question 6Component P1TZ03 marks
A1 Computer fundamentalsA1.1 Computer hardware and operation
Loading original question

6. The machine instruction cycle is a sequence of actions that a central processing unit (CPU) performs to execute each machine code instruction in a program. (a) State the part of the central processing unit (CPU) that performs the decoding. [1] (b) Outline the function of the memory address register (MAR). [2]

2020 NovemberPaper 1Question 7Component P1TZ04 marks
B2 ProgrammingB2.4 Programming algorithms
Loading original question

7. Describe the steps involved in using the bubble sort algorithm to sort an array. [4]

2020 NovemberPaper 1Question 8Component P1TZ04 marks
A1 Computer fundamentalsA1.2 Data representation and computer logic
Loading original question

8. Construct a truth table for the following logical expression. [4] (A xor B) and not C

2020 NovemberPaper 1Question 9Component P1TZ015 marks
Topic 3: Networks (earlier syllabus)3.1 Networks (earlier syllabus)A2.1 Network fundamentalsB2.3 Programming constructs
Loading original question

9. A school has a local area network (LAN) connecting its computers and peripheral devices. The LAN also provides access to the internet. (a) Describe the role of a router in this network. [3] Users have been troubled by slow speeds when accessing the internet. (b) Outline two reasons why there might be a reduction in data transmission speed at certain times. [4] (c) Outline two measures that the school could take to safeguard its data from unlawful access via the internet. [4] The inventory of office supplies used in the school is stored on the computer as a single file. Each of the office supplies in the inventory (such as paper, ink, toner, printers, pens, staplers, pencils and scissors) has a unique ID number, name, maximum quantity, minimum quantity and remaining quantity. (d) Outline the steps in an algorithm that would output a list of supplies with the quantity to be ordered. [4]

2020 NovemberPaper 1Question 10Component P1TZ015 marks
Topic 1: System fundamentals (earlier syllabus)1.2 System design basics (earlier syllabus)A1.3 Operating systems and control systems
Loading original question

10. Website developers need to consider a range of usability factors when designing a website. (a) Identify two usability factors that need to be considered in the design of a website. [2] (b) Outline one reason why visual displays on a computer screen can create difficulties for some people. [2] A company promotes its products online. To make a purchase, customers are required to register with the company and provide data like their name, date of birth, age, gender and email address. Once registered, more than one customer is able to access the server to retrieve and modify their data at the same time. (c) (i) State where the customer data is held during the process of modifying their data. [1] (ii) Explain how the operating system ensures that each customer’s data is secure when multiple users are accessing the data at the same time. [4] The company is considering sharing its customers’ data with marketing organizations. (d) Explain why there could be ethical issues for the company when sharing its customers’ data. [6]

2020 NovemberPaper 1Question 11Component P1TZ015 marks
A1 Computer fundamentalsA1.3 Operating systems and control systems7.1 Control (earlier syllabus)
Loading original question

11. A company produces and sells domestic floor-cleaning robots. The floor-cleaning robots can clean different surfaces like wood and carpet. The floor‑cleaning robots can also avoid obstacles or stairs. Sensors are used by the processor that controls the floor-cleaning robot so that it can move safely. (a) Describe two types of sensors used in the floor-cleaning robots. [4] (b) Explain the function of an output transducer in this situation. [3] A computerized security system for the company’s headquarters protects against unauthorized access using a swipe-card system. Each door has a swipe-card reader that is connected to the central computer. A database stores the IDs of all employees and the rooms they are allowed to access. (c) (i) Identify one alternative computerized method that could be used in place of the swipe-card readers. [1] (ii) Describe how the method identified in (c)(i) functions. [3] (d) Compare polling and interrupts as mechanisms for the swipe-card readers to interact with the central computer. [4]

2020 NovemberPaper 1Question 12Component P1TZ015 marks
B2 ProgrammingB2.2 Data structuresB2.3 Programming constructsB2.4 Programming algorithms
Loading original question

12. (a) Describe one difference between stack and queue data structures. [2] (b) State the purpose of the following queue methods: (i) enqueue() [1] (ii) dequeue() [1] (iii) isEmpty() [1] Assume that the queue Q holds the following data: 4 2 6 1 3 5 front rear The reversed queue Q would be: 5 3 1 6 2 4 front rear (c) Construct an algorithm in pseudocode for reversing the queue using a stack data structure. You may assume that the data in the queue is input and a new empty stack is created. Only the standard queue and stack operations are allowed. [5] Consider the following recursive method: mystery(N) if N > 0 then return 3 + mystery(N-3) else return 3 end if end mystery where N is an integer. (d) Determine the value of mystery(7) . Show all your working. [3] (e) Outline one disadvantage of solving problems recursively. [2]

2020 NovemberPaper 1Question 13Component P1TZ015 marks
B2 ProgrammingB2.2 Data structuresB2.4 Programming algorithms
Loading original question

13. Images in computers are stored as two-dimensional arrays. A black-and-white image ( Figure 1 ) is stored as a 10 × 10 two-dimensional array named MAT ( Figure 2 ). Each element of MAT holds a number for a colour; 1 represents the colour black and 0 represents the colour white. Figure 1: The simple black-and-white image Figure 2: The corresponding two-dimensional array MAT [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [0] 0 0 0 0 0 0 0 1 0 0 [1] 0 0 0 1 0 0 0 0 1 0 [2] 0 0 0 1 0 0 0 0 0 1 [3] 0 0 0 1 0 0 0 0 0 0 [4] 0 0 0 1 0 0 0 0 0 0 [5] 0 0 0 1 0 0 0 0 0 0 [6] 0 0 0 1 0 0 0 0 0 0 [7] 0 0 0 1 0 0 0 0 0 0 [8] 0 0 0 1 1 1 1 1 0 0 [9] 0 0 0 0 0 0 0 0 0 0 In an application, the black-and-white image can be inverted (all white pixels are changed to black, and all black pixels are changed to white). Method invert(N,A) accepts a positive integer N and an N × N two-dimensional array A that holds the data for a simple black-and-white image; it returns the inverted N × N two-dimensional array A . (a) Construct an algorithm in pseudocode for the method invert(N,A) . [3] In the application, it is also possible to rotate an image clockwise by 90 degrees (90°). For example, when the simple black-and-white image is rotated, the corresponding 10 × 10 two-dimensional array MAT is updated. This would mean the first row of the original MAT is the last column in the rotated MAT, the second row is the second-to-last last column, … and the last row is the first column. Figure 3: The simple black-and-white image Figure 4: The corresponding two-dimensional rotated by 90° (clockwise) array MAT [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [0] 0 0 0 0 0 0 0 0 0 0 [1] 0 0 0 0 0 0 0 0 0 0 [2] 0 0 0 0 0 0 0 0 0 0 [3] 0 1 1 1 1 1 1 1 1 0 [4] 0 1 0 0 0 0 0 0 0 0 [5] 0 1 0 0 0 0 0 0 0 0 [6] 0 1 0 0 0 0 0 0 0 0 [7] 0 1 0 0 0 0 0 0 0 1 [8] 0 0 0 0 0 0 0 0 1 0 [9] 0 0 0 0 0 0 0 1 0 0 Consider the following algorithm fragment: K = input() loop for M = 0 to K mod 4 - 1 A = rotate(N,A) end loop where: y N is an integer and A is the N × N two-dimensional array that holds data about an image y K(K>=0) is an integer showing how many times the image should be rotated y method rotate(N,A) accepts an integer N and an N × N two-dimensional array A representing an image. It returns an N × N two-dimensional array representing the image rotated clockwise by 90°. (b) (i) State the number of degrees by which the image will be rotated if the input value of K is 3. [1] (ii) Outline why it is more efficient that the loop in the given algorithm fragment executes (K mod 4) times instead of K times. You may give an appropriate example in your answer. [2] The algorithm for method rotate(N,A) uses an additional N × N two-dimensional array, named B . The N × N dimensional array B is initialized and updated using the values from A to represent the image rotated clockwise by 90°. (c) Construct the algorithm in pseudocode for the method rotate(N,A) described above. [3] To avoid inefficient use of memory, a new algorithm for the method rotate(N,A) is constructed. The N × N two-dimensional array A should be rotated clockwise by 90°, without the use of any additional arrays. One way of rotating the two-dimensional array A clockwise by 90° is to transpose A , and then reverse each row of A . The transpose of A is formed by turning all the rows of A into columns. For example, the value in the first row and third column ( A[1][3] ) is swapped with the value in the third row and first column ( A[3][1] ). (d) Construct the new algorithm in pseudocode for the method rotate(N,A) described above. [6]

2020 NovemberPaper 2Question 1Component P2 Option ATZ019 marks
A3 DatabasesA3.2 Database designA.3 Further aspects of database management (earlier syllabus)
Loading original question

1. The Driving Licensing Agency stores information about individuals who hold a driving license and/or own vehicles. The following rules apply: y Each individual may only hold one driving license. y Each individual may own more than one vehicle. y Each vehicle may be owned by one individual only. (a) Construct the entity-relationship diagram (ERD) that shows the relationship between the individual, their driving license, and their vehicle(s). [2] When an individual applies for a driving license, they have to complete a license application form. The following is an extract from that form: Figure 1: Extract from driving license application form Surname First name(s) Mr Mrs Miss Ms Other title Male Female Day Month Year Date of birth (b) Explain why Date of birth has been separated into three fields. [3] The data in the form shown above is stored in the Person table. The license application form also requires an individual’s medical information. This is stored in a table called PersonMedical . The following extract is a sample of the medical questions that are asked. Figure 2: A sample of the medical questions asked on the license application form Have you ever had any of the No Yes following conditions? If you have answered “Yes”, please tick all the appropriates boxes. Epilepsy Fits or blackouts Repeated attacks of sudden disabling giddiness Diabetes controlled by insulin (c) Explain two reasons why medical information should not be stored in the Person table. [6] (d) Outline two issues caused by storing redundant data. [4] (e) Outline two situations where data stored by the Driving Licensing Agency may need to be open to interrogation by other parties. [4]

2020 NovemberPaper 2Question 2Component P2 Option ATZ010 marks
Option A: Databases (earlier syllabus)A.1 Basic concepts (earlier syllabus)A3.3 Database programming
Loading original question

2. Billetmania is an online company that sells tickets for theatre performances and music concerts. After a customer has chosen their seats, they can pay for the tickets through a secure online payment system. Once the transaction has been completed, the customer receives an email receipt. (a) Define the term database transaction . [1] An information system and a database are used for Billetmania ’s day-to-day operations. (b) Outline how the Billetmania information system would utilize a database. [2] (c) Explain the importance of transaction durability to Billetmania when clients book tickets. [3] (d) Explain how the Billetmania database management system ensures that a seat is not booked by two people simultaneously. [4]

2020 NovemberPaper 2Question 3Component P2 Option ATZ016 marks
A3 DatabasesA3.2 Database designA.2 The relational database model (earlier syllabus)A3.1 Database fundamentals
Loading original question

3. WineForAll is a retailer that sells wine in its stores. Each store sells wine from a number of vineyards. The following extract from the Wine file contains unnormalized data. NameOfWine Vineyard Description UnitPrice Region StoreID StockQty 2015, Dry, Chardonnay Stormy Bay $19.99 Gisborne 1 45 13 % Sauvignon 2017, Dry, Stormy Bay $29.99 Gisborne 2 20 Blanc 12 % Sauvignon 2017, Dry, Stormy Bay $29.99 Gisborne 1 45 Blanc 12 % 2016, Brut, Pelorus Stormy Bay $34.99 Gisborne 1 10 14 % Pecan 2016, Fruity, Pinot Noir $29.99 Gisborne 3 32 Block 14 % Sauvignon Pecan 2017, $29.99 Gisborne 4 25 Blanc Block Dry,13 % 2013, Fruity, Shiraz James Tree $25.99 Hawkes Bay 3 15 13.5 % 2013, Fruity, Shiraz James Tree $25.99 Hawkes Bay 2 40 13.5 % 2014, Fruity, Merlot James Tree $29.99 Hawkes Bay 1 25 14 % Sauvignon 2016, Dry, John Glad $19.99 Gladstone 4 30 Blanc 12.5 % 2017, Dry, Chardonnay John Glad $15.99 Gladstone 2 28 13.5 % (a) Define the term record . [1] (b) Identify the steps to create a query to find the vineyards and names of fruity wines where the quantity in stock is between 25 and 35 bottles. [3] (c) (i) Identify the steps to create a non-persistent derived field called TotalPrice , which would hold the total value of wine stored for each record. [2] (ii) Outline why the inclusion of a derived field will not affect the normalization of a database. [2] (d) Construct the 3rd Normal Form (3NF) of the unnormalized Wine file. [6] (e) Outline why a single-field primary key is not always an appropriate solution for normalized databases. [2]

2020 NovemberPaper 2Question 4Component P2 Option ATZ020 marks
A3 DatabasesA3.4 Alternative databases and data warehousesA.4 Further database models and database analysis (earlier syllabus)A4.3 Machine learning approaches
Loading original question

4. The Criminal Information Support System (CISS) project is being developed to provide the Puerto Rico Police (PRP) with countrywide access to a centralized data warehouse. The data warehouse will be created from the databases of several police departments. (a) Identify two differences between a data warehouse and a database. [2] (b) Outline two advantages that the PRP will gain from using a data warehouse. [4] (c) Describe how data in the CISS data warehouse could be updated in real time from the police department databases. [4] Data mining techniques are being used with the new PRP data warehouse to assist the detection of patterns in crime data. Pattern detection approaches include cluster analysis and classifications. (d) Compare cluster analysis and classifications as pattern detection techniques. [5] (e) Explain how link analysis could be used to detect patterns in crime data. [5]

2020 NovemberPaper 2Question 5Component P2 Option BTZ018 marks
Option B: Modelling and simulation (earlier syllabus)B.2 Simulations (earlier syllabus)B.1 The basic model (earlier syllabus)B2.1 Programming fundamentalsB2.3 Programming constructs
Loading original question

5. EnviroBuild is a construction company that recently purchased land. It has permission to build either small houses or large houses but not both types of house. The maximum number of small houses that can be built is 10. The maximum number of large houses that can be built is five. The cost of building the houses is calculated using a model with the following three variables: House_Type : The type of house (small or large). House_Num : The number of houses to be built. Profit : The total sales revenue minus the land costs, labour costs and material costs. (a) Identify the data types for the House_Type , House_Num and Profit variables. [3] The decision whether to build small houses or large houses is a purely financial one and is based on the following information: y A single payment of $500 000 for the land, regardless of whether 10 small houses or five large houses are to be built. y The revenue from each house sale will be $220 000 for a small house and $400 000 for a large house. y The labour costs will be $2500 per day, regardless of the type of house built. y It will take 17 days to build each small house and 23 days to build each large house. Houses are built sequentially so that they can be sold as soon as they are completed. y The material costs will be $100 000 for each small house and $190 000 for each large house. (b) Construct a spreadsheet model that shows the total profit for the chosen type of house. The user must input the House_Type and House_Num to calculate the total profit. [6] (c) Outline two validation tests that should be included in the test plan for this spreadsheet model. [4] To finance this project, EnviroBuild took out a bank loan of $400 000 and will be required to pay interest on this loan. The project starts on 1 January 2021. The following steps are used to calculate the total profit: y Read the Profit variable and the No_of_Days variable from the spreadsheet model in (b). y Calculate the number of months that the project will take. ◦ There are no partial months. ◦ For example, if a project finished on 1 July 2021, the loan interest rates will include July: the project will last for 7 months. y The rate of interest on the bank loan of $400 000 is 1 % per month. y The land tax is $500 per month. (d) Construct the pseudocode that will calculate the profit after these additional costs have been considered. You can introduce any new variables, if necessary. [5]

2020 NovemberPaper 2Question 6Component P2 Option BTZ014 marks
A4 Machine learningA4.4 Ethical considerationsB.2 Simulations (earlier syllabus)B1.1 Approaches to computational thinking
Loading original question

6. Global warming is a term used to describe the increase in mean global temperatures. There have been numerous computer simulations developed to predict the effects of global warming. One simulation is NASA’s Virtual Earth System Laboratory (VESL), which allows users to see how climate change affects glacier size, global sea level and changes to the coastline. The VESL runs simulations in real time and is an abstraction of reality. (a) (i) Outline what is meant by a real-time simulation in the context of a glacier size simulation. [2] (ii) Outline what is meant by the statement “the VESL simulation is an abstraction of reality”. [2] A recent study reported that previous simulations of predicted global sea levels for 2100 were highly inaccurate. (b) Outline two reasons why predictions of global sea levels from simulations may not be accurate. [4] (c) NASA has decided to make its simulation software available for other scientists as well as members of the public. Evaluate the social and ethical implications of this decision. [6]

2020 NovemberPaper 2Question 7Component P2 Option BTZ013 marks
Option B: Modelling and simulation (earlier syllabus)B.3 Visualization (earlier syllabus)
Loading original question

7. Simulation software can be used to produce a 3D visualization of rising sea levels that change as the user alters the percentage of ice that has melted. Figure 3: 3D visualization of rising sea levels (a) (i) Define the term visualization . [1] (ii) Identify how a 2D visualization could be used in this scenario. [1] (b) Explain the benefits of using visualization when simulating rising sea levels. [5] Once the 3D visualization has been rendered, when the user drags a slider bar to simulate the amount of ice that has melted, the visualization is re-rendered without any delay. Figure 4: Slider bar to simulate different percentages of sea ice Remove Ice 10 % (c) Describe how this 3D visualization is rendered. [6]

Revision method

How to use the Computer Science HL question bank

Practise 506 authentic past-paper questions from 32 archived papers (2019-2026). These are past-paper questions, not AI-generated exam-style substitutes. Start with a topic, then switch to mixed or timed practice.

  1. Choose a topic. Focus your practice on a real past-paper topic rather than a generated exam-style substitute.
  2. Work through the available questions and answers. Use the matching mark scheme to check your reasoning and identify a precise gap.
  3. Export when eligible. Guests can view up to 20 matching free questions; a free account can access the remaining free selection. PDF export is subject to eligible bank access and the account’s download allowance.

Computer Science HL: quick facts

How many questions are in the IB Computer Science HL question bank?

The IB Computer Science HL question bank has 506 past-paper questions from 32 papers, sat 2019-2026, sorted into 17 topics.

Which topics come up most in IB Computer Science HL?

The most-tagged IB Computer Science HL topics are B2 Programming (130), A1 Computer fundamentals (107) and Option C: Web science (earlier syllabus) (62), out of 506 questions. These are archive counts, not a prediction, and a question can carry more than one topic.

Is the IB Computer Science HL question bank free?

Partly. IB Computer Science HL questions from 2019–2020 are free with a free account. Questions from other years and PDF worksheets need a plan, from $6 a month.

Do the IB Computer Science HL questions have answers?

Yes. Each IB Computer Science HL question shows the official mark scheme answer. Many also have a step-by-step worked explanation written by PastPaperPrep.