Sciences
IB Computer Science SL and HL
94 lessons at SL. 152 at HL, with every HL-only topic. Five-minute lessons, exam-style questions and timed mock papers.
- Units
- 8
- SL lessons
- 94
- HL lessons
- 152
- Questions
- 639
- Key terms
- 105
- Formulas
- 15
What you will study
Every lesson follows the current IB guide. Lessons marked HL are in the HL course only. The first unit is free.
A1 Computer fundamentals18 SL · 22 HL lessons · free
- A1.1The CPU and memory
- A1.1Buses and processor types
- A1.1CPU or GPU?
- A1.1The memory hierarchy
- A1.1Storage, compression and the cloud
- A1.1Choosing secondary storage
- A1.1Run-length encoding
- A1.1Transform coding
- A1.1Pipelines in multi-core processorsHL
- A1.2Binary and hexadecimal
- A1.2Converting to binary and hex
- A1.2Storing sound and video
- A1.2Logic gates
- A1.2Simplifying with Boolean algebra
- A1.2Karnaugh maps
- A1.2Building logic diagrams
- A1.3Operating systems and control systems
- A1.3Scheduling algorithms
- A1.3Polling and interrupts
- A1.3Multitasking and deadlockHL
- A1.3Control systems in the real worldHL
- A1.4Translators and pipeliningHL
A2 Networks13 SL · 17 HL lessons
- A2.1Network types and models
- A2.1Network hardware
- A2.1What servers do
- A2.1Encapsulation and ports
- A2.1Application-layer protocols
- A2.2Network topologies
- A2.2Subnets and VLANsHL
- A2.3Data transmission
- A2.3IPv4 and IPv6
- A2.3Private addresses and NAT
- A2.3Static and dynamic routingHL
- A2.4Network security
- A2.4How firewalls decide
- A2.4Intrusion detection and prevention
- A2.4Securing a wireless network
- A2.4Digital certificates and TLSHL
- A2.4Hashing and digital signaturesHL
A3 Databases15 SL · 20 HL lessons
- A3.1Relational databases
- A3.1Limits of relational databases
- A3.1Database design and normalisation
- A3.1ERDs: cardinality and modality
- A3.1Building tables with constraints
- A3.1Normalising to 1NF
- A3.1From 1NF to 2NF
- A3.1From 2NF to 3NF
- A3.1Denormalisation
- A3.2Querying with SQL
- A3.2DDL and DML
- A3.2Queries across two tables
- A3.2GROUP BY and HAVING
- A3.2Virtual and materialised views
- A3.2COMMIT and ROLLBACK
- A3.3Beyond relational: NoSQL and data warehousesHL
- A3.3Features of a data warehouseHL
- A3.3OLAP operationsHL
- A3.3Data mining techniquesHL
- A3.3Fragmentation and replicationHL
A4 Machine learning6 SL · 20 HL lessons
- A4.1What is machine learning?
- A4.1Kinds of machine learning
- A4.1Transfer learning
- A4.1Hardware for machine learning
- A4.2Preparing dataHL
- A4.2Missing values and outliersHL
- A4.2Feature selection methodsHL
- A4.2Dimensionality reductionHL
- A4.3Linear regressionHL
- A4.3k-nearest neighbours in detailHL
- A4.3Decision treesHL
- A4.3Precision, recall and F1HL
- A4.3Hyperparameter tuningHL
- A4.3k-means clusteringHL
- A4.3Association rulesHL
- A4.3How an agent learns to decideHL
- A4.3Inside an artificial neuronHL
- A4.3Convolutional neural networksHL
- A4.4Ethics of machine learning
- A4.4Ethics of online communication
B1 Computational thinking14 lessons
- B1.1Thinking like a computer scientist
- B1.1Writing a problem statement
- B1.1Inputs, outputs and evaluation criteria
- B1.1Decomposition and structure charts
- B1.1Pattern recognition and generalisation
- B1.1Abstraction in models and code
- B1.1Ways to express an algorithm
- B1.1Computational thinking on a full problem
- B1.1Computational thinking across computer science
- B1.1Flowcharts and trace tables
- B1.1Loops in flowcharts
- B1.1Flowcharts with several decisions
- B1.1From flowchart to code
- B1.1Flowcharts for standard algorithms
B2 Programming20 SL · 23 HL lessons
- B2.1Variables, types and operators
- B2.1Indexing and slicing strings
- B2.1String methods and searching
- B2.1Handling exceptions
- B2.1Debugging techniques
- B2.2Arrays and lists
- B2.2Static and dynamic data structures
- B2.2List operations
- B2.2Row and column totals in 2D arrays
- B2.3Selection and iteration
- B2.3Nested and compound conditions
- B2.3Sentinel and validation loops
- B2.3Nested loops
- B2.3Functions and files
- B2.3Variable scope
- B2.4Searching and sorting
- B2.4Best and worst cases
- B2.4Algorithm efficiency
- B2.4Working out Big O from code
- B2.4RecursionHL
- B2.4Designing recursive functionsHL
- B2.4Recursive binary searchHL
- B2.5Reading and processing a file
B3 Object-oriented programming8 SL · 18 HL lessons
- B3.1Classes and objects
- B3.1Objects as models
- B3.1Advantages and limits of OOP
- B3.1Designing a class with UML
- B3.1Static and instance members
- B3.1Object references
- B3.1Lists of objects
- B3.1Information hiding
- B3.2Inheritance and polymorphismHL
- B3.2Subclass constructorsHL
- B3.2Inheritance hierarchiesHL
- B3.2Overloading and default parametersHL
- B3.2Abstract classes in codeHL
- B3.2InterfacesHL
- B3.2Composition and aggregationHL
- B3.2The singleton patternHL
- B3.2The factory patternHL
- B3.2The observer patternHL
B4 Abstract data types0 SL · 18 HL lessons
- B4.1.1Stacks and queuesHL
- B4.1.1What makes a type abstractHL
- B4.1.2Linked listsHL
- B4.1.2Searching a linked listHL
- B4.1.2Inserting at the head and tailHL
- B4.1.2Deleting nodes safelyHL
- B4.1.2Doubly linked listsHL
- B4.1.2Circular linked listsHL
- B4.1.3Trees, hash tables and setsHL
- B4.1.3Building a binary search treeHL
- B4.1.3Pre-order and post-orderHL
- B4.1.3Deleting from a BSTHL
- B4.1.3Balance and efficiencyHL
- B4.1.4Set operationsHL
- B4.1.4Sets: properties and usesHL
- B4.1.5Hash functionsHL
- B4.1.5Chaining and open addressingHL
- B4.1.5Load factor and resizingHL
Coursework: IB Computer Science IA guide, step by step, with how it is marked and a checklist.
Revising: how to study for IB Computer Science, with the habits and mistakes that matter most.
Formulas: IB Computer Science formula sheet, every formula in the course by unit.
The course, unit by unit
What each unit is about, and the exam habits that save marks in it.
A1 Computer fundamentals
A1 is about what happens inside a computer: the CPU and its registers running the fetch–decode–execute cycle, primary memory and secondary storage, how text, images and sound are stored in binary, the logic gates that process bits and the operating system that manages everything. HL adds compilers and interpreters, pipelining and control systems.
Exam tips
- Describe the fetch–decode–execute cycle step by step and name the register used at each step (PC → MAR, instruction → MDR, PC incremented, CU decodes, execute). “The CPU gets the instruction and runs it” earns very little.
- Show your working in conversions and file-size calculations: write the place values, or pixels × bits per pixel ÷ 8 for bytes, and give the unit. Most lost marks come from mixing up bits and bytes.
A2 Networks
A2 explains how devices communicate: the kinds of network and the hardware that connects them, the layered TCP/IP model and its protocols, how data travels as packets over different media and is checked for errors, and how networks are attacked and defended.
Exam tips
- Name the layer and the protocol together and say what it does: “TCP, at the transport layer, numbers the packets and resends any that are lost” scores more than “TCP makes it reliable”.
- In transfer-time calculations, convert the file size to bits (× 8) using the prefixes given in the question, divide by the bandwidth in bits per second, and give the answer in seconds.
A3 Databases
A3 is about storing data so that it stays accurate and useful: relational tables linked by keys, designs normalised to 3NF, SQL to query and change data, and integrity rules and transactions that keep data safe when many users work at once. HL looks beyond relational databases to NoSQL models, data warehouses and distributed databases.
Exam tips
- When asked why a table is not in 3NF, name the exact dependency (“MemberName depends on MemberID, which is not the key”), then show the new tables with their primary and foreign keys.
- Write SQL clauses in the order SELECT, FROM, WHERE, GROUP BY, ORDER BY; put text and date values in quotes; and use the table and field names exactly as the question gives them.
A4 Machine learning
A4 covers how machines learn from data: training and testing a model, the three kinds of learning (supervised, unsupervised and reinforcement), judging a model with accuracy and a confusion matrix, and the ethical questions ML raises. HL adds preparing data, neural networks and genetic algorithms.
Exam tips
- Justify the kind of learning from the data in the scenario: “past payments are labelled fraud or genuine, so supervised classification is suitable”. Naming the type without a reason rarely earns full marks.
- When one class is rare, explain why accuracy misleads and use the confusion matrix, saying what a false negative and a false positive mean in the scenario (a missed fraud, an honest customer blocked).
B1 Computational thinking
B1 is how computer scientists approach a problem before writing code: decomposition, pattern recognition, abstraction and algorithmic design. Algorithms are then written as code or flowcharts, checked by dry running them in trace tables and tested with normal, boundary and erroneous data.
Exam tips
- In a trace table, add a row each time a variable changes, keep the columns in the order given and put printed values in the output column. A table that only shows the final values earns little.
- When you identify an error, say which line, what kind it is and why: a logic error runs but gives a wrong result (range(1, n) skips index 0); a runtime error stops the program while it runs (dividing by zero).
B2 Programming
B2 is programming itself: variables, data types and operators; selection and iteration; 1D and 2D arrays; the standard searching and sorting algorithms and how Big O compares them; and functions and files that make programs modular and lasting. HL adds recursion.
Exam tips
- Write code answers in the language you studied (Python or Java), with meaningful names and consistent indentation, then dry run your code on a small example before moving on.
- Know the standard algorithms well enough to write them from memory: totals and counts, finding a maximum, linear search, binary search with low, high and mid, and bubble sort.
B3 Object-oriented programming
B3 builds programs from objects: a class defines attributes and methods, a constructor creates each instance, and encapsulation hides data behind accessors and mutators that can check it. HL extends this with inheritance, aggregation and composition, polymorphism and abstract classes.
Exam tips
- When you construct a class, write a constructor that sets every attribute, keep attributes private, and put the validation inside the mutator (for example, reject a negative amount).
- Explain with the scenario’s names: “because _visits is private, only check_in() can change it, so it cannot be set to a negative number” is stronger than a general definition of encapsulation.
B4 Abstract data types
B4 (HL) studies abstract data types, defined by what they do rather than how they are stored: stacks and queues, linked lists of nodes and pointers, binary search trees, hash tables and sets. The key skill is choosing the structure whose operations and costs fit the problem.
Exam tips
- Trace stack and queue operations in a small table, one row per operation, showing the contents and any value returned, and say which end is the top or the front.
- Describe linked-list changes as pointer updates in the right order (the new node’s pointer first, then the previous node’s), and remember the empty-list and head cases.
Key terms from unit 1
Flashcards from “A1 Computer fundamentals”, the free first unit. Cover each meaning, say it, then check.
- CPU
- The central processing unit, which fetches, decodes and executes instructions.
- ALU
- The arithmetic logic unit, which performs calculations and comparisons.
- Register
- A tiny, very fast storage location inside the CPU.
- Cache
- Small, fast memory that keeps frequently used data close to the CPU.
- Secondary storage
- Non-volatile storage such as SSDs and hard drives that keeps data long term.
- Cloud computing
- Delivering computing services such as storage and software over the internet.
- Hexadecimal
- A base-16 number system using digits 0–9 and letters A–F.
- Colour depth
- The number of bits used to store the colour of each pixel.
- Unicode
- A character set that can represent characters from almost every writing system.
- Logic gate
- A component that produces a binary output from one or more binary inputs.
Try a question
From “The CPU and memory”.
Questions are in English, like the exam. Every answer comes with an explanation.
Why does cache memory speed up a computer?
Show the answer
A. It keeps frequently used data close to the CPU, so slower RAM is accessed less often
Cache is much faster than RAM, so each cache hit saves time.
More in sciences
Start Computer Science today.
The first unit is free. No card needed.
Open Forty5Official IB information
For the rules and the current subject guides, check the IB’s own pages: