IBDP 2026–27 / Grade 11 / Computer Science HL / HYE
>CS HL Notes / HYE paper playbook
A1 Computer fundamentals · B1 Computational thinking · B2 Programming — HL-only content flagged, never skipped
Exam format & scope
Scope from the school HYE Syllabus Focus (Final) 2026–27; logistics from the HYE timetable. Format comparison against the official IB HL assessment outline in the CS guide (first assessment 2027).
| Component | Official IB HL (final exam) | This school HYE |
|---|---|---|
| Papers | P1 (2 h, 80 marks) + P2 (2 h, 80 marks) | One paper, 2 h, max 80 marks — timetable prints “P1 + P2” in a single 2 hr sitting |
| HL-only format | P1 Section A = common SL questions + additional HL-only parts; HL labels are not guaranteed. P2 = two repeated SL questions + HL-only questions. | Expect HL-only content without an explicit “HL” label; some P2 questions ban sort/pop/len/max/min. |
| Theme A content | P1 Section A — extended response, SL + HL topics (56 marks) | In scope: A1 only (A1.1–A1.4) |
| Case study | P1 Section B — pre-seen case study (24 marks) | Not used — no case study has been issued for the HYE |
| Theme B content | P2 — extended response, Python or Java versions (80 marks) | In scope: B1.1 + B2.1–B2.5 |
| AO weighting (P1/P2) | ≈ 50% AO1+AO2 / 50% AO3 | Expect the same mix: recall + apply + construct/evaluate |
Scope wording: “May include” lists are examples, not exhaustive; “must include” lists are the full assessed set. Do not treat a may-include list as the whole topic.
What is actually examinable
In scope (10 topics)
- A1.1 hardware and operation (A1.1.1–A1.1.9)
- A1.2 data representation and computer logic (A1.2.1–A1.2.5)
- A1.3 operating systems and control systems (A1.3.1–A1.3.7)
- A1.4 translation — HL only (A1.4.1)
- B1.1 approaches to computational thinking, incl. flowchart tracing
- B2.1 programming fundamentals · B2.2 data structures (arrays/lists, stacks, queues)
- B2.3 constructs · B2.4 algorithms (Big O, search, sort; recursion HL)
- B2.5 file processing
Not in this paper
- A2 networks · A3 databases · A4 machine learning
- B3 object-oriented programming (HL)
- Internal assessment / case-study research
- Abstraction / design topics beyond the guide points listed left
HL-only points — required, not optional
- A1.1.3 CPU vs GPU · A1.1.6 pipelining
- A1.3.5–A1.3.7 multitasking + control systems
- A1.4.1 interpreters vs compilers
- B2.4.4–B2.4.5 recursion concept + constructing/tracing recursive algorithms
120 min ÷ 80 marks = 1.5 minutes per mark. Plan roughly 60 min for Theme A material, 55 min for Theme B, 5 min checking — the exact split is an estimate; read the paper’s own mark tariffs first and allocate time per mark, not per question.
This paper rewards doing, not reciting: trace tables for programs and sorts, truth tables for circuits, constructed pseudocode for searches and file handling, and short evaluations (polling vs interrupts, compilers vs interpreters). Every school markscheme so far accepts logically equivalent code and penalises only unclear algorithms — so always write something structured, even when unsure of exact syntax.
The timetable labels the 2 hr sitting “P1 + P2”. Treat it as one continuous paper; the internal section split (if any) is not published. The official IB case-study section is assumed absent. If the teacher circulates a structure update before 16 Dec, trust that over this page.
Sources: Grade 11 HYE Syllabus Focus (Final) 2026–27 and HYE Timetable (coordinator mails 6 Nov, reconfirmed 27 Nov 2026); IB Computer science guide (first assessment 2027), HL assessment outline p. 47; external assessment details pp. 48–50.
Assessment objectives — what the examiner is actually rewarding
The guide maps each command term to one objective — note that in CS, describe is AO2 (give a detailed account) while explain is AO3 (detailed account including reasons or causes). Explain answers must chain cause → effect.
| Command term | AO | What to do | Watch out |
|---|---|---|---|
| State / label / list | 1 | Brief answer, name or value. No explanation. | |
| Identify | 2 | Provide an answer from a number of possibilities. | School MS: “no explanation required unless requested” — don’t waste time. |
| Define | 1 | Precise meaning of a term. | One crisp sentence; qualifiers earn the second mark. |
| Describe | 2 | Detailed account of features. | More depth than outline; still no reasons needed. |
| Outline | 2 | Brief account or summary. | Shorter than describe. |
| Distinguish | 2 | Make the differences clear. | Both items, side by side. |
| Calculate / estimate | 2 | Numerical answer showing relevant stages. | Show the substitution — method mark lives there. |
| Trace | 2 | Follow and record the actions of an algorithm. | Record every step, not just the final output. |
| Explain | 3 | Detailed account including reasons or causes. | Chain statements: how/why, linked. |
| Compare | 3 | Similarities and/or differences, referring to both throughout. | Don’t write two separate descriptions. |
| Construct | 3 | Display information in diagrammatic or logical form. | Logically equivalent solutions accepted; minor syntax slips not penalised. |
| Deduce | 3 | Reach a conclusion from the information given. | Use the data in the question. |
| Evaluate / discuss / to what extent | 3 | Weigh strengths and limitations; balanced review + supported conclusion. | Criteria first, both sides, judgement last. |
| Justify / suggest | 3 | Valid reasons or a proposed solution. | Tie reasons to the scenario. |
| Sketch | 3 | Diagram or graph with the right shape and labelled features. | Label axes and key points. |
Mid-Term Set 2 HL (Oct 2026) general notes: award marks for valid equivalent answers; state/identify needs no explanation; explain needs linked statements; for programming, accept logically equivalent solutions — minor syntax errors are not penalised when the algorithm is clear; the same point is not awarded twice.
Source: IB CS guide (FA 2027), assessment objectives pp. 22–23 and command-term glossary pp. 59–60; Mid-Term Set 2 Marking Scheme HL (Oct 2026); A1 Formative Assessment HL Markscheme.
Answer frames — how to structure each question type
Content questions (2–6 marks)
| Command / marks | Structure | Check before moving on |
|---|---|---|
| 2 — define | Precise meaning + one qualifier (volatile? parallel? feedback?). | No story, no example needed. |
| 2 — state / identify | One line per mark. Two marks = two separate points. | No development. |
| 2–4 — describe / outline | Feature list in order; one developed feature per mark. | Match depth to marks: outline < describe. |
| 2–4 — explain | Point → because/so that → consequence. One chain per 2 marks. | Each chain reaches a system outcome (performance, reliability, response time). |
| 2–4 — compare / distinguish | One table-style line per feature, both items in every line. | “X is fast whereas Y is slow” — never one-sided. |
| 4–6 — evaluate / discuss | Criteria → strengths → limitations → judgement with a condition. | Both sides + a decision. No fence-sitting conclusion. |
| 2–3 — calculate | Formula → substitution → answer with units (bits vs bytes!). | Show every stage; a wrong final answer can still earn the method mark. |
Construct questions (4–6 marks)
- Read inputs, outputs and the exact task (return index? -1 if absent? first occurrence?).
- Choose the structure: loop type, selection, data structure, function boundary.
- Write pseudocode in the conventions below — or Python/Java if the question names a language.
- Dry-run your answer on a small input (n = 3 or 4) with a trace table before writing it out.
School MS practice: 5-mark constructions typically award one mark per logic element (bounds → midpoint → equality test → half-discard → output), so a partially correct answer still scores.
Trace questions (3–5 marks)
- Build a trace table: one column per variable + condition + output. One row per iteration (Mid-Term Set 2 awarded 1 mark per completely correct row).
- Update variables immediately; always use the newest value.
- Record every output inside loops, then the final output after the loop.
- Loops end when the condition is re-checked and fails — include that failing check in your head, not as an extra output row.
Evaluate questions — the CS criteria bank
For “evaluate polling vs interrupts” or “evaluate interpreters vs compilers”, pick explicit criteria, judge each side against them, conclude:
- Event frequency / usage scenario (development speed vs runtime speed)
- CPU overhead / translation overhead
- Power source (battery vs mains)
- Predictability and latency
- Security / portability
- Judgement: “For X’s scenario … therefore …”
Pre-submit checklist
- Command term obeyed (state ≠ explain; compare both; evaluate judges)
- Every construct answer dry-run on paper
- Truth tables have 2ⁿ rows; binary search bounds updated
- Units on calculations (bits/bytes; Hz; ms)
- HL-only content used where the question says HL
- Time per mark respected — 1.5 min/mark, move on
Source: school markschemes (A1 Formative HL/SL; Mid-Term Set 2 HL) for tariff patterns; guide command-term definitions.
Pseudocode conventions — write code the marker can follow
IB questions accept natural language, flowcharts or pseudocode, and the school markschemes accept logically equivalent code. Use these conventions (the style used in class traces):
| Construct | Pseudocode | Python | Java |
|---|---|---|---|
| Output / input | output X / input X | print(x) / x = input() | System.out.println(x); / Scanner |
| Assignment | x = 5 | x = 5 | x = 5; |
| Comparison | x == 5 | x == 5 | x == 5 |
| Selection | if c then … else … end if | if / elif / else | if / else if / else |
| Counted loop | for i = 1 to n … end for | for i in range(1, n+1): | for (int i = 1; i <= n; i++) |
| Conditional loop | while c … end while | while c: | while (c) {…} |
| Function | function f(a, b) … return r end function | def f(a, b): … return r | static int f(int a, int b) {…} |
| Array / list access | X[i] — IB style is often 1-based | x[i] — 0-based | x[i] — 0-based |
| Read from file | open … read … close | open() / readline() / close() | Scanner / BufferedReader |
Do not assume “IB style” indexing. The 2027 guide does not prescribe 1-based pseudocode; P2 is Python or Java (both 0-based). Follow the indexing stated in the question and label it in every trace. For the IA, algorithms may be written in natural language, flowcharts or pseudocode; for P2, answer in the language the paper specifies.
Paper 2 exists in a Python version and a Java version (guide pp. 48–49). Some P2 questions ban built-ins such as sort, pop, len, max or min — follow the paper.
Source: IB CS guide (FA 2027) — algorithms “in natural language, flow charts or pseudocode”, Paper 2 language versions pp. 48–49; LMS B2 study notes; class algorithm-tracing page (Mulkey pseudocode simulator reference).
Common mark leaks — fix these before the paper
- Truth table with 4 rows when there are 3 inputs — it needs 2³ = 8 rows.
- Complex circuit computed in one jump — no intermediate column for the first gate’s output.
- XOR answered like OR — XOR is 1 only when inputs are different.
- “GPU is faster than CPU” — say parallel architecture, many simpler processing units, suited to similar repeated calculations.
- PC described as holding the instruction — it holds the address of the next instruction.
- Binary search on unsorted data, or forgetting to move
low/highafter each comparison. - Bubble sort best case claimed O(n) without mentioning the early-stop check; selection sort claimed O(n) on sorted data — it stays O(n²).
- Trace records only the final output — marks are per iteration row.
- Recursion traced downward only — follow the returned values back up.
- Base case missing or unreachable (
f(n-1)when base case is n = 0 but calls start below 0) — say “infinite recursion → stack overflow”. - File question answered with write mode when data must be kept — append.
- Evaluation gives one side only — no criteria, no judgement, capped marks.
- Image-size answer in bits when the question asks bytes — divide by 8 and state units.
Source: school markschemes (formative + Mid-Term Set 2 HL) and LMS “common mistakes” sections across A1/B2 notes.
A1 — Computer fundamentals
A1.1Computer hardware and operationA1.1.3 + A1.1.6 HL
Definitions — the CPU and its parts
- CPU — executes program instructions, one machine instruction at a time, via the fetch–decode–execute cycle.
- ALU — arithmetic logic unit: calculations (add, subtract…), logic (AND, OR, NOT, XOR) and comparisons.
- CU — control unit: coordinates the CPU, decodes the instruction in the IR, sends control signals; it does not calculate.
- Registers — tiny, fastest storage inside the CPU: IR current instruction, PC address of next instruction, MAR address being accessed, MDR data/instruction in transit, AC accumulator holds calculation results.
- Buses — address (WHERE — CPU→memory, unidirectional), data (WHAT — both directions), control (WHAT ACTION — read/write/timing signals).
- Processors — single-core (one core), multi-core (2+ independent cores, parallel tasks), co-processor (specialised helper for e.g. graphics, maths, encryption — assists rather than replaces).
Fetch–decode–execute cycle (A1.1.5)
Fetch: copy PC → MAR; address travels the address bus with a read signal on the control bus; instruction returns on the data bus into the MDR, then MDR → IR; PC increments to the next instruction (a branch/jump can later overwrite it). Decode: the CU interprets the IR — operation, operands, which component is needed. Execute: carry out the operation — ALU calculates, memory is read/written, or the PC changes for a branch. Then repeat.
Primary memory (A1.1.4)
| Type | Purpose | Key facts |
|---|---|---|
| Registers | Values being processed right now | Fastest, smallest, inside the CPU |
| Cache L1/L2/L3 | Frequently/recently used instructions + data | L1 smallest + fastest, per core; L3 larger, usually shared. Cache hit = found in cache (fast). Cache miss = must check a lower level (slower). Works because of locality of reference. |
| RAM | Working memory for running programs + data | Volatile — contents lost when power is removed |
| ROM | Firmware / start-up instructions | Non-volatile — kept when switched off; why boot code lives here |
Hierarchy: registers → L1 → L2 → L3 → RAM → secondary storage (speed falls, capacity rises, cost per bit falls as you go down).
Pipelining in multi-core architectures — HL only (A1.1.6)
Pipelining overlaps instruction stages so different instructions occupy different stages at the same time: fetch → decode → execute → write-back. It raises throughput (instructions completed per unit time), not the speed of any single instruction.
| Time | Instr 1 | Instr 2 | Instr 3 | Instr 4 |
|---|---|---|---|---|
| 1 | Fetch | – | – | – |
| 2 | Decode | Fetch | – | – |
| 3 | Execute | Decode | Fetch | – |
| 4 | Write-back | Execute | Decode | Fetch |
| 5 | – | Write-back | Execute | Decode |
| 6 | – | – | Write-back | Execute |
| 7 | – | – | – | Write-back |
In multi-core processors each core runs its own pipeline independently and in parallel (instruction-level parallelism within a core; core-level parallelism across cores). A pipeline stall occurs when an instruction must wait — e.g. it needs a result not yet produced. More cores help only when work can be divided; a single sequential task gains little.
GPU role (A1.1.2 — core) and CPU vs GPU (A1.1.3 — HL)
A GPU contains many simpler processing units executing similar calculations in parallel — suited to graphics rendering (millions of pixels per frame), AI/machine learning (matrix and vector maths), and large simulations. The CPU has fewer, complex, flexible cores optimised for sequential decisions and low latency; the GPU optimises for high throughput.
| Feature | CPU | GPU |
|---|---|---|
| Design philosophy | General-purpose flexibility | Massive parallelism for data-heavy work |
| Cores | Few, powerful, complex | Many, simpler |
| Processing style | Sequential + branching decisions | Repetitive, independent, parallel |
| Memory priority | Low latency (large caches) | High bandwidth / throughput |
| Power efficiency | Good for general work | Strong per-watt on parallel tasks; workload dependent |
| Typical role | OS, control flow, game logic | Rendering, AI training, simulation |
Working together: task division (CPU prepares data and controls the program; GPU runs the parallel maths), data sharing (results passed back — transfers have overhead), coordinated execution (CPU orchestrates). Neither replaces the other.
Secondary storage (A1.1.7)
| Device | Internal / external | Best scenario |
|---|---|---|
| SSD | Internal | Fast boot/app loading, shock resistance (no moving parts) |
| HDD | Internal | Large capacity, lower cost per GB (magnetic platters, moving parts) |
| eMMC | Internal | Budget laptops/tablets/phones — compact, soldered flash |
| External SSD / HDD | External | Backups, transfer, archives (SSD = speed, HDD = capacity) |
| Optical drive | External | CD/DVD/Blu-ray archives and legacy media |
| Flash drive / memory card | External | Portable transfer, cameras and small devices |
| NAS | External (network-attached) | Central shared storage for multiple authorised devices |
Compression (A1.1.8)
Lossless — original recovered exactly (text, code, data). Lossy — information permanently removed; smaller files; good for photos, music, video. RLE (lossless): store each run as value + count — AAAABBBCCDAAAA → A4 B3 C2 D1 A4. RLE fails on data with no runs: ABCDEFGH becomes 1A1B1C… — larger than the original (the school MS marks exactly this point). Transform coding (lossy): convert pixel/audio data to a representation where less-important components can be reduced or discarded — used in JPEG/MP3; the original cannot be reconstructed exactly.
Cloud services (A1.1.9)
| Service | You get | You manage | Scenario |
|---|---|---|---|
| SaaS | Complete application via browser/app | Account + data only | Email, online documents |
| PaaS | Platform + tools to build, test, deploy | Your application code | Developing a web app without managing servers |
| IaaS | Virtual machines, storage, networking | OS, applications, configuration | Custom environments, scalable servers |
Control, flexibility and user responsibility all increase from SaaS → PaaS → IaaS; provider-managed convenience decreases. Scalability up/down with demand avoids buying hardware for peak load. Availability: SaaS provider manages uptime; IaaS user manages OS/application availability; all depend on provider and network uptime.
Classic tariffs: 2-mark “state one advantage of SSD over HDD”; 2-mark lossy vs lossless; scenario choice of storage/cloud model with a reason; HL Q5(a): 2 marks — 1 CPU vs GPU + 1 pipelining; Q1(c): 1 mark GPU role; HL explain how pipelining improves performance (overlap stages → higher throughput, not faster individual instructions).
PC holds an address, not the instruction. Address bus is unidirectional. A GPU is not “just faster” — its architecture suits parallel workloads. Pipelining improves throughput; stalls reduce the benefit. “More cores” does not proportionally speed up one sequential program.
Source: LMS A1.1 Computer fundamentals study notes; IB CS guide (FA 2027) A1.1 pp. 27–28; A1 Formative HL Markscheme Q1, Q2, Q5(a); Mid-Term Set 2 HL MS Q1(a); Revision-practice A1 (registers, FDE, compression, pipelining tasks).
A1.2Data representation and computer logic
Number systems and conversions (A1.2.1)
Binary is base 2 (digits 0–1, place values 1, 2, 4, 8 …); hexadecimal is base 16 (0–9, A=10 … F=15); decimal is base 10. One hex digit maps to exactly 4 bits (16 = 2⁴) — that is why hex is a compact shorthand for long binary strings like memory addresses.
| Conversion | Method | Worked example |
|---|---|---|
| Binary → decimal | Multiply each 1 by its power of 2, add | 10110110 = 128+32+16+4+2 = 182 |
| Decimal → binary | Repeated ÷ 2, read remainders bottom→top | 45 → 101101 |
| Hex → decimal | Multiply digits by powers of 16, add | 2A = 2×16 + 10 = 42 |
| Decimal → hex | Repeated ÷ 16, remainders bottom→top | 42 → 2A |
| Binary → hex | Group in 4s from the right (pad left with 0s), convert each group | 1011 0110 → B6 |
| Hex → binary | Each digit → its 4-bit pattern | C7 → 1100 0111 |
Check-chain: 10110110₂ = B6₁₆ = 182₁₀ — three representations of one value. Padding zeros are added only for conversion; they do not change the value.
How binary stores data (A1.2.2)
- Bit / byte: 1 bit = 0 or 1; 1 byte = 8 bits = 256 patterns (0–255). n bits → 2ⁿ patterns.
- Integers: stored directly as binary place values; more bits → larger range. Signed values (e.g. two’s complement, −128…+127 in 8 bits) depend on interpretation.
- Characters: a code is assigned then stored — ASCII
A = 65 = 01000001,a = 97, character'0' = 48(not the value 0). Unicode/UTF-8 extends coverage to all world scripts. - Strings: sequence of encoded characters —
HELLO→ five binary byte values. - Images: a grid of pixels; 24-bit RGB uses 8 bits per channel (256 levels each) → 3 bytes per pixel. Size = width × height × colour depth.
- Audio: analogue wave sampled at rate (44,100 Hz = 44,100 samples/s) with a bit depth per sample (16-bit).
- Video: sequence of frames per second (fps) + audio track.
Worked example (school formative style): a 800 × 600 image at 24 bits/pixel → 800 × 600 × 24 = 11,520,000 bits = 1,440,000 bytes. One second of CD audio: 44,100 × 16 × 2 channels = 1,411,200 bits. Bits have “no meaning by themselves” — the format/encoding tells the system how to interpret them. Storage/retrieval impact: more bits per value → larger range/precision but more storage; retrieval must use the same encoding.
Logic gates (A1.2.3)
| Gate | Output is 1 when… | Remember | Typical use |
|---|---|---|---|
| AND | all inputs are 1 | ALL | Multiple conditions must hold |
| OR | at least one input is 1 | ANY | Alternative triggers |
| NOT | input is 0 (reverses) | OPPOSITE | Inverting a condition |
| NAND | inputs are not both 1 | NOT-AND | Universal gate |
| NOR | all inputs are 0 | NOT-OR | Universal gate |
| XOR | inputs are different | DIFFERENT → 1 | Adders, comparison, error detection |
| XNOR | inputs are the same | SAME → 1 | Equality checking |
Multi-input note: NAND = NOT(all inputs 1); XOR = odd number of 1s; XNOR = even number of 1s. For two inputs, NAND = not both 1, XOR = different inputs.
Gates are the building blocks of processors: arithmetic circuits, comparison circuits, control and memory circuits. NAND and NOR are universal — any Boolean operation can be built from either alone (e.g. A NAND A = NOT A).
Truth tables and Boolean expressions (A1.2.4)
Rows = 2ⁿ for n inputs (2 inputs → 4; 3 → 8; 4 → 16). For circuits with several gates, add an intermediate column per gate and work left → right. Boolean notation: · = AND, + = OR, ¬/overbar = NOT, ⊕ = XOR — + is OR, not addition.
| A | B | AND | OR | NAND | NOR | XOR | XNOR |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
Worked example (school formative): X = C AND (A OR B) — outputs for ABC = 000→111 are 0,0,0,1,0,1,0,1. Mid-term style: F = V(P + O) gives 1 only for V=1 with P or O = 1; K-map grouping simplifies a truth table to F = VP + VO.
Logic diagrams and simplification (A1.2.5)
- Standard symbols: AND (flat left, D-shaped right), OR (curved left, pointed right), NOT (triangle + bubble), NAND/NOR/XNOR (base symbol + output bubble), XOR (OR + extra input curve).
- A bubble on a gate’s output = inverted output.
- Construct from an expression inside-out:
Q = (A AND B) OR C→ AND first, then OR with C. - Reading a diagram: follow signals left→right, name intermediate outputs (
X = A AND B), write the full expression, verify with a truth table.
Boolean algebra laws for simplification: identity (A·1=A, A+0=A), null (A·0=0, A+1=1), idempotent (A·A=A), complement (A·¬A=0, A+¬A=1), double negation, commutative, associative, distributive, and De Morgan’s: ¬(A AND B) = ¬A OR ¬B; ¬(A OR B) = ¬A AND ¬B (NOT crossing the brackets flips AND↔OR). Karnaugh maps group adjacent 1-cells (groups of 1, 2, 4, 8 — as large as possible; groups may overlap and wrap around the map edges: top↔bottom, left↔right) to find a minimal expression — the visual route to the same simplification.
Guaranteed-style parts: convert 206 to binary and hex showing working; explain why hex is a shorthand; a truth table from a problem description (“alarm sounds when armed AND door open” → AND); derive/simplify a Boolean expression with a K-map; calculate image size in bits and bytes.
Group binary→hex from the right. Read division remainders bottom→top. XOR ≠ OR (1,1 gives 0 for XOR). 3 inputs need 8 rows. Boolean + is OR, not addition. In diagrams, don’t forget output bubbles — AND+bubble is NAND.
Source: LMS A1.2 Data representation and computer logic study notes; IB CS guide (FA 2027) A1.2 pp. 28–29; A1 Formative HL Markscheme Q3; Mid-Term Set 2 HL MS Q1(c); Revision-practice A1 number-conversion and logic drills.
A1.3Operating systems and control systemsA1.3.5–A1.3.7 HL
Role and functions (A1.3.1–A1.3.2)
An OS abstracts hardware complexity and manages system resources — the middle layer between users/applications and hardware. Applications request services (save a file, send a packet) without touching low-level device details; the OS provides a standardised interface so software works across different hardware.
| Function | What it does | Think of it as |
|---|---|---|
| System integrity | Keeps background operations stable; stops processes interfering | “Is the system still healthy?” |
| Memory management | Allocates/tracks/protects RAM; frees memory when processes end | “Who gets RAM?” |
| File system | Creates, stores, locates, protects files and folders | “Where do files live?” |
| Device management | Communicates with hardware, usually via device drivers | “How does software reach hardware?” |
| Scheduling | Allocates CPU time among processes | “Who gets CPU time?” |
| Security | Authentication (passwords, biometrics), permissions, process isolation | “Who is allowed what?” |
| Accounting | Records resource usage per user/process | “Who used what?” |
| GUI | Visual interaction — windows, icons, menus, pointer | “How does the user interact?” |
| Virtualization | Virtual machines sharing one physical machine | “Many computers in one?” |
| Networking | Manages connections, protocols, shared network resources | “How do we talk to other machines?” |
Scheduling approaches (A1.3.3)
A process is a running program; ready processes wait in the ready queue. Goals: high CPU utilisation, good throughput, low waiting and response time, fairness.
| Approach | Rule | Strength | Main issue | Suits |
|---|---|---|---|---|
| FCFS | Arrival order; runs to completion/block | Simple, fair by arrival | Convoy effect — one long job delays many short ones; poor interactive response | Simple batch work |
| Round robin | Fixed time quantum each turn, then back of queue | Fair turns; good response | Context-switching overhead; quantum choice matters (too small → overhead, too large → behaves like FCFS) | Interactive systems |
| Multilevel queue | Processes split into queues (system/interactive/background), each with its own policy | Treats process types differently | Complex; low queues can be starved | Systems with clear process classes |
| Priority | Highest priority first | Critical tasks run soon | Starvation of low-priority processes — fix with aging (priority rises with waiting time) | Time-critical workloads |
Polling vs interrupt handling (A1.3.4)
Polling — the CPU repeatedly checks a device (“anything yet?”). Interrupt — the device signals the CPU when an event needs attention; the CPU saves state, runs the handler, restores and continues. Polling = CPU asks; interrupt = device tells.
| Factor | Polling | Interrupts |
|---|---|---|
| Event frequency | Works when events are frequent (checks rarely wasted) | Very frequent events → handling overhead stacks up |
| CPU overhead | Wasted checks when nothing happens | No wasted checks, but each handler costs save/restore work |
| Power source | Keeps CPU active — bad for battery devices | CPU can idle in low-power states and wake on signal |
| Predictability | Known check intervals — predictable | Asynchronous timing |
| Latency | Waits for next check | Fast response; can still delay under heavy load or masked interrupts |
| Security | Centrally controlled checks | Uncontrolled interrupt floods can consume CPU — OS must control sources and priorities |
Scenarios: keyboard/mouse (unpredictable → interrupts), network packets (unpredictable, but very high rates can make interrupts expensive — batch them), disk I/O completion (interrupts free the CPU meanwhile), embedded sensors on battery (interrupts + sleep), real-time systems (choice depends on whether rapid notification or predictable timing matters more).
Multitasking and resource allocation — HL only (A1.3.5)
The OS switches CPU time between processes (on a single core, rapid switching — context switch: save one process’s state, load another’s; too much switching = overhead). Challenges: task scheduling (which process, when), resource contention (two processes need the same printer/RAM/CPU — OS queues and controls access), and deadlock — each process holds a resource the other needs, none can proceed.
Deadlock needs four conditions together: Mutual exclusion, Hold-and-wait, No pre-emption, Circular wait (M-H-N-C). OS responses: prevention (break a condition, e.g. request resources in a fixed order), avoidance (check requests for unsafe states), detection and recovery (terminate/release/restart).
Control system components — HL only (A1.3.6)
Control systems follow input → process → output. Open-loop: no feedback — timer toaster, fixed-cycle microwave; simple, cheap, cannot correct itself. Closed-loop: a sensor feeds the actual output back to the controller, which compares desired vs actual and adjusts — thermostats, cruise control.
| Component | Role | Example |
|---|---|---|
| Controller | Decision-maker | Compares 22°C target with measured temperature |
| Sensor | Detects a physical condition | Temperature, motion, moisture, light sensor |
| Actuator | Produces the physical action | Heater, motor, valve, brake |
| Transducer | Converts one energy form ↔ another | Microphone (sound→signal), speaker, motor |
| Control algorithm | Rules deciding the response | IF temp < 22 THEN heater ON |
| Feedback | Reports the actual state/output | Measured temperature returned to controller |
Real-world control systems — HL only (A1.3.7)
| Application | Sensors / inputs | Actuators / outputs |
|---|---|---|
| Autonomous vehicle | Cameras, radar, lidar, positioning | Steering, brakes, motor |
| Home thermostat | Temperature sensor | Heater / cooler |
| Elevator controller | Floor requests, position, door sensors | Motor, brakes, doors |
| Washing machine | Water level, temperature, door | Valves, heater, drum motor |
| Traffic signals | Vehicle sensors, pedestrian buttons, timers | Signal lamps (fixed timer = open-loop) |
| Irrigation | Soil moisture | Pump / valve |
| Home security | Motion, door/window, glass-break | Alarm, notification |
| Automatic doors | Proximity / motion | Door motor |
Limits to mention in evaluations: sensor errors → wrong decisions, algorithm errors, hardware failure, security risks for connected systems, power dependence.
Compare scheduling approaches with a scenario (interactive OS → round robin); evaluate polling vs interrupts with the six-factor table; HL: explain OS multitasking on a robot (Mid-Term Set 2 did exactly this — processes, CPU switching, resource allocation, contention, deadlock, 3 marks); identify control-system components; justify open vs closed loop for a device.
Starvation (low priority never runs) ≠ deadlock (nobody can run). Aging is the starvation fix. Priority numbering direction varies by system — say “highest priority”. A traffic light on a fixed timer is open-loop even though it “acts automatically” — no feedback about actual traffic. Sensors detect; transducers convert.
Source: LMS A1.3 Operating systems–Control systems study notes; CLM Scheduling, Polling & Interrupts teaching PPT (A1.3.3–A1.3.4); OS Lesson 1 PPT (A1.3.1–A1.3.2); Mid-Term Set 2 HL MS Q1(d); A1 Formative HL Markscheme Q4–Q5.
A1.4Translation{HL}
Interpreters vs compilers (A1.4.1 — HL only)
The CPU executes machine code; programmers write high-level source code; a translator bridges the two. An interpreter translates and executes as the program runs. A compiler translates the whole program before execution into machine code or an intermediate form.
| Factor | Interpreter | Compiler |
|---|---|---|
| Translation timing | During execution, statement by statement | Once, before execution (build step) |
| Error detection | At execution, when the failing line runs; unexecuted code may hide errors | Many errors caught before the program ever runs |
| Execution performance | Runtime translation overhead — slower | Fast; compiler can optimise |
| Portability | Source runs anywhere a suitable interpreter exists | Output can be platform-specific (per processor/OS) |
| Development loop | Write → run → fix, no build — rapid testing | Edit → compile → test; compile time cost |
| Distribution | Needs the interpreter on the target machine | Ship the executable; source stays private |
JIT and bytecode
Just-in-time compilation hybrids the two: at runtime, frequently executed code is compiled to efficient machine code — best of both when hot code runs many times, at the cost of runtime compilation overhead and memory. Bytecode: source is first compiled to a portable intermediate form executed by a virtual machine (e.g. Java’s model) — the same bytecode runs on any platform with the right runtime; portability depends on that runtime existing.
| Scenario | Better fit | Why |
|---|---|---|
| Rapid development and testing | Interpreter | Immediate run/fix cycle, no build stage |
| Performance-critical (game engine, OS, simulation) | Compiler (+ JIT for hot paths) | Efficient machine code, no repeated translation |
| Cross-platform app on Windows/macOS/Linux | Bytecode + per-platform runtime | One intermediate form, each OS supplies a runtime |
This is a single syllabus point with the command term evaluate: expect a 4–6 mark question weighing interpreter vs compiler (or JIT/bytecode) for a named scenario. Structure: criteria (development speed, execution speed, error detection, portability) → both sides → judgement with a condition (“for this performance-critical application…”)..
Don’t claim interpreters find errors “earlier” — they report at the failing line during execution; compilers catch many errors before running. Don’t claim compiled code is always platform-independent — native machine code targets a specific architecture. Portability of any approach depends on the right translator/runtime being installed.
Source: LMS A1.4 Translators study notes; IB CS guide (FA 2027) A1.4 p. 30 (HL only — mechanics, error detection, translation time, portability, JIT, bytecode, three scenario families).
B1 — Computational thinking
B1.1Approaches to computational thinking
Constructing a problem specification (B1.1.1)
A specification states what the solution must do before any code is written. Remember P-C-O-I-O-E:
| Part | Question it answers | School attendance example |
|---|---|---|
| Problem statement | What is wrong, for whom? | Manual attendance is slow and error-prone |
| Constraints & limitations | What restrictions apply? | Existing computers only; only teachers may edit; data protected; fixed deadline |
| Objectives & goals | What should the solution achieve? | Fast recording, fewer errors, automatic percentages |
| Input specifications | What data enters, in what form? | Student ID (must exist), date, Present/Absent |
| Output specifications | What is produced? | Daily lists, per-student %, monthly report |
| Evaluation criteria | How is success measured? | “Record displayed within 2 s” — specific and testable, not “fast” |
The four fundamental concepts (B1.1.2)
| Concept | Meaning | Example |
|---|---|---|
| Abstraction | Keep only relevant information; hide the rest | Navigation app keeps roads + distances, drops building colours |
| Algorithmic design | Clear, ordered, terminating steps | Find-largest-of-three procedure |
| Decomposition | Break one big problem into manageable sub-problems | Online shop → accounts, search, cart, payment, delivery |
| Pattern recognition | Spot similarities, repetitions, relationships | Weekday morning traffic peaks recur; reusable input–process–check–output structure |
Distinguish carefully: abstraction decides what information matters; decomposition decides how the problem divides. Pattern recognition finds what repeats; algorithmic design writes the procedure.
Applying computational thinking (B1.1.3)
CT is a toolkit, not necessarily programming — it develops the solution; programming implements it. Applications to quote: software development (decompose modules, abstract data needs), data analysis (select variables, find trends), machine learning (features + patterns in data), database design (entities, relationships), network security (detect suspicious patterns such as repeated failed logins).
Tracing flowcharts (B1.1.4)
| Symbol | Shape | Purpose |
|---|---|---|
| Start/End | Oval | Where execution begins / finishes |
| Process | Rectangle | Calculation, assignment, variable update |
| Decision | Diamond | Condition with Yes/No branches — follow only one |
| Input/Output | Parallelogram | Receive data / display results |
| Flowline | Arrow | Direction of control — follow arrows, not reading order |
| Connector | Small circle | Flow continues elsewhere (large charts) |
Trace protocol: start at Start → follow every arrow → at each process, update variables immediately → at each decision, evaluate with current values and take one branch → repeat loops until their condition fails → record every output.
| Step | Operation | x | Condition | Output |
|---|---|---|---|---|
| Start | x = 1 | 1 | — | — |
| 1 | output x; x = x + 2 | 1 → 3 | x < 6 → True | 1 |
| 2 | output x; x = x + 2 | 3 → 5 | x < 6 → True | 3 |
| 3 | output x; x = x + 2 | 5 → 7 | x < 6 → False | 5 |
| End | — | 7 | loop exits | 1, 3, 5 |
Trace-table discipline is the same skill used for programs (B2.1), sorts and searches (B2.4) — one row per pass, newest values only.
Expect: construct a specification from a scenario (name all six parts); identify which CT concept a described action uses; trace a flowchart and state all outputs plus final variable values. The guide flags a Paper 2 question “with a focus on algorithmic thinking without the need to interpret or write code” — flowchart tracing is exactly that.
Follow the arrows, not top-to-bottom reading order. Never follow both branches of a decision. Use the newest variable value (x = x + 3 changes x immediately). x >= 5 is true when x = 5; x > 5 is not. Record every output inside loops, not just the last.
Source: LMS B1 Computational Thinking study notes; IB CS guide (FA 2027) B1.1 pp. 37–38; B1 Revision QP-1; flowchart-practice worksheet; B2 study-note trace examples.
B2 — Programming
B2.1Programming fundamentals
Variables, data types and scope (B2.1.1)
| Type | Stores | Example |
|---|---|---|
| Boolean | True / False | hasPassed = True |
| char | One character | grade = 'A' |
| integer | Whole number | age = 17 |
| decimal | Fractional number | average = 82.5 |
| string | Character sequence | name = "Aarav" |
Global variables are declared outside functions — accessible across the program, easy sharing, but any part can change them (harder debugging). Local variables live inside a function/block — safer and independent, invisible outside their scope. Same-named global and local variables can coexist; when tracing, work out which scope each assignment touches.
Trace discipline — x = 10; y = 4; z = x + y; x = z * 2; y = x − 5 → z = 14, x = 28, y = 23; outputs 28, 23, 14. Assignment score = score + 10 means “compute with the current value, then replace”.
Substrings (B2.1.2)
- Extract by start/end or start+length:
word[3:6]on"COMPUTER"→"PUT"(0-based, end excluded). - Find first:
email.find("@")→ splitrakesh@example.cominto usernameemail[:pos]and domainemail[pos+1:]. - Alter: upper/lowercase, strip characters. Concatenate:
first + " " + last. Replace:text.replace("cats", "dogs"). - Combined: rebuild
"STU2026A"→code[:3] + "2027" + code[7:]="STU2027A".
Spaces count as characters; a space has an index. Indexing convention (0- vs 1-based) must follow the question.
Exception handling (B2.1.3)
Failure points: unexpected inputs (user types “hello” for an age), resource unavailability (missing file, dead network), logic errors (runs but computes wrongly — exceptions do not fix these; testing and debugging do).
| Block | Java | Python | Role |
|---|---|---|---|
| Risky code | try { } | try: | Code that may raise an exception |
| Handler | catch (ExceptionType e) { } | except ExceptionType: | Respond with a meaningful message / recovery |
| Cleanup | finally { } | finally: | Always runs — close files, release resources |
Example: int(input()) raising ValueError on “abc”; 10 / number raising ZeroDivisionError; opening a missing file raising FileNotFoundError. Good handlers name the problem and the next step — not “Something went wrong”.
Debugging techniques (B2.1.4)
| Technique | What it does | Best for |
|---|---|---|
| Trace table | Records variable values per step/iteration | Loops and repeated updates; finding where a value first goes wrong |
| Breakpoint | Pauses execution at a chosen line; inspect state | Long programs; inspecting values at a suspicious point |
| Print statements | Temporarily display values/flow markers | Quick checks; which branch executed |
| Step-by-step execution | One statement at a time (step over / into / out) | Seeing exactly when values change |
Process: reproduce → expected vs actual → locate suspicious section → trace/inspect → fix one thing → re-test including boundary values. Testing reveals a failure exists; debugging finds its cause. Remove temporary prints afterwards.
Trace a program with mixed types and scope (state all outputs); construct a substring program (split an ID/email/date); explain why exception handling is used around file opening; match each debugging technique to a situation. Mid-Term Set 2 traced a 4-iteration room-monitoring loop — 1 mark per correct row plus the final output.
'A' is a char, "Apple" is a string. = assigns, == compares. Don’t use string values in arithmetic. In traces, replace values the moment they are assigned. Logic errors need debugging — try/except cannot repair wrong formulas.
Source: LMS B2.1 Programming Fundamentals study notes; Outlook Python Strings Teaching Guide; SDL Exception Handling; ThemeB-2.1 questions; Mid-Term Set 2 HL MS Section B Q1–Q2; IB CS guide (FA 2027) B2.1 pp. 38.
B2.2Data structures
Static vs dynamic (B2.2.1)
| Feature | Static (e.g. array) | Dynamic (e.g. linked list, dynamic array) |
|---|---|---|
| Size | Fixed at creation | Grows/shrinks at runtime |
| Memory | Allocated up front; unused capacity wasted | Allocated on demand; links/references add overhead; fragmentation possible |
| Access | Direct index access — fast, predictable | May require traversal to reach an element |
| Resizing | New structure + copy | Automatic (dynamic arrays copy on growth) |
| Choose when | Data size known and stable (days of the week, class of 30) | Size unknown/changing (online users, playlist) |
Arrays and lists (B2.2.2)
| Operation | Java array | Java ArrayList | Python list |
|---|---|---|---|
| Size | arr.length | list.size() | len(lst) |
| Read element | arr[i] | list.get(i) | lst[i] (negative ok: lst[-1]) |
| Write element | arr[i] = v | list.set(i, v) | lst[i] = v |
| Add | — (fixed size) | list.add(v) / add(i, v) | append(v) / insert(i, v) |
| Remove | — | list.remove(i) | remove(v) / pop(i) |
| Traverse | for loop | for (T x : list) | for x in lst: |
1D = one index, a sequence; 2D = two indexes m[row][col] — first row, then column; nested loops traverse row-by-row. Java arrays are static; ArrayLists and Python lists are dynamic. Valid indexes run 0…length−1 — index 5 on a 5-element list is out of range.
Stacks — LIFO (B2.2.3)
Add and remove at the top only — last in, first out (stack of plates). Operations: push (add to top), pop (remove + return top), peek (read top without removing), isEmpty (check before popping — popping empty = underflow; pushing onto a full fixed stack = overflow). All four are typically O(1); storing n elements is O(n) space.
Queues — FIFO (B2.2.4)
Add at the rear, remove from the front — first in, first out (ticket counter). Operations: enqueue, dequeue, front (next element without removing), isEmpty. O(1) with a good implementation; a circular queue reuses vacated front slots. Classic scenario: a shared printer serves documents in arrival order — a stack would print the newest job first, which is wrong.
Choosing: undo/backtracking/nested brackets/reversal → stack. Arrival-order processing → queue (printers, CPU ready queue, packet buffers, breadth-first search). Ask: “must the most recent item be handled first (stack) or the oldest (queue)?”
Compare static vs dynamic for a scenario; construct add/remove/traverse code for a list; explain stack or queue operations with performance/memory impact; justify the right structure for a problem (undo history → stack; printer → queue). Stack/queue operations are O(1) — be ready to say why (single-end access, no traversal).
Index vs position (first element is index 0 in Python/Java). Java: .length for arrays, .size() for ArrayLists. 2D order is [row][col]. Overflow = push onto full; underflow = pop/dequeue from empty. LIFO vs FIFO mixed up is the classic one-mark loss.
Source: LMS B2.2 Data Structures study notes; Theme B 2.2 Data Structures student worksheet; IB CS guide (FA 2027) B2.2 pp. 38–39.
B2.3Programming constructs
Sequence (B2.3.1)
Instructions must run in dependency order — produce a value before using it. average = total/3 before total = m1+m2+m3 is wrong; so is printing before calculating. Sequence errors cause incorrect output, and in loops a missing update causes an infinite loop (count = count + 0 never progresses). In concurrent programs, inconsistent order of acquiring shared resources contributes to deadlock — request resources in a consistent order, release promptly.
Selection (B2.3.2)
if (act when true), if…else (one of two paths), if…else if…else (Java) / if…elif…else (Python) for many outcomes. Conditions use relational operators < <= > >= == != combined with AND (all true), OR (at least one), NOT (invert). Selection works with or without Boolean operators — a single comparison (temp > 30) or a bare Boolean variable (if isLoggedIn:) is enough.
Multi-branch order matters: check marks >= 90 before marks >= 60, or 95 wrongly matches the pass branch first. Nested selection puts a decision inside a decision — useful but keep depth low.
Iteration (B2.3.3)
| Loop type | Use when | Form | Example |
|---|---|---|---|
| Counted | Repetitions known | for | for i in range(1, 6) → 1…5 (6 excluded — off-by-one!) |
| Conditional | Repetitions unknown | while | while password != "secret": keep asking |
Conditions inside loops decide per-iteration behaviour: print only evens (if i % 2 == 0), filter positives, pass/fail each mark. Compound loop conditions: while age < 0 or age > 100: re-ask until valid — a standard input-validation pattern. Termination checklist: condition correct? something inside changes? change moves toward termination?
Functions and modularization (B2.3.4)
- Function = named reusable block: name, parameters (placeholders in the definition), body, optional return. Calling with actual values supplies arguments.
- Scope: local variables belong to the function; globals are visible more widely but risky — pass data through parameters instead of relying on globals.
- Modularization divides a program into modules with clear responsibilities (Student / Attendance / Results modules; Product / Cart / Payment in a shop).
- Benefits to quote: reusability, less duplication, easier maintenance (change one function, not the whole program), easier testing and debugging (isolate the faulty module), readability, parallel team development, reduced complexity — the programming face of decomposition.
Construct programs with correct sequence (grades: input → total → average → classify → display); selection with boundary marks; counted vs conditional loop choice with a reason; functions with parameters and return; modularization benefits. The Drill&Practice set and Mid-Term Set 2 both used nested loops over a 2D array (5 machines × 6 days) — practise writing the double loop.
= vs == in conditions. Boundary: pass at 50 means >= 50, not > 50. range(1, 6) excludes 6. Infinite loop = missing/wrong update of the loop variable. AND vs OR swaps produce loops that run too few or too many times. Update the variable the condition actually tests.
Source: LMS B2.3 Programming Constructs study notes; Drill&Practice B2.3.1–2.3.3 questions; 2.3.3 Exam-style questions; Mid-Term Set 2 HL MS Section B Q3; IB CS guide (FA 2027) B2.3 pp. 39.
B2.4Programming algorithmsB2.4.4–B2.4.5 HL
Big O notation (B2.4.1)
Big O describes how an algorithm’s required time/memory grows with input size n — not seconds on one machine. Time complexity = growth of operations; space complexity = growth of memory.
| Class | Name | Behaviour | At n = 16 (illustrative operations) | Example |
|---|---|---|---|---|
| O(1) | Constant | Independent of n | 1 | Array access by index |
| O(log n) | Logarithmic | Halves the problem each step | 4 | Binary search |
| O(n) | Linear | Proportional to n | 16 | Linear search |
| O(n log n) | Linearithmic | Between linear and quadratic | 64 | Merge sort / good quicksort |
| O(n²) | Quadratic | Double n → 4× work | 256 | Bubble/selection sort; nested loops |
| O(2ⁿ) | Exponential | Add one item → double work | 65,536 | Exhaustive subsets; naive recursion |
Calculation rules: sequential loops add (n + n = 2n → O(n)); nested loops multiply (n × n → O(n²)); drop constants (O(5n) = O(n)) and keep the dominant term (n² + n + 10 → O(n²); O(log n) + O(n) → O(n)). Analyse best / average / worst case — introductory Big O usually means worst case. Choice depends on input size, time needs, memory limits and expected growth — the lowest Big O is not automatically best if memory or complexity costs too much (time–space trade-off).
Linear and binary search (B2.4.2)
Linear: check items one by one from the start until found or end reached. Works on any data. Best O(1) (first item), average/worst O(n). Trace: find 19 in [12, 7, 25, 19, 31] → checks 12, 7, 25, 19 → found at position 4 (4 comparisons).
Binary: data must be sorted. Compare the middle value; equal → found; target smaller → discard the upper half; larger → discard the lower half; repeat on what remains. Always update the bounds — the classic bug is forgetting to move low/high.
| Step | low | high | mid | Value at mid | Action |
|---|---|---|---|---|---|
| 1 | 0 | 8 | 4 | 21 | 31 > 21 → low = 5 |
| 2 | 5 | 8 | 6 | 31 | found — 2 comparisons |
Searching [3, 8, 12, 17, 21, 26, 31, 35, 40] for 31 takes 2 comparisons; a linear search could take 7. Halving scales: 1,024 items ≈ 10 comparisons; 1,048,576 ≈ 20 (2¹⁰ = 1,024, 2²⁰ ≈ 10⁶).
| Feature | Linear search | Binary search |
|---|---|---|
| Data requirement | Sorted or unsorted | Must be sorted |
| Best / average / worst | O(1) / O(n) / O(n) | O(1) / O(log n) / O(log n) |
| Choose when | Small or unsorted data; few searches; data changes often | Large sorted data; many searches; fast retrieval matters |
Directory example from the syllabus: names sorted alphabetically → binary search by name is fast; searching by phone number in a name-sorted list cannot use that order — you need a second index or a linear scan. The search key must match the ordering.
Bubble and selection sort (B2.4.3)
Bubble: repeatedly compare adjacent pairs, swap if out of order — large values “bubble” to the end; sorted region grows from the end. Selection: find the smallest remaining element, swap it into the next open position — sorted region grows from the start.
| Pass | Bubble on [5, 2, 8, 1, 3] | Selection on [5, 2, 8, 1, 3] |
|---|---|---|
| 1 | [2, 5, 8, 1, 3] → [2, 5, 1, 8, 3] → [2, 5, 1, 3, 8] | min = 1 → swap with 5 → [1, 2, 8, 5, 3] |
| 2 | [2, 1, 3, 5, 8] | min of [2, 8, 5, 3] = 2 → in place → [1, 2, 8, 5, 3] |
| 3 | [1, 2, 3, 5, 8] sorted | min of [8, 5, 3] = 3 → [1, 2, 3, 5, 8] |
| 4 | — | min of [5, 8] = 5 → [1, 2, 3, 5, 8] |
| Algorithm | Best | Average | Worst | Space | Swaps |
|---|---|---|---|---|---|
| Bubble (with early-stop check) | O(n) — one clean pass detects sorted data | O(n²) | O(n²) | O(1) in place | Many |
| Selection | O(n²) — must still scan for the minimum each pass | O(n²) | O(n²) | O(1) in place | Few — one swap per pass |
Trade-offs across data sets: already/nearly sorted → bubble with early stopping wins; reverse sorted → bubble does many swaps, selection does fewer; very large data → neither — O(n²) does not scale; both are simple to construct and trace, which is why the syllabus keeps them.
Recursion — HL only (B2.4.4, B2.4.5)
A recursive function calls itself on a smaller version of the problem. Two mandatory parts: a base case (answered without another call — stops the process) and a recursive case (calls itself with input that moves toward the base case).
factorial(n): if n == 0 return 1; else return n × factorial(n−1). Trace factorial(4): calls go down 4→3→2→1→0; then results return up: f(0)=1 → f(1)=1 → f(2)=2 → f(3)=6 → f(4)=24. “Call down, stop, return up.” Every pending call sits on the call stack — deep recursion consumes memory and can trigger stack overflow; a missing or unreachable base case means infinite recursion. Some naive recursions (e.g. naive Fibonacci) recompute the same sub-problems — memoization caches results.
Non-branching is the examinable form (guide wording: “simple, non-branching recursive algorithms”): exactly one recursive call per execution — countdown, factorial, sum(n) = n + sum(n−1) with base sum(0)=0. Branching recursion (two calls, like Fibonacci) is not required for construction.
Where recursion suits: problems with self-similar sub-problems — quicksort (divide and conquer; base case: sub-lists of 0 or 1 elements are already sorted; average O(n log n), worst O(n²) with bad pivots), mergesort, binary tree traversal (subtrees are smaller trees), fractal generation, backtracking. Advantages: elegant, short, natural for hierarchical structure. Limitations: memory (call stack), overhead, harder tracing, repeated work without memoization. Iteration (loops) often does simple repetition with less memory — recursion is a tool, not a default.
Calculate Big O of given code (loops nested vs sequential); construct + trace both searches (Mid-Term Set 2: 5-mark binary search construction + 2-mark O(log n) justification); trace sorts pass-by-pass; HL: state the base case, trace a factorial-style function fully up and down, and explain why a base case is needed (stack overflow). Justify algorithm choice by data size and sortedness.
Binary search on unsorted data is invalid — sort first or use linear. Update low/high every comparison. Bubble sort’s O(n) best case requires the early-stop optimisation — say so. Selection sort stays O(n²) even on sorted input. Recursion: base case reachable (n−1 toward 0, not n+1), use the recursive call’s returned value, and when tracing, don’t stop at the deepest call — carry results back up.
Source: LMS B2.4 Programming Algorithms study notes; Recursion Student Worksheet HL; Search Questions set; Mid-Term Set 2 HL MS Section B Q4; IB CS guide (FA 2027) B2.4 pp. 39–40 (B2.4.4–B2.4.5 HL only).
B2.5File processing
Modes and the golden pattern (B2.5.1)
Variables die when a program ends; text files (.txt, .csv, .log) persist data between runs. A sequential file is processed in order from beginning to end, record by record. The pattern: OPEN → PROCESS → CLOSE.
| Mode | Python | Effect on existing data | Use |
|---|---|---|---|
| Read | open("f.txt", "r") | Kept | Retrieve records |
| Write | open("f.txt", "w") | Replaced/erased | Create a new file or overwrite |
| Append | open("f.txt", "a") | Kept — adds to the end | Add records without losing old ones |
Python toolkit: open(), read() (whole file), readline() (one line — perfect when each line is a record), write(), close(). write() does not add newlines itself — include \n when records must sit on separate lines. Java toolkit: Scanner (nextLine(), hasNext()), BufferedReader (readLine()), FileWriter (write; append mode to preserve).
Worked pseudocode — read marks and append the average:
file = open("marks.txt", "r")→total = 0,count = 0while file has next line→mark = readline as number→total = total + mark→count = count + 1close file→average = total / countout = open("results.txt", "a")→write average + "\n"→close out
Closing releases resources and helps ensure data is actually saved; pair every open with a close.
Construct a program that counts lines/records, writes a report, or appends a new record — the ThemeB 2.5 question set does exactly this. Name the correct mode with a reason (that is often a separate mark). Know both the Python functions and Java classes listed in the guide.
Adding data with write mode destroys the existing contents — append instead. Forgetting close(). Forgetting \n — records gluing together (AaravMeeraRohan). Using read() when the question processes records — readline() keeps the sequence per record.
Source: LMS B2.5 File Processing study notes; ThemeB-2.5 File-programming questions; IB CS guide (FA 2027) B2.5 p. 40 (Python functions; Java Scanner/FileWriter/BufferedReader).
Toolkit — cross-topic tools
No separate syllabus “frameworks” in CS — these are the skills examined inside their topics. One line each; open the linked topic for the full treatment.
Open the tool list
- Trace table — step/iteration rows × variable columns; the universal tool for programs, flowcharts, sorts and recursion (B1.1, B2.1).
- Truth table — 2ⁿ rows, intermediate column per gate (A1.2).
- Karnaugh map — group adjacent 1s to simplify Boolean expressions (A1.2).
- Flowchart symbols — oval start/end, rectangle process, diamond decision, parallelogram I/O, arrow flowline, circle connector (B1.1).
- Base conversion — powers-of-2 addition; ÷2 remainders bottom-up; 4-bit grouping for hex (A1.2, quick-reference below).
- Size formulas — image: width × height × colour depth; audio: rate × depth × channels × seconds (A1.2).
- RLE encoding — value + count per run; only worth it on long runs (A1.1).
- Big O analysis — add sequential loops, multiply nested, drop constants, keep the dominant term (B2.4).
- Scheduling timelines — Gantt-style bars per process to compare FCFS/RR (A1.3).
Cross-checked against the CS_HL_HYE_Checklist footer: truth tables, K-maps, flowchart symbols, trace tables and Big O are examined inside their topics — no separate tools section in the official scope.
Quick-reference sheet — final revision
| Dec | Bin | Hex | Dec | Bin | Hex |
|---|---|---|---|---|---|
| 0 | 0000 | 0 | 8 | 1000 | 8 |
| 1 | 0001 | 1 | 9 | 1001 | 9 |
| 2 | 0010 | 2 | 10 | 1010 | A |
| 3 | 0011 | 3 | 11 | 1011 | B |
| 4 | 0100 | 4 | 12 | 1100 | C |
| 5 | 0101 | 5 | 13 | 1101 | D |
| 6 | 0110 | 6 | 14 | 1110 | E |
| 7 | 0111 | 7 | 15 | 1111 | F |
Powers of 2: 2⁴=16 · 2⁸=256 · 2¹⁰=1,024 · 2¹⁶=65,536. n bits → 2ⁿ patterns. 1 byte = 8 bits.
ASCII anchors: 'A' = 65 · 'a' = 97 · '0' = 48.
Sizes: image bits = w × h × depth; bytes = ÷8. Audio bits/s = rate × depth × channels.
Registers: IR current · PC next address · MAR address accessed · MDR in transit · AC results.
Buses: address WHERE (one-way) · data WHAT (two-way) · control ACTION.
Boolean: · AND · + OR · ¬ NOT · ⊕ XOR. De Morgan: NOT crosses brackets, AND↔OR.
Complexities
- Array index access, push/pop/peek, enqueue/dequeue — O(1)
- Linear search — O(n) avg/worst · Binary search — O(log n), sorted only
- Bubble — O(n²) avg/worst, O(n) best with early stop, O(1) space
- Selection — O(n²) always, O(1) space, few swaps
- Quicksort — O(n log n) avg, O(n²) worst (bad pivots)
Stack LIFO push/pop top · Queue FIFO enqueue rear / dequeue front.
Deadlock = M-H-N-C: mutual exclusion, hold-and-wait, no pre-emption, circular wait.
Files: read keeps · write replaces · append adds — OPEN → PROCESS → CLOSE.
Compiled from the LMS study notes and school markschemes cited per topic above.
Sources & how this was built
- Official scope: Grade 11 HYE Syllabus Focus (Final) 2026–27 and HYE Timetable G11 2026–27 — Outlook mails from Kingsley C (IBDP coordinator), 6 Nov 2026, reconfirmed 27 Nov 2026. CS HL row: Wed 16 Dec, 12:15–14:15, 2 hr, one paper, max 80 marks.
- Subject guide: IB Computer science guide (first assessment 2027) —
Computer Science HL/Direct_Resources/Core_computer-science-guide-en_FA 2027.pdf. Used for: syllabus content A1 (pp. 27–30), B1–B2 (pp. 37–40), HL assessment outline (pp. 46–50), assessment objectives (pp. 22–23), command terms (pp. 59–60). - LMS study notes (Indus shared resources, mirrored in the repo): A1.1 Computer fundamentals; A1.2 Data representation and computer logic; A1.3 Operating systems–Control systems; A1.4 Translators (all
Computer Architecture/Study-Notes/); B1 Computational Thinking (Theme B Computational Thinking/); B2.1–B2.5 (Theme B Programming Fundamentals/). - School assessment evidence: A1 Formative Assessment HL + SL markschemes (root); Mid-Term Examination Set 2 Marking Scheme HL (Oct 2026) — source of the marking conventions and question patterns quoted in the playbook.
- Teaching materials: CLM Scheduling, Polling & Interrupts PPT (A1.3.3–A1.3.4); OS Lesson 1 PPT, Week 6 (A1.3.1–A1.3.2); Revision-practice – A1 topics (registers, FDE, compression, pipelining, number conversions, logic drills); Python Strings Teaching Guide; SDL Exception Handling; Recursion Student Worksheet HL; Search Questions; Algorithm-tracing page; Theme A/B worksheets; B1 Revision QP-1; ThemeB-2.1 and 2.5 question sets.
- Existing workspace guide:
Computer Science HL/Agent_Workspace/A1_Formative_Study_Guide.html— checked for coverage overlap; this page replaces it for HYE revision with the full A1+B scope.
The induslms-academics MCP server (LMS list_resources / schoolmail_search) was not connected in this session, so no live LMS listing or mail search was possible. All LMS/Outlook content above is the locally mirrored set listed in Computer Science HL/Direct_Resources/INDEX.md. If the teacher has shared anything after 27 Nov 2026 (paper structure, extra practice), it is not reflected here.
This page follows the school HYE focus sheet exactly — HL-only points are included and labelled, and nothing outside A1/B1/B2 is taught as required. If Anitha confirms a different section split, a case-study element, or a language restriction (Python-only / Java-only), adjust the format section; the topic content stands either way.