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

Wed 16 Dec 2026 / 12:15–14:15 / 2 hr / one paper / max 80 marks

School HYE — single paper over Theme A + Theme B topics · guide is CS (first assessment 2027)

Type to search every topic, or use the index below. Press / to focus.

[ index ] [ quick-reference ] [ checklist ]

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).

ComponentOfficial IB HL (final exam)This school HYE
PapersP1 (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 formatP1 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 contentP1 Section A — extended response, SL + HL topics (56 marks)In scope: A1 only (A1.1–A1.4)
Case studyP1 Section B — pre-seen case study (24 marks)Not used — no case study has been issued for the HYE
Theme B contentP2 — extended response, Python or Java versions (80 marks)In scope: B1.1 + B2.1–B2.5
AO weighting (P1/P2)≈ 50% AO1+AO2 / 50% AO3Expect 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
Timing

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.

Paper personality

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.

Format caveat — confirm with Anitha

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
AO1 — KnowledgeDefine, label, list, state. Accurate terms, no development needed.
AO2 — Apply & useCalculate, describe, distinguish, estimate, identify, outline, trace. Use a given situation and follow an algorithm accurately.
AO3 — Construct, analyse, evaluateCompare, construct, deduce, discuss, evaluate, explain, justify, sketch, suggest, to what extent. Build something or weigh it and judge.
AO4 — Real-world CTAssessed only in the IA. P1/P2 scenario questions are AO1–AO3.

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 termAOWhat to doWatch out
State / label / list1Brief answer, name or value. No explanation.
Identify2Provide an answer from a number of possibilities.School MS: “no explanation required unless requested” — don’t waste time.
Define1Precise meaning of a term.One crisp sentence; qualifiers earn the second mark.
Describe2Detailed account of features.More depth than outline; still no reasons needed.
Outline2Brief account or summary.Shorter than describe.
Distinguish2Make the differences clear.Both items, side by side.
Calculate / estimate2Numerical answer showing relevant stages.Show the substitution — method mark lives there.
Trace2Follow and record the actions of an algorithm.Record every step, not just the final output.
Explain3Detailed account including reasons or causes.Chain statements: how/why, linked.
Compare3Similarities and/or differences, referring to both throughout.Don’t write two separate descriptions.
Construct3Display information in diagrammatic or logical form.Logically equivalent solutions accepted; minor syntax slips not penalised.
Deduce3Reach a conclusion from the information given.Use the data in the question.
Evaluate / discuss / to what extent3Weigh strengths and limitations; balanced review + supported conclusion.Criteria first, both sides, judgement last.
Justify / suggest3Valid reasons or a proposed solution.Tie reasons to the scenario.
Sketch3Diagram or graph with the right shape and labelled features.Label axes and key points.
From the school marking schemes

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 / marksStructureCheck before moving on
2 — definePrecise meaning + one qualifier (volatile? parallel? feedback?).No story, no example needed.
2 — state / identifyOne line per mark. Two marks = two separate points.No development.
2–4 — describe / outlineFeature list in order; one developed feature per mark.Match depth to marks: outline < describe.
2–4 — explainPoint → because/so that → consequence. One chain per 2 marks.Each chain reaches a system outcome (performance, reliability, response time).
2–4 — compare / distinguishOne table-style line per feature, both items in every line.“X is fast whereas Y is slow” — never one-sided.
4–6 — evaluate / discussCriteria → strengths → limitations → judgement with a condition.Both sides + a decision. No fence-sitting conclusion.
2–3 — calculateFormula → 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)

  1. Read inputs, outputs and the exact task (return index? -1 if absent? first occurrence?).
  2. Choose the structure: loop type, selection, data structure, function boundary.
  3. Write pseudocode in the conventions below — or Python/Java if the question names a language.
  4. 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):

ConstructPseudocodePythonJava
Output / inputoutput X / input Xprint(x) / x = input()System.out.println(x); / Scanner
Assignmentx = 5x = 5x = 5;
Comparisonx == 5x == 5x == 5
Selectionif c then … else … end ifif / elif / elseif / else if / else
Counted loopfor i = 1 to n … end forfor i in range(1, n+1):for (int i = 1; i <= n; i++)
Conditional loopwhile c … end whilewhile c:while (c) {…}
Functionfunction f(a, b) … return r end functiondef f(a, b): … return rstatic int f(int a, int b) {…}
Array / list accessX[i] — IB style is often 1-basedx[i] — 0-basedx[i] — 0-based
Read from fileopen … read … closeopen() / readline() / close()Scanner / BufferedReader
Indexing trap

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/high after 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).
CPU components and the three buses to memory CPU CONTROL UNIT decodes IR · signals ALU calculate · compare · logic REGISTERS PC — next instr address IR — current instruction MAR — address accessed MDR — data in transit AC — results ADDRESS BUS — where DATA BUS — what (both ways) CONTROL BUS — what action MAIN MEMORY instructions + data held at numbered addresses
Every fetch moves an address out on the address bus and brings the instruction back through the MDR. The control bus says read or write.

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.

Fetch decode execute cycle 1 FETCH PC → MAR → address bus → memory → data bus → MDR → IR 2 DECODE CU interprets the IR — what operation? what data? 3 EXECUTE ALU / memory / branch — result to AC or memory repeat for the next instruction (PC already updated)
Worked example — LOAD 500: fetch the instruction; decode “LOAD from address 500”; execute by reading address 500 (address bus + read signal) and receiving the value back through the MDR.

Primary memory (A1.1.4)

TypePurposeKey facts
RegistersValues being processed right nowFastest, smallest, inside the CPU
Cache L1/L2/L3Frequently/recently used instructions + dataL1 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.
RAMWorking memory for running programs + dataVolatile — contents lost when power is removed
ROMFirmware / start-up instructionsNon-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.

TimeInstr 1Instr 2Instr 3Instr 4
1Fetch–––
2DecodeFetch––
3ExecuteDecodeFetch–
4Write-backExecuteDecodeFetch
5–Write-backExecuteDecode
6––Write-backExecute
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.

FeatureCPUGPU
Design philosophyGeneral-purpose flexibilityMassive parallelism for data-heavy work
CoresFew, powerful, complexMany, simpler
Processing styleSequential + branching decisionsRepetitive, independent, parallel
Memory priorityLow latency (large caches)High bandwidth / throughput
Power efficiencyGood for general workStrong per-watt on parallel tasks; workload dependent
Typical roleOS, control flow, game logicRendering, 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)

DeviceInternal / externalBest scenario
SSDInternalFast boot/app loading, shock resistance (no moving parts)
HDDInternalLarge capacity, lower cost per GB (magnetic platters, moving parts)
eMMCInternalBudget laptops/tablets/phones — compact, soldered flash
External SSD / HDDExternalBackups, transfer, archives (SSD = speed, HDD = capacity)
Optical driveExternalCD/DVD/Blu-ray archives and legacy media
Flash drive / memory cardExternalPortable transfer, cameras and small devices
NASExternal (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)

ServiceYou getYou manageScenario
SaaSComplete application via browser/appAccount + data onlyEmail, online documents
PaaSPlatform + tools to build, test, deployYour application codeDeveloping a web app without managing servers
IaaSVirtual machines, storage, networkingOS, applications, configurationCustom 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.

Exam application

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).

Traps

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.

ConversionMethodWorked example
Binary → decimalMultiply each 1 by its power of 2, add10110110 = 128+32+16+4+2 = 182
Decimal → binaryRepeated ÷ 2, read remainders bottom→top45 → 101101
Hex → decimalMultiply digits by powers of 16, add2A = 2×16 + 10 = 42
Decimal → hexRepeated ÷ 16, remainders bottom→top42 → 2A
Binary → hexGroup in 4s from the right (pad left with 0s), convert each group1011 0110 → B6
Hex → binaryEach digit → its 4-bit patternC7 → 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)

GateOutput is 1 when…RememberTypical use
ANDall inputs are 1ALLMultiple conditions must hold
ORat least one input is 1ANYAlternative triggers
NOTinput is 0 (reverses)OPPOSITEInverting a condition
NANDinputs are not both 1NOT-ANDUniversal gate
NORall inputs are 0NOT-ORUniversal gate
XORinputs are differentDIFFERENT → 1Adders, comparison, error detection
XNORinputs are the sameSAME → 1Equality 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.

ABANDORNANDNORXORXNOR
00001101
01011010
10011010
11110001

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 diagram for Q = (A AND B) OR C A B C AND X = A·B OR Q = X + C Q = (A AND B) OR C — read left to right; give intermediate signals names
Three inputs, two gates, one intermediate signal. The truth table for this circuit needs 8 rows and an X column before the Q column.

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.

Exam application

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.

Traps

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.

FunctionWhat it doesThink of it as
System integrityKeeps background operations stable; stops processes interfering“Is the system still healthy?”
Memory managementAllocates/tracks/protects RAM; frees memory when processes end“Who gets RAM?”
File systemCreates, stores, locates, protects files and folders“Where do files live?”
Device managementCommunicates with hardware, usually via device drivers“How does software reach hardware?”
SchedulingAllocates CPU time among processes“Who gets CPU time?”
SecurityAuthentication (passwords, biometrics), permissions, process isolation“Who is allowed what?”
AccountingRecords resource usage per user/process“Who used what?”
GUIVisual interaction — windows, icons, menus, pointer“How does the user interact?”
VirtualizationVirtual machines sharing one physical machine“Many computers in one?”
NetworkingManages 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.

ApproachRuleStrengthMain issueSuits
FCFSArrival order; runs to completion/blockSimple, fair by arrivalConvoy effect — one long job delays many short ones; poor interactive responseSimple batch work
Round robinFixed time quantum each turn, then back of queueFair turns; good responseContext-switching overhead; quantum choice matters (too small → overhead, too large → behaves like FCFS)Interactive systems
Multilevel queueProcesses split into queues (system/interactive/background), each with its own policyTreats process types differentlyComplex; low queues can be starvedSystems with clear process classes
PriorityHighest priority firstCritical tasks run soonStarvation of low-priority processes — fix with aging (priority rises with waiting time)Time-critical workloads
FCFS vs Round Robin timeline FCFS — arrivals P1, P2, P3 (bursts 8, 4, 12) P1 (0–8) P2 (8–12) P3 (12–24) 0 8 12 24 ROUND ROBIN — quantum q = 4 P1 0–4 P2 4–8 P3 8–12 P1 12–16 P3 16–24 0 4 8 12 16 24 RR: every process gets first CPU time sooner — response ↑, but switching overhead ↑
Same three processes, two rules. FCFS finishes P1 first but P3 waits 12 before starting; Round Robin lets P2 and P3 start within one quantum each — responsiveness traded for switching overhead.

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.

FactorPollingInterrupts
Event frequencyWorks when events are frequent (checks rarely wasted)Very frequent events → handling overhead stacks up
CPU overheadWasted checks when nothing happensNo wasted checks, but each handler costs save/restore work
Power sourceKeeps CPU active — bad for battery devicesCPU can idle in low-power states and wake on signal
PredictabilityKnown check intervals — predictableAsynchronous timing
LatencyWaits for next checkFast response; can still delay under heavy load or masked interrupts
SecurityCentrally controlled checksUncontrolled 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.

ComponentRoleExample
ControllerDecision-makerCompares 22°C target with measured temperature
SensorDetects a physical conditionTemperature, motion, moisture, light sensor
ActuatorProduces the physical actionHeater, motor, valve, brake
TransducerConverts one energy form ↔ anotherMicrophone (sound→signal), speaker, motor
Control algorithmRules deciding the responseIF temp < 22 THEN heater ON
FeedbackReports the actual state/outputMeasured temperature returned to controller
Closed-loop control system INPUT desired 22°C CONTROLLER control algorithm ACTUATOR heater ON PROCESS room warms → OUTPUT 22°C FEEDBACK — sensor measures actual temperature controller: IF measured ≥ 22 THEN heater OFF (closed loop)
Sense → decide → act → check. The feedback path is what makes it closed-loop: the output influences the next decision.

Real-world control systems — HL only (A1.3.7)

ApplicationSensors / inputsActuators / outputs
Autonomous vehicleCameras, radar, lidar, positioningSteering, brakes, motor
Home thermostatTemperature sensorHeater / cooler
Elevator controllerFloor requests, position, door sensorsMotor, brakes, doors
Washing machineWater level, temperature, doorValves, heater, drum motor
Traffic signalsVehicle sensors, pedestrian buttons, timersSignal lamps (fixed timer = open-loop)
IrrigationSoil moisturePump / valve
Home securityMotion, door/window, glass-breakAlarm, notification
Automatic doorsProximity / motionDoor motor

Limits to mention in evaluations: sensor errors → wrong decisions, algorithm errors, hardware failure, security risks for connected systems, power dependence.

Exam application

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.

Traps

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.

FactorInterpreterCompiler
Translation timingDuring execution, statement by statementOnce, before execution (build step)
Error detectionAt execution, when the failing line runs; unexecuted code may hide errorsMany errors caught before the program ever runs
Execution performanceRuntime translation overhead — slowerFast; compiler can optimise
PortabilitySource runs anywhere a suitable interpreter existsOutput can be platform-specific (per processor/OS)
Development loopWrite → run → fix, no build — rapid testingEdit → compile → test; compile time cost
DistributionNeeds the interpreter on the target machineShip 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.

ScenarioBetter fitWhy
Rapid development and testingInterpreterImmediate 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/LinuxBytecode + per-platform runtimeOne intermediate form, each OS supplies a runtime
Exam application — evaluate

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…”)..

Traps

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:

PartQuestion it answersSchool attendance example
Problem statementWhat is wrong, for whom?Manual attendance is slow and error-prone
Constraints & limitationsWhat restrictions apply?Existing computers only; only teachers may edit; data protected; fixed deadline
Objectives & goalsWhat should the solution achieve?Fast recording, fewer errors, automatic percentages
Input specificationsWhat data enters, in what form?Student ID (must exist), date, Present/Absent
Output specificationsWhat is produced?Daily lists, per-student %, monthly report
Evaluation criteriaHow is success measured?“Record displayed within 2 s” — specific and testable, not “fast”

The four fundamental concepts (B1.1.2)

ConceptMeaningExample
AbstractionKeep only relevant information; hide the restNavigation app keeps roads + distances, drops building colours
Algorithmic designClear, ordered, terminating stepsFind-largest-of-three procedure
DecompositionBreak one big problem into manageable sub-problemsOnline shop → accounts, search, cart, payment, delivery
Pattern recognitionSpot similarities, repetitions, relationshipsWeekday 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)

SymbolShapePurpose
Start/EndOvalWhere execution begins / finishes
ProcessRectangleCalculation, assignment, variable update
DecisionDiamondCondition with Yes/No branches — follow only one
Input/OutputParallelogramReceive data / display results
FlowlineArrowDirection of control — follow arrows, not reading order
ConnectorSmall circleFlow 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.

StepOperationxConditionOutput
Startx = 11——
1output x; x = x + 21 → 3x < 6 → True1
2output x; x = x + 23 → 5x < 6 → True3
3output x; x = x + 25 → 7x < 6 → False5
End—7loop exits1, 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.

Exam application

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.

Traps

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)

TypeStoresExample
BooleanTrue / FalsehasPassed = True
charOne charactergrade = 'A'
integerWhole numberage = 17
decimalFractional numberaverage = 82.5
stringCharacter sequencename = "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("@") → split [email protected] into username email[:pos] and domain email[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).

BlockJavaPythonRole
Risky codetry { }try:Code that may raise an exception
Handlercatch (ExceptionType e) { }except ExceptionType:Respond with a meaningful message / recovery
Cleanupfinally { }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)

TechniqueWhat it doesBest for
Trace tableRecords variable values per step/iterationLoops and repeated updates; finding where a value first goes wrong
BreakpointPauses execution at a chosen line; inspect stateLong programs; inspecting values at a suspicious point
Print statementsTemporarily display values/flow markersQuick checks; which branch executed
Step-by-step executionOne 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.

Exam application

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.

Traps

'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)

FeatureStatic (e.g. array)Dynamic (e.g. linked list, dynamic array)
SizeFixed at creationGrows/shrinks at runtime
MemoryAllocated up front; unused capacity wastedAllocated on demand; links/references add overhead; fragmentation possible
AccessDirect index access — fast, predictableMay require traversal to reach an element
ResizingNew structure + copyAutomatic (dynamic arrays copy on growth)
Choose whenData size known and stable (days of the week, class of 30)Size unknown/changing (online users, playlist)

Arrays and lists (B2.2.2)

OperationJava arrayJava ArrayListPython list
Sizearr.lengthlist.size()len(lst)
Read elementarr[i]list.get(i)lst[i] (negative ok: lst[-1])
Write elementarr[i] = vlist.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)
Traversefor loopfor (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.

Stack vs queue STACK — LIFO 10 20 30 40 (top) push 40 → top · pop 40 ← top · peek reads 40 only the top is touched — O(1) operations QUEUE — FIFO 10 20 30 40 dequeue 10 ← front enqueue 50 → rear enter at the rear, leave from the front — printer jobs, process ready-queues, buffers
Stack: one door, so the newest item leaves first. Queue: two doors, so the oldest item leaves first. Both give O(1) add/remove and O(n) storage for n items.

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)?”

Exam application

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).

Traps

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 typeUse whenFormExample
CountedRepetitions knownforfor i in range(1, 6) → 1…5 (6 excluded — off-by-one!)
ConditionalRepetitions unknownwhilewhile 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.
Exam application

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.

Traps

= 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.

ClassNameBehaviourAt n = 16 (illustrative operations)Example
O(1)ConstantIndependent of n1Array access by index
O(log n)LogarithmicHalves the problem each step4Binary search
O(n)LinearProportional to n16Linear search
O(n log n)LinearithmicBetween linear and quadratic64Merge sort / good quicksort
O(n²)QuadraticDouble n → 4× work256Bubble/selection sort; nested loops
O(2ⁿ)ExponentialAdd one item → double work65,536Exhaustive subsets; naive recursion
Big O growth curves operations input size n (1 → 16) 0 ≈280 ops n² = 256 O(1) O(log n) O(n) O(n²) O(2ⁿ) is off the chart: 2¹⁶ = 65,536 — grows unusably fast
Lower curves scale better. At small n everything is fine; the gaps explode as n grows — that is why scalability drives algorithm choice.

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.

SteplowhighmidValue at midAction
10842131 > 21 → low = 5
258631found — 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⁶).

Binary search decision tree mid = 21 range [3 … 40] target < 21 → left half [3…17] 31 > 21 → search right mid = 31 range [26 … 40] 31 == target → FOUND 2 comparisons total Each comparison removes half the remaining items — that is why the tree is shallow and the growth is O(log n).
The pruned left branch never gets searched. Only the shaded path is executed: 21 → 31 → found.
FeatureLinear searchBinary search
Data requirementSorted or unsortedMust be sorted
Best / average / worstO(1) / O(n) / O(n)O(1) / O(log n) / O(log n)
Choose whenSmall or unsorted data; few searches; data changes oftenLarge 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.

PassBubble 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] sortedmin of [8, 5, 3] = 3 → [1, 2, 3, 5, 8]
4—min of [5, 8] = 5 → [1, 2, 3, 5, 8]
AlgorithmBestAverageWorstSpaceSwaps
Bubble (with early-stop check)O(n) — one clean pass detects sorted dataO(n²)O(n²)O(1) in placeMany
SelectionO(n²) — must still scan for the minimum each passO(n²)O(n²)O(1) in placeFew — 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.

Exam application

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.

Traps

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.

ModePythonEffect on existing dataUse
Readopen("f.txt", "r")KeptRetrieve records
Writeopen("f.txt", "w")Replaced/erasedCreate a new file or overwrite
Appendopen("f.txt", "a")Kept — adds to the endAdd 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 = 0
  • while file has next line → mark = readline as number → total = total + mark → count = count + 1
  • close file → average = total / count
  • out = 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.

Exam application

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.

Traps

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

DecBinHexDecBinHex
000000810008
100011910019
200102101010A
300113111011B
401004121100C
501015131101D
601106141110E
701117151111F

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

Acquisition note

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.

Scope warning

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.

↑ index