IB Computer Science 2027Notes, practice and exam help for Paper 1, Paper 2 and the IA

Ace the new IB Computer Science

Built for the course examined from May 2027: Theme A concepts, Theme B with Python code examples, the computational solution (IA) and the pre-seen case study. Check off topics, self-mark the practice questions, and watch your progress climb.

Start with A1 →
–days to 1 May 2027 (exams are in May)
0/0sections completed
0practice questions answered
0flagged to review

Jump to a section

How the course is assessed

Start here: how the course is assessed and how to use this site.

ComponentSLHLWhat it tests
Paper 11 h 15 min · 35% · Section A 38 marks + Section B 12 marks2 h · 40% · Section A 56 marks + Section B 24 marksTheme A (A1–A4) + the pre-seen case study
Paper 21 h 15 min · 35%2 h · 40%Theme B (B1–B4), in Python or Java (your school chooses one). Some questions ban built-ins.
Internal Assessment30% · 30 marks20% · 30 marksThe computational solution: 35 hours, ≤2,000 words, mandatory video (max 5 minutes)
How the course is assessed — SL and HLSLPaper 1 · Theme A + case study· 1 h 1535%Paper 2 · Theme B in Python · 1h 1535%IA30%HLPaper 1 · Theme A + case study · 2 h40%Paper 2 · Theme B + ADTs · 2 h40%IA20%Paper 1 Section A = extended-response questions on A1–A4 (SL 38 / HL 56 marks)Paper 1 Section B = the pre-seen case study (SL 12 / HL 24 marks)Paper 2 = B1–B4; some questions ban built-ins; two SL questions reappear on HLHL only: A1.4 translation · A3.4 alternative databases · A4.2–A4.3 preprocessing & ML approaches · B2.4 recursion ·B3.2 multiple classes · B4 ADTsDigital exams are available from November 2026; paper and digital run in parallel through 2027–2029. Do mocks in your mode.

Paper 1 covers Theme A (how computing systems work) plus Section B on the pre-seen case study, which is now compulsory for SL as well as HL. Paper 2 covers Theme B (computational thinking, programming, OOP and, for HL, abstract data types) and has separate Python and Java versions (your school chooses one); the code on this site is in Python. The IA is a 35-hour project you control from start to finish.

The 2027 case study

The May and November 2027 case study is titled “Generative AI for image creation — a diffuse vision”. Your teacher will give you the official document from the IB Programme Resource Centre. Start your glossary the week you receive it: see the Case Study page.

How to use this site

  • Each topic page has: what the syllabus expects (with HL-only content flagged), the key ideas in one screen, websites and videos that explain it well, exam tips specific to that topic, and practice questions with mark-scheme notes.
  • Use the Exam Technique page before every test — most lost marks come from answering the wrong command term, not from missing knowledge.
  • Use the IA page from Year 1 Term 3 onwards. Keep the development log every week; it cannot be reconstructed later.
  • Try practice questions on paper, to time (about 1.5 minutes per mark), before looking at the answer notes.

Your two-year route through the course

WhenUnitsMilestone
Y1 Term 1A1 Computer fundamentals · B1 Computational thinkingDiagnostic test; begin thinking about IA ideas
Y1 Term 1–2B2 Programming fundamentalsPython proficiency checkpoint
Y1 Term 2A2 NetworksUnit test
Y1 Term 2–3A3 Databases (HL adds A3.4)SQL practical assessment
Y1 Term 3B3 Object-oriented programming (HL adds B3.2)OOP mini-project; IA Criterion A draft
Y2 Term 1A4 Machine learning (HL adds A4.2–A4.3) · B4 ADTs (HL only)IA Criteria B–D; HL ADT test
Y2 Term 2Case study study period; IA final submissionCase study glossary complete
Y2 Term 3Revision and mocksFull papers to time, in your exam mode (paper or digital)

General resources

A1 · Computer fundamentals

Paper 1 · SL 11 hours / HL 18 hours · Hardware, data representation, logic, operating systems and (HL) translation.

What the syllabus expects

CodeTopicSLHL extra
A1.1Computer hardware and operation: CPU components, buses, fetch–decode–execute, memory hierarchy, secondary storage, compression, cloud services✔CPU vs GPU comparison, pipelining in multi-core systems
A1.2Data representation and computer logic: binary/hex/two's complement, how binary stores text, images and sound, logic gates, truth tables, logic diagrams✔—
A1.3Operating systems and control systems: role and functions of the OS, scheduling, polling vs interrupts✔Multitasking, deadlock, control systems (sensor → controller → actuator)
A1.4Translation: compilers vs interpreters—HL only: evaluating compilers, interpreters, bytecode + JIT

Key ideas in one screen

  • The CPU is the ALU, the control unit and registers, joined by the address, data and control buses. The PC holds the address of the next instruction; MAR holds an address; MDR holds data; IR holds the current instruction.
  • Fetch–decode–execute: PC → MAR → address bus → memory returns instruction on data bus → MDR → IR; PC increments during fetch.
  • Cache works because of locality of reference: a hit is fast, a miss stalls the CPU while data comes from RAM.
  • Storage: SSD is fast and robust but costly per GB; HDD is slow, cheap and large; eMMC is cheap and embedded. Match the choice to the scenario's dominant requirement.
  • Compression: lossless (RLE, ZIP, PNG) is perfectly reversible; lossy (JPEG, MP3) permanently discards data people barely notice. RLE makes files bigger when there are no runs.
  • Cloud: IaaS — you manage the OS upward; PaaS — you manage only your application; SaaS — you manage nothing.
  • Data representation: convert binary ↔ hex through 4-bit nibbles; two's complement = invert bits and add 1; image size = width × height × colour depth ÷ 8.
  • Logic: seven gates; a bubble on a gate symbol means inversion; a truth table with n inputs needs 2ⁿ rows and intermediate columns; De Morgan lets you break the bar and change the sign.
  • OS functions: memory, file system, device, scheduling, security, accounting, user interface, virtualisation, networking. FCFS is simple but suffers the convoy effect; round robin is fair but pays switching overhead; priority is efficient but can starve low-priority jobs.
  • Polling suits frequent, predictable events; interrupts save power and suit rare, unpredictable ones.
  • HL: CPU optimises latency, GPU optimises throughput; pipelining overlaps fetch/decode/execute/write-back but hazards limit the gain; deadlock needs all four Coffman conditions; compilers are fast but not portable, interpreters are portable but slow, bytecode + JIT is the modern compromise.
A1 · Inside the CPU and the fetch–decode–execute cycleCPUControl unit (CU)decodes, sends signalsALUarithmetic & logicPCaddress of nextinstructionMARaddress beingaccessedMDRdata beingtransferredIRcurrentinstructionRegistersCache — small, fast, close to the CPU (locality ofreference)Main memory (RAM)0x00  LOAD 50x01  ADD 70x02  STORE 90x03  ......address busdata buscontrol bus1 FETCH2 DECODE3 EXECUTEPC→MAR→address bus→databus→MDR→IR; PC+1CU decodes the IRALU / memory carries it outFetch: PC copied to MAR, memory returns the instruction into MDR, copied to IR, PC increments. The cycle repeats forever.
A1 · The memory and storage hierarchyRegistersinside CPU · bytes · ~1 nsCache (L1/L2/L3)on/near CPU · MB · ~1–10 nsMain memory (RAM)volatile · GB · ~100 nsSSDnon-volatile · TB · ~0.1 msHDDnon-volatile · TB · ~10 ms · cheapest per GBfastermore expensive per bytesmallerslowercheaper per bytelargerPrimary memory (registers, cache, RAM) is directly accessed by the CPU; secondary storage (SSD, HDD) keeps data when power is off.

Websites and videos

A1 · Logic gates, symbols and truth tablesANDA·BA BQ0 000 101 001 11ORA+BA BQ0 000 111 011 11NOT¬AAQ0110XORA⊕BA BQ0 000 111 011 10NAND¬(A·B)A BQ0 010 111 011 10NOR¬(A+B)A BQ0 010 101 001 10RememberA bubble on a symbol means invert. A truth table for n inputs needs 2ⁿ rows — write intermediate columns first.De Morgan: ¬(A·B) = ¬A + ¬B and ¬(A+B) = ¬A·¬B — break the bar, change the sign.Q = (A XOR B) AND (NOT C): build columns for A⊕B and ¬C, then AND them row by row.
A1 · What an operating system does · polling vs interruptsApplications (browser, games, IDE …)Operating system — abstracts the hardwarememoryfilesystemdevicesschedulingsecurityaccountinguserinterfacevirtualisationnetworkingHardware (CPU, RAM, storage, NIC, sensors, actuators)PollingCPU asks the device again and again: “anything yet?”Simple, predictable · wastes CPU time and batterySuits frequent, regular eventsInterruptsDevice signals the CPU only when something happensCPU can sleep · needs an interrupt handlerSuits rare, unpredictable events (a doorbell!)Scheduling: FCFS (simple, convoy effect) · Round robin (fair, switching overhead) · Priority (efficient, starvation).

Exam tips for A1

  • Show every step of a conversion. A wrong final answer with correct working still earns method marks; a bare wrong number earns nothing.
  • File-size calculations: pixels × bits → bits ÷ 8 → bytes → MB. State units at every line.
  • For truth tables, write out the intermediate columns (e.g. A XOR B, NOT C) before the final output — they carry marks.
  • Scheduling questions want the trade-off: name the algorithm's advantage and its characteristic weakness (convoy effect, starvation, switching overhead).
  • Polling vs interrupts questions are almost always “evaluate” — relate to the scenario (battery life, event frequency) and finish with a judgement.
  • HL translation questions: compare on speed, portability, error detection and protection of source code, then conclude for the scenario given.

Practice questions

1State the register that holds the address of the next instruction to be fetched.1 mark
Mark-scheme notes. Program Counter (PC).
2Describe the fetch stage of the fetch–decode–execute cycle, with reference to registers and buses.4 marks
Mark-scheme notes. One mark each (max 4): PC copied to MAR; address sent along the address bus; read signal on the control bus; instruction returned on the data bus into MDR; copied from MDR to IR; PC incremented.
3Explain why a cache miss reduces CPU performance.3 marks
Mark-scheme notes. Requested data is not in cache [1]; it must be fetched from a slower level such as RAM [1]; that takes many more clock cycles during which the CPU stalls [1].
4Convert the binary number 11010110 to (a) decimal and (b) hexadecimal.3 marks
Mark-scheme notes. (a) 128+64+16+4+2 = 214 [1]. (b) Split into nibbles 1101 0110 → D and 6 → D6 [1 for nibbling, 1 for digits].
5A photograph is 800 × 600 pixels with a colour depth of 24 bits. Calculate the uncompressed file size in megabytes.3 marks
Mark-scheme notes. 800 × 600 = 480,000 pixels [1]; × 24 = 11,520,000 bits [1]; ÷ 8 = 1,440,000 bytes ≈ 1.44 MB (1.37 MiB) [1].
6Explain why run-length encoding may increase the size of some files.2 marks
Mark-scheme notes. RLE stores each run as a count plus a value [1]; with few or no repeated consecutive values each single symbol becomes two symbols, so the output is larger [1].
7Construct a truth table for Q = (A XOR B) AND (NOT C).4 marks
Mark-scheme notes. 8 rows in correct binary order [1]; correct A XOR B column [1]; correct NOT C column [1]; Q = 1 only when A≠B and C=0, i.e. rows 010 and 100 [1].
8Compare round robin and priority scheduling.4 marks
Mark-scheme notes. Each point must mention both: RR gives every process an equal time slice so it is fair and responsive, whereas priority runs the most important job first; RR pays context-switch overhead, whereas priority risks starvation of low-priority processes; RR is predictable, priority is efficient for real-time work; both are pre-emptive.
9A wireless doorbell runs on a small battery. Evaluate the use of polling versus interrupt handling for detecting the button press.6 marks
Mark-scheme notes. Up to 4 for analysis, 2 for a justified conclusion. Presses are rare and unpredictable; polling wakes the CPU constantly and drains the battery; interrupts let the device sleep and respond immediately; polling is simpler and deterministic but wasteful here. Conclusion: interrupts.
10Explain how pipelining improves performance, and identify one factor that prevents the full theoretical speedup.5 marks
Mark-scheme notes. Stages (fetch, decode, execute, write-back) overlap so several instructions are in flight at once [1–2]; throughput approaches one instruction per cycle [1]; limited by hazards — data dependencies, branch mispredictions requiring a pipeline flush, or resource conflicts [1–2].
11Explain, with reference to the Coffman conditions, how deadlock can arise between two processes, and describe one method of preventing it.6 marks
Mark-scheme notes. Mutual exclusion, hold-and-wait, no pre-emption and circular wait must all hold [up to 4 with an example of P1 holding R1 wanting R2 while P2 holds R2 wanting R1]; prevention removes one condition — e.g. impose a global ordering on resource acquisition to break circular wait, or require all resources to be requested at once [2].

A2 · Networks

Paper 1 · SL 11 hours / HL 18 hours · Fundamentals, architecture, data transmission and security.

What the syllabus expects

CodeTopicSLHL extra
A2.1Network fundamentals: PAN/LAN/WAN/VPN, digital infrastructure, devices (NIC, switch, router, WAP, modem, gateway, firewall), transport and application protocols (TCP, UDP, HTTP/S, DHCP, DNS…)✔The TCP/IP model and encapsulation
A2.2Network architecture: topologies (star, mesh, hybrid…), client–server vs peer-to-peer, segmentation (subnets, VLANs)✔Types of server
A2.3Data transmission: IPv4/IPv6 addressing, NAT, transmission media, packet switching✔Static vs dynamic routing
A2.4Network security: firewalls, encryption, digital certificates✔Common vulnerabilities and countermeasures

Key ideas in one screen

  • PAN (metres), LAN (one site, owned), WAN (wide area, leased infrastructure), VPN (encrypted tunnel over public infrastructure). The Internet is not the World Wide Web.
  • Link-layer devices (NIC, switch, WAP) use MAC addresses; internet-layer devices (router, gateway) use IP addresses; a modem converts digital ↔ analogue; a firewall filters.
  • TCP is reliable, ordered and connection-based (handshake) but slower; UDP is fast with no guarantees — used for live streaming, gaming and VoIP. HTTPS = HTTP + TLS gives confidentiality, integrity and authentication. DHCP uses Discover–Offer–Request–Acknowledge.
  • Star: cheap and simple, central switch is a single point of failure. Full mesh: redundant and reliable but needs n(n−1)/2 links. Real networks are hybrids.
  • Client–server: central control and security, but a single point of failure. P2P: resilient and scalable, but weak security and administration.
  • Subnets work at layer 3, VLANs at layer 2; both shrink broadcast domains (performance) and contain breaches (security).
  • IPv4 is 32-bit, IPv6 is 128-bit. Private address ranges are not routable; NAT lets many private devices share one public address — but NAT is not a firewall.
  • Media: fibre is fast, long-range, secure and expensive; twisted pair is cheap with a 100 m limit and EMI susceptibility; wireless is mobile and convenient but least secure and least reliable.
  • Packet switching: split into packets with headers and sequence numbers, route independently, reassemble at the destination; efficient and resilient but introduces jitter and possible loss.
  • Security: firewalls are necessary but not sufficient (they cannot inspect encrypted traffic or stop social engineering). Symmetric encryption is fast but has a key-distribution problem; asymmetric solves distribution but is slow; real systems use both. Certificates bind a public key to a verified identity and defeat man-in-the-middle attacks.
A2 · Network topologiesPCPCPCPCPCPCSwitchStarcheap, easy to add devices, easy to findfaultsbut the switch is a single point offailurePCPCPCPCPCPCFull meshredundant paths, no single point offailurebut n(n−1)/2 links — 6 nodes need 15, 30need 435RouterSwitchSwitchHybrid (what real networks use)stars of stars, with backup linkswhere reliability mattersExam pattern: count the nodes, weigh cost against redundancy, name the single point of failure, then conclude for the scenario.
A2 · Packet switching · how HTTPS uses both kinds of encryptionSendersplits messagepkt 1pkt 2pkt 3header: dest IP,sequence no.RRRRReceiverreassemblesby sequenceno.Packets take independent routes around congestion or failed links; lost packets are re-requested (TCP). Efficient and resilient,but adds jitter.BrowserWeb server1 Server sends its digital certificate (public key + identity signed by a CA)2 Asymmetric: browser encrypts a session key with the server's public key3 Symmetric: all page data encrypted with the fast session keyAsymmetric solves key distribution but is slow · symmetric is fast but needs a shared key · certificates prove who you are talking toHTTPS = HTTP + TLS: confidentiality (encryption), integrity (tamper detection) and authentication (certificate).

Websites and videos

A2 · The TCP/IP model and encapsulation (HL)ApplicationHTTP · HTTPS · DNS · SMTP · DHCPdataTransportTCP (reliable, ordered) · UDP (fast, noguarantees) · portsTransheadersegment = previous unit + new headerInternetIP addresses · routers · routing tablesInterheaderTransheaderpacket = previous unit + new headerLinkMAC addresses · switches · NICs · Wi-Fi ·cablesLinkheaderInterheaderTransheaderframe = previous unit + new headerSending: each layer adds its own header on the way down (encapsulation).Receiving: each layer strips its header on the way up. Each layer onlyreads its own header.Switches work at the link layer with MAC addresses; routers work at the internet layer with IP addresses.

Exam tips for A2

  • When asked to compare devices or protocols, put both items in every sentence (“a switch forwards by MAC address within one network, whereas a router forwards by IP address between networks”).
  • Topology questions are scenario-based: count the nodes, mention cost, single point of failure, redundancy and ease of adding devices, then conclude.
  • Never write “NAT makes the network secure”. Say it conserves public addresses and hides internal addresses, and that security comes from the firewall.
  • For encryption questions, name the problem each type solves: symmetric = speed, asymmetric = key distribution, certificate = identity.
  • “Discuss the effectiveness of a firewall” (8 marks) wants what it does well, what it cannot do, and a balanced conclusion recommending it as part of layered security.
  • HL: the TCP/IP model has four layers (application, transport, internet, link); explain encapsulation as each layer adding its own header on the way down.

Practice questions

1Describe two differences between a LAN and a WAN.2 marks
Mark-scheme notes. Any two: geographic scale; ownership (LAN owned by the organisation, WAN uses leased carrier links); bandwidth; latency; cost.
2Explain why UDP rather than TCP is used for live video streaming.3 marks
Mark-scheme notes. No acknowledgements or retransmission, so lower latency and overhead [1]; a late packet is useless because its moment has passed [1]; better to drop it than stall the stream waiting for a retransmission [1].
3Describe the function of a router and explain how it differs from a switch.4 marks
Mark-scheme notes. Router connects different networks [1] and forwards packets using destination IP addresses and a routing table [1]; a switch works inside one network [1] forwarding frames by MAC address to the correct port only [1].
4A school is choosing between a star and a mesh topology for a new lab of 30 machines. Discuss which is more appropriate.6 marks
Mark-scheme notes. Up to 4 analysis, 2 conclusion. Star: cheap, simple, easy fault isolation, but central switch is a single point of failure. Mesh: no single point of failure, but 30 nodes need 435 links — prohibitively expensive and complex. Conclusion: star, possibly with a spare switch.
5Explain the role of NAT in a home network.4 marks
Mark-scheme notes. Many devices share one public IPv4 address [1]; router rewrites source address/port on outgoing packets and keeps a translation table [1]; replies are mapped back to the correct private device [1]; conserves public addresses and hides internal addressing, though it is not itself a firewall [1].
6Explain how packet switching allows data to be transmitted reliably across a network.5 marks
Mark-scheme notes. Message split into packets [1]; each has a header with addresses and a sequence number [1]; packets take independent routes around congestion or failed links [1]; destination reassembles them in order [1]; missing packets are detected and re-requested (TCP) [1].
7Explain the difference between symmetric and asymmetric cryptography, and describe why HTTPS uses both.6 marks
Mark-scheme notes. Symmetric: one shared key, fast, but the key must be exchanged securely [2]; asymmetric: public/private key pair, solves distribution, but is computationally slow [2]; HTTPS uses asymmetric during the TLS handshake to agree a session key, then symmetric for the bulk data [2].
8Describe the four layers of the TCP/IP model and explain the role of encapsulation.6 marks
Mark-scheme notes. Application (HTTP, DNS, SMTP) [1]; transport (TCP/UDP, ports, reliability) [1]; internet (IP addressing and routing) [1]; link (MAC addressing, physical transmission) [1]; encapsulation adds each layer's header on the way down and strips it on the way up, so each layer only needs to understand its own header [2].
9Describe three common network vulnerabilities and identify an appropriate countermeasure for each.6 marks
Mark-scheme notes. Two marks per pair, e.g. phishing → user training and email filtering; unpatched software → patch management; weak passwords → MFA and password policy; SQL injection → parameterised queries and input validation; DDoS → traffic filtering/CDN; man-in-the-middle → TLS and certificates.

A3 · Databases

Paper 1 · SL 11 hours / HL 18 hours · Relational design, normalisation, SQL and (HL) alternative databases.

What the syllabus expects

CodeTopicSLHL extra
A3.1Database fundamentals: features, benefits and limitations of relational databases✔—
A3.2Database design: schemas, ERDs, data types, constructing tables, normal forms to 3NF, denormalisation✔—
A3.3Database programming: DDL vs DML, SELECT with JOIN/WHERE/ORDER BY, INSERT/UPDATE/DELETE✔Aggregate functions, GROUP BY/HAVING, views, transactions (ACID)
A3.4Alternative databases and data warehouses—HL only: NoSQL, cloud, spatial and in-memory databases; data warehouses; OLAP and data mining; distributed databases (CAP)

Key ideas in one screen

  • Tables, rows, columns. A primary key uniquely identifies a row; a foreign key references another table's primary key; a many-to-many relationship always needs a junction table; the FK sits on the “many” side of a 1:M.
  • Benefits: less duplication, consistency, integrity via constraints, concurrent access, ACID transactions, security, ad hoc querying. Limitations: rigid schema, design effort, weak horizontal scaling, poor fit for unstructured or hierarchical data.
  • Three schemas: conceptual (what — ERD), logical (how structured — tables, types, keys), physical (how stored — indexes, files).
  • ERD crow's foot: inner symbol = modality (○ optional, | mandatory); outer symbol = cardinality (| one, crow's foot many).
  • Normalisation: 1NF atomic values; 2NF no partial dependencies on part of a composite key; 3NF no transitive dependencies. “The key, the whole key and nothing but the key.” It removes insertion, update and deletion anomalies.
  • Denormalisation trades integrity for read speed — justified for read-heavy reporting. Normalise first, denormalise deliberately.
  • SQL clause order: SELECT – FROM – JOIN – WHERE – GROUP BY – HAVING – ORDER BY. WHERE filters rows before grouping; HAVING filters groups after. UPDATE or DELETE without WHERE affects every row. Indexes speed reads and slow writes.
  • HL: aggregates ignore NULL except COUNT(*); virtual views are live but slow, materialised views are fast but stale; ACID = atomicity, consistency, isolation, durability with BEGIN/COMMIT/ROLLBACK; data warehouses are subject-oriented, integrated, time-variant, non-volatile; OLAP is hypothesis-driven, data mining is discovery-driven; distributed databases face the CAP trade-off.
A3 · Entity relationship diagram and resolving many-to-manyStudentStudentID (PK)SurnameYearGroupCourseCourseID (PK)CourseNameDepartmentmany-to-many — NOT allowed directlya field can hold only one value, so “which courses?” cannotfit in one rowresolve with a junction tableStudentStudentID (PK)SurnameYearGroupEnrolmentStudentID (PK, FK)CourseID (PK, FK)GradeCourseCourseID (PK)CourseNameDepartment1manymany1Crow's foot: inner symbol = modality (○ optional, | mandatory) · outer symbol = cardinality (| one, crow's foot many)The foreign key always sits on the “many” side. Two 1:M relationships replace the M:N.SQL: SELECT Surname, CourseName FROM Student JOIN Enrolment ON … JOIN Course ON … WHERE … ORDER BY Surname;
A3 · Normalisation to 3NF — “the key, the whole key and nothing but the key”1NF — Booking(BookingID, GuestName, GuestPhone, RoomNumber, RoomType, RatePerNight, CheckIn, Nights)atomic values, but guest and room facts repeat in every booking → update, insertion and deletion anomalies2NF: remove partial dependencies (only matters with acomposite key)3NF: remove transitive dependencies (non-key → non-key)BookingID → GuestName → GuestPhone        BookingID → RoomNumber → RoomType → RatePerNightGuestGuestID (PK)GuestNameGuestPhoneRoomTypeRoomTypeID (PK)TypeNameRatePerNightRoomRoomNumber (PK)RoomTypeID (FK)BookingBookingID (PK)GuestID (FK)RoomNumber (FK)CheckInNightsEach fact is stored once. Change a room's rate in one place and every booking sees it.Denormalise later, deliberately, only for read-heavy reporting.Show every stage in the exam: identify the key, list dependencies, then write the final tables with PKs and FKs marked.

Websites and videos

A3 · SQL SELECT — clause order and what each clause doesSELECTwhich columns(and aggregates)FROMwhich tableJOIN … ONlink tablesFK = PKWHEREfilter rowsbefore groupingGROUP BYmake groupsHAVINGfilter groups(can use COUNT etc.)ORDER BYsort theresult lastSELECT Department, COUNT(*) AS StudentsFROM Student JOIN Enrolment ON Student.StudentID = Enrolment.StudentID     JOIN Course ON Enrolment.CourseID = Course.CourseIDWHERE YearGroup = 12GROUP BY DepartmentHAVING COUNT(*) > 10ORDER BY Students DESC;WHERE filters individual rows before grouping · HAVING filters groups after · UPDATE or DELETE without WHERE changes every rowDDL defines structure (CREATE, ALTER, DROP) · DML manipulates data (SELECT, INSERT, UPDATE, DELETE).

Exam tips for A3

  • In a normalisation question, show each stage: identify the key, list dependencies, then write the final tables with PKs underlined and FKs marked (*). The table list carries most of the marks.
  • Always resolve many-to-many relationships with a junction table whose primary key is usually composite.
  • Write SQL keywords in capitals, quote strings, and check every JOIN has an ON condition matching FK = PK. Sort with ORDER BY last.
  • “Explain why storing X as INT is a problem” questions want concrete consequences: leading zeros lost, characters rejected, no meaningful arithmetic.
  • Denormalisation and NoSQL questions are “evaluate/discuss”: give the workload (read-heavy? varied structure? huge scale?), both sides, and a conditional conclusion.
  • HL: for ACID, use a bank-transfer example and tie each property to one line of the story.

Practice questions

1Define the terms primary key and foreign key.2 marks
Mark-scheme notes. PK: attribute(s) uniquely identifying each row, unique and never NULL [1]. FK: attribute in one table referencing the PK of another, creating a relationship [1].
2Explain why a many-to-many relationship cannot be implemented directly in a relational database, and describe how it is resolved.4 marks
Mark-scheme notes. A field can hold only one value [1], so M:N would need multiple FK values in one field, breaking 1NF [1]; resolve with a junction table [1] holding FKs to both tables (usually a composite PK), giving two 1:M relationships [1].
3A table stores phone numbers as INT. Explain two problems this causes.4 marks
Mark-scheme notes. Any two, 2 marks each: leading zeros stripped; characters such as +, spaces and hyphens cannot be stored; long international numbers may overflow; arithmetic on a phone number is meaningless so the numeric type gives no benefit.
4The table Booking(BookingID, GuestName, GuestPhone, RoomNumber, RoomType, RatePerNight, CheckIn, Nights) is in 1NF. Normalise it to 3NF, showing each stage.8 marks
Mark-scheme notes. Single-attribute PK so already 2NF [1]; transitive dependencies: BookingID→GuestName→GuestPhone and BookingID→RoomNumber→RoomType→RatePerNight [2]; 3NF: Guest(GuestID, GuestName, GuestPhone), RoomType(RoomTypeID, TypeName, RatePerNight), Room(RoomNumber, RoomTypeID*), Booking(BookingID, GuestID*, RoomNumber*, CheckIn, Nights) [up to 5].
5Explain the difference between the WHERE and HAVING clauses.3 marks
Mark-scheme notes. WHERE filters individual rows before grouping [1]; HAVING filters groups after GROUP BY, so it can use aggregates [1]; e.g. WHERE grade > 4 vs HAVING COUNT(*) > 10 [1].
6Using Student(StudentID, Surname, YearGroup), Enrolment(StudentID*, CourseID*, Grade), Course(CourseID, CourseName, Department), write SQL to list the surname and course name of every Year 12 student taking a Science course, sorted by surname.5 marks
Mark-scheme notes. SELECT Surname, CourseName FROM Student JOIN Enrolment ON Student.StudentID = Enrolment.StudentID JOIN Course ON Enrolment.CourseID = Course.CourseID WHERE YearGroup = 12 AND Department = 'Science' ORDER BY Surname; [marks for SELECT list, both JOINs with correct ON, WHERE with both conditions, ORDER BY].
7Evaluate the decision to denormalise a database used for a reporting dashboard.6 marks
Mark-scheme notes. For: fewer joins so faster reads; dashboards are read-heavy; simpler queries. Against: redundancy, update anomalies, larger storage, harder to keep consistent. Conclusion: justified for the reporting copy if the transactional database stays normalised (or a materialised view is used).
8Explain, with an example, how the ACID properties ensure data integrity during a bank transfer.6 marks
Mark-scheme notes. Example: deduct £100 from A and add to B [1]; atomicity — both or neither [1]; consistency — total money unchanged and constraints hold [1]; isolation — a concurrent balance query never sees the half-done state [1]; durability — once committed the change survives a crash [1]; achieved with BEGIN/COMMIT/ROLLBACK [1].
9A social media company must store user posts of widely varying structure at massive scale. Discuss whether a relational or NoSQL database is more appropriate.8 marks
Mark-scheme notes. Relational: integrity, ACID, powerful joins, but rigid schema and poor horizontal scaling. NoSQL (document store): flexible schema, scales out across servers, high availability, but eventual consistency and weaker joins. Conclusion: NoSQL for posts, possibly relational for accounts/billing — a polyglot approach.

A4 · Machine learning

Paper 1 · SL 5 hours / HL 18 hours · Fundamentals and ethics for all; preprocessing and ML approaches for HL.

What the syllabus expects

CodeTopicSLHL extra
A4.1ML fundamentals: supervised, unsupervised, reinforcement, deep and transfer learning; hardware for training and inference (CPU, GPU, TPU, FPGA, edge, cloud)✔—
A4.2Data preprocessing: cleaning, missing data, normalisation, feature selection, dimensionality reduction—HL only
A4.3ML approaches: linear regression, classification (k-NN, decision trees), evaluation metrics, clustering, association rules, reinforcement learning, genetic algorithms, neural networks and CNNs, model selection—HL only
A4.4Ethical considerations: bias, fairness, transparency, consent, inference, environmental impact; ethics of computing in daily life✔—

Key ideas in one screen

  • Supervised = labelled data, predicts a label (classification) or a value (regression). Unsupervised = unlabelled data, finds structure (clustering, association). Reinforcement = agent, environment, reward, policy. Deep learning = many-layered networks that learn features automatically. Transfer learning reuses a pretrained model and fine-tunes it on a small dataset.
  • Training is heavy, inference is light. GPU is the mainstream training choice (thousands of parallel cores, high memory bandwidth); TPU/ASIC gives maximum efficiency at scale with no flexibility; FPGA is the reconfigurable middle ground; edge devices give low-latency, private local inference; cloud gives elastic capacity.
  • HL preprocessing: garbage in, garbage out. Handle outliers, duplicates, bad formats; missing data by deletion, imputation or prediction (each with its own bias risk). Normalise for any distance-based algorithm. Feature selection: filter (fast), wrapper (accurate, expensive), embedded (compromise). Curse of dimensionality: sparsity and breakdown of distance metrics.
  • HL approaches: linear regression (slope, r²; correlation ≠ causation); k-NN (small k overfits, large k underfits; needs scaling); decision trees (interpretable but overfit — prune or use forests); precision = trust the yes, recall = catch everything, F1 balances them, accuracy misleads on imbalanced data; association rules need lift > 1; RL balances exploration and exploitation; genetic algorithms use selection, crossover and mutation (mutation escapes local optima); perceptron = inputs, weights, bias, activation; CNNs use shared kernels for translation invariance and pooling to downsample.
  • Ethics: bias comes from data that reflects an unequal world; fairness definitions conflict; black-box models obstruct accountability; consent is often fictional at scale; inference reveals facts never disclosed; environmental costs (and benefits) are real. Structure every ethics answer: context, named issues, both sides, mitigations, conclusion.
A4 · The three types of machine learningSupervisedLabelled data: every examplecomes with the right answerLearns input → outputClassification (spam / not spam)Regression (house price)e.g. scan → “tumour / no tumour”UnsupervisedUnlabelled data: no answers,just the examplesFinds structure on its ownClustering (customer groups)Association rules (basket analysis)e.g. group shoppers by behaviourReinforcementNo dataset: an agent actsin an environmentLearns from rewards and penaltiesto maximise total rewardGame playing, robot navigation,recommendation policiese.g. robot learns to walkDeep learning = many-layered neural networks that learn features automatically · Transfer learning = reuse a pretrainedmodel and fine-tune it.
A4 · Why accuracy can lie — precision, recall and F1 (HL)Model predictsActuallySickHealthySickHealthyTrue positive0False negative10 (missed!)False positive0True negative990A model that says “healthy” to all 1,000 patientsAccuracy = (TP+TN) / all = 990/1000 = 99%…yet it caught nobody who was illRecall = TP / (TP+FN)“did we catch everyone?” = 0/10 = 0%Precision = TP / (TP+FP)“can we trust a positive?”F1 = 2·P·R / (P+R)balances the two when classes are imbalancedWhenever a question mentions a rare event, suspect class imbalance and reach for recall, precision and F1.
A4 · A perceptron and a small neural network (HL)x₁x₂x₃Σ thenactivationw₁w₂w₃bias boutputoutput = f( w₁x₁ + w₂x₂ + w₃x₃ + b )f = activation (step, sigmoid, ReLU) — non-linear,otherwise stacking layers adds nothinginputlayerhiddenlayer(s)outputlayerTraining adjusts every weight to reduce the error on labelledexamples (gradient descent).CNNs add convolution layers with shared kernels (edges → shapes → objects) and pooling to shrink the image.

Websites and videos

Exam tips for A4

A4 · Ethics of machine learning — how to structure an 8-mark answer1 ContextName the exactsystem, dataand people affected2 IssuesBias · fairness ·transparencyconsent · inference· accountabilityenvironmental cost3 Both sidesBenefits too:consistency,speed, scale, mayreducehuman bias ifaudited4 MitigationsAudits · human inthe loopexplainable models ·diverse datadata minimisation5 ConclusionA judgement, ideallyconditional:“acceptable if …”Bias comes from data that reflects an unequal world · fairness definitions conflict · black boxes obstruct accountabilityGeneric answers with no named context cap at about half marks.Same framework works for the case study: anchor every point to the scenario's organisation, data and users.
  • Every “describe an application” answer must name the type of learning and say why (labelled data? reward signal?).
  • Hardware questions are scenario questions: ask whether it is training or inference, whether latency matters, whether data can leave the site, then justify.
  • HL: if a question mentions accuracy on a rare event, immediately suspect class imbalance and bring in precision, recall and F1.
  • HL: normalise before k-NN or k-means — say why (large-magnitude features dominate the distance).
  • Ethics (8 marks): specific context → at least three named issues (bias, transparency, consent, accountability) → mitigation for each → balanced conclusion. Generic answers cap at half marks.
  • Link A4.4 to the case study: the 2027 case study is about generative image AI, so bias in training data, consent of artists and environmental cost are likely Section B territory.

Practice questions

1Distinguish between supervised and unsupervised learning.3 marks
Mark-scheme notes. Supervised uses labelled data and learns input→output mapping [1]; unsupervised uses unlabelled data and finds structure [1]; so supervised predicts a known target while unsupervised discovers groupings not defined in advance [1].
2Describe two real-world applications of machine learning, identifying the type used in each.4 marks
Mark-scheme notes. 1 for the application + 1 for the type, twice. E.g. medical scan diagnosis — supervised deep learning; customer segmentation — unsupervised clustering; robot navigation — reinforcement learning; market-basket analysis — association rules.
3Explain why GPUs are more suitable than CPUs for training neural networks.4 marks
Mark-scheme notes. Training is dominated by matrix multiplication — millions of independent multiply-accumulates [1]; a GPU has thousands of simple cores running these in parallel, a CPU only a few complex cores [1]; GPUs have much higher memory bandwidth [1]; giving speed-ups of one to two orders of magnitude [1].
4A hospital wants to run an ML model that detects abnormalities in scans inside the operating theatre. Describe the hardware you would recommend and justify your choice.5 marks
Mark-scheme notes. Edge device in the theatre with an accelerator (NPU/FPGA/GPU) doing inference only [1]; inference is light so no cluster needed [1]; latency must be minimal [1]; must work if the network fails [1]; patient data stays on site [1]; train separately in the cloud and deploy the model [1]. Max 5.
5Discuss the ethical implications of using machine learning to screen job applications.8 marks
Mark-scheme notes. Context [1]; issues: historical bias in past hiring data reproduced, proxies for protected characteristics, lack of transparency for rejected applicants, consent and data use, accountability [up to 4]; benefits: consistency, speed, potential to reduce human bias if audited [1–2]; mitigations: audits, human in the loop, explainability [1]; conclusion [1].
6A model that detects a rare disease achieves 99% accuracy. Explain why this figure may be misleading, and state which metrics should be used instead.5 marks
Mark-scheme notes. If 1% of patients have the disease, predicting “healthy” for everyone is 99% accurate [1] yet detects nobody [1]; class imbalance makes accuracy uninformative [1]; use recall (catch the sick), precision (trust the positives) and F1 [2].
7Explain the exploration–exploitation trade-off in reinforcement learning.4 marks
Mark-scheme notes. Exploitation chooses the action currently believed best for known reward [1]; exploration tries other actions to discover better ones [1]; too much exploitation gets stuck in a local optimum, too much exploration wastes reward [1]; strategies such as ε-greedy balance them, often exploring more early [1].
8Explain why mutation is necessary in a genetic algorithm.3 marks
Mark-scheme notes. Crossover only recombines genes already present in the population [1]; mutation introduces new variation [1]; preventing premature convergence on a local optimum [1].

B1 · Computational thinking

Paper 2 · 5 hours · Problem specification, the four concepts, flowcharts and tracing.

What the syllabus expects

CodeTopicSLHL extra
B1.1.1Constructing a problem specification (problem statement, constraints, objectives, input/output specifications, evaluation criteria)✔—
B1.1.2The four concepts: decomposition, pattern recognition, abstraction, algorithmic design✔—
B1.1.3Applying computational thinking across computer science (and beyond)✔—
B1.1.4Tracing flowcharts and pseudocode with trace tables✔—

Key ideas in one screen

  • A problem specification has six parts: problem statement, constraints and limitations, objectives and goals, input specification, output specification, evaluation criteria. Objectives must be testable; the specification says what, not how.
  • Decomposition — break the problem into manageable sub-problems. Pattern recognition — spot similarities and reuse solutions. Abstraction — remove irrelevant detail and hide complexity behind an interface. Algorithmic design — define precise, ordered steps.
  • Computational thinking is not programming: it applies to database design, network security, ML — and to medicine, logistics and cooking.
  • Flowchart symbols: terminal (oval), input/output (parallelogram), process (rectangle), decision (diamond), flow line (arrow), connector (circle).
  • Tracing: one column per variable, one row per change; evaluate every condition with the current values; check the boundaries; never skip an iteration; always show the table.
B1 · The four concepts of computational thinkingDecompositionBreak the problem intosmaller sub-problemsMusic library → add track,search, make playlist, savePattern recognitionSpot similarities andreuse known solutions“Search a list” appearseverywhere → one functionAbstractionRemove irrelevant detail;hide complexity behindan interfaceA Track has title, artist,length — not file bytesAlgorithmic designDefine precise, orderedsteps to solve itFlowchart or pseudocodefor “build playlist”Computational thinking is not programming — a doctor decomposes a diagnosis, recognises symptom patterns, ignoresirrelevant history and follows a procedure.Problem specification = problem statement · constraints · objectives · input spec · output spec · evaluation criteria (sayswhat, not how).
B1 · Flowchart symbols and how to traceSTART / ENDterminalINPUT ninput / outputtotal ← total + iprocessi <= n ?decisionflow lineAconnectorSTARTresult ← 1, i ← 1INPUT ni <= n ?yesresult ← result × ii ← i + 1noOUTPUT resultTrace table for n = 5nii <= n ?result51true12true13true24true65true246false120Output: 120 (5!)One column per variable, one row per change.Evaluate the condition with the current values.Check the boundary (i = 5 and i = 6). Never skip arow.The trace table earns marks even if the final output is wrong — always draw it.

Websites and videos

Exam tips for B1

  • A trace table earns marks even when the final output is wrong. Draw it every time.
  • When a flowchart “contains an error”, trace it with the given inputs first — the error shows itself in the table (often a comparison against the wrong variable).
  • Problem-specification questions (8 marks) are marked per component: label each part (Problem statement, Constraints, Objectives, Inputs, Outputs, Evaluation criteria) and make every objective measurable.
  • When asked how abstraction applies to a topic, give a concrete mechanism: three-schema architecture, a database view, an ADT, the OS hiding hardware.

Practice questions

1State the four fundamental concepts of computational thinking.2 marks
Mark-scheme notes. Decomposition, pattern recognition, abstraction, algorithmic design [1 for two, 2 for all four].
2Explain, with an example, how abstraction is applied in database design.3 marks
Mark-scheme notes. Abstraction removes unnecessary detail [1]; the three-schema architecture separates the conceptual view from physical storage [1]; or a view hides a complex multi-table join behind a simple table [1].
3Explain why computational thinking does not necessarily involve programming, giving one non-computing example.3 marks
Mark-scheme notes. It is a set of problem-solving techniques independent of a computer [1]; a solution may be executed by people [1]; e.g. a doctor decomposes diagnosis by body system, recognises symptom patterns, abstracts irrelevant history and follows a diagnostic procedure [1].
4Complete a trace table for: result ← 1; i ← 1; INPUT n; WHILE i <= n: result ← result * i; i ← i + 1; OUTPUT result — with input n = 5, and state the output.5 marks
Mark-scheme notes. Columns n, i, result, condition. Rows: (5,1,1) → i≤n true: result 1, i 2 → result 2, i 3 → result 6, i 4 → result 24, i 5 → result 120, i 6 → condition false. Output 120 (5!). Marks for correct columns, each loop iteration, terminating correctly, output.
5The flowchart INPUT a,b,c; max ← a; IF b > max THEN max ← b; IF c > b THEN max ← c; OUTPUT max is meant to find the largest of three numbers but contains an error. Trace it with inputs 4, 9, 7 and identify the error.5 marks
Mark-scheme notes. Trace: max=4; b(9)>4 so max=9; c(7)>b(9) false; output 9 — correct by luck. Error: the second comparison tests c against b instead of against max; e.g. inputs 9, 4, 7 output 7. Fix: IF c > max.
6Describe the purpose of each of the six standard flowchart symbols.6 marks
Mark-scheme notes. Oval — start/end; parallelogram — input/output; rectangle — a process or assignment; diamond — decision with yes/no branches; arrow — flow of control; circle — connector linking parts of a chart.

B2 · Programming

Paper 2 · SL 40 hours / HL 42 hours · The biggest topic: Python fundamentals, data structures, constructs, algorithms and files.

What the syllabus expects

CodeTopicSLHL extra
B2.1Programming fundamentals: variables, constants, data types, operators, input/output, validation, error types✔—
B2.2Data structures: static vs dynamic structures, arrays/lists, stacks (LIFO) and queues (FIFO). Python dictionaries, sets and tuples are handy, but sets and hash tables are examined in B4 (HL)✔—
B2.3Programming constructs: sequence, selection, iteration, sub-programs (functions), parameters and scope✔—
B2.4Algorithms: efficiency and Big O, linear and binary search, bubble and selection sort (insertion sort is not listed in the guide, but it is a useful comparison)✔Recursion
B2.5File processing: reading, writing, appending, handling errors✔—

Key ideas in one screen

  • Python is dynamically typed; input() always returns a string, so convert with int() or float(). Local vs global scope. Short-circuit evaluation of and/or.
  • Validation types: range, type, length, presence, format, lookup, consistency. Good validation re-prompts and explains the problem.
  • Errors: syntax (caught before running), run-time (crash during execution, e.g. ZeroDivisionError, IndexError), logic (runs but gives the wrong answer — the dangerous one). Test with normal, boundary and erroneous data.
  • Lists give O(1) index access and grow dynamically; dictionaries give O(1) lookup by key; sets give uniqueness and fast membership. Valid indices run from 0 to length−1.
  • Order selection conditions from most to least restrictive. A while loop may run zero times. range(n) gives 0 to n−1.
  • Functions: reusability, decomposition, maintainability, readability, testability. Parameters sit in the definition, arguments at the call.
  • Complexity ladder: O(1) < O(log n) < O(n) < O(n log n) < O(n²) < O(2ⁿ).
  • Linear search O(n), no sorting needed; binary search O(log n) but requires sorted data. Bubble sort O(n²) with O(n) best case using a swapped flag, stable; selection sort always O(n²), few swaps, not stable; insertion sort O(n²) but O(n) on nearly sorted data, stable.
  • HL recursion: base case + recursive case; uses O(depth) stack space; naive Fibonacci is O(2ⁿ); best suited to trees and divide-and-conquer.
  • Files: mode 'w' overwrites, 'a' appends, 'r' reads; use with open(...); write() does not add a newline; handle FileNotFoundError and malformed lines.
  • Static vs dynamic data structures — a static structure has a fixed size set when it is created (a classic array); a dynamic one can grow and shrink while the program runs (a Python list, a linked list).
  • Stack — LIFO. push, pop, peek, isEmpty all O(1); one pointer (top, −1 when empty). Underflow on empty pop, overflow on full push. Uses: call stack, undo, bracket matching, backtracking, reversal.
  • Queue — FIFO. enqueue at rear, dequeue at front, O(1); two pointers. A circular queue uses modulo arithmetic to reuse vacated slots. Uses: print spooling, CPU scheduling, packet buffers, breadth-first search.
B2 · Programming constructs, data structures and error typesThree constructsSequenceone stepafter anotherSelectionif / elif / elseIterationfor / whilewhile may run zero times · range(n) gives 0 … n−1 · orderconditions most-to-least restrictiveChoosing a structurelistordered · index O(1) · grows[3, 7, 2]dictkey → value · lookup O(1){"id": 42}setunique · membership O(1){3, 7}tuplefixed, immutable record(x, y)Three kinds of errorSyntaxCaught before the program runsprint("hi" ← missing bracketRun-timeCrashes during execution10 / 0 · items[len(items)] ·int("abc")LogicRuns, but the answer is wrong< instead of <= skips the last itemTest with normal, boundary and erroneous data — boundaries find the most bugs. Validation checks: presence, type, range,length, format, lookup, consistency.
B2 · Stack (LIFO) and queue (FIFO)Stack — last in, first out3729← toppush(9)pop() → 9push · pop · peek · isEmpty — all O(1)one pointer (top); −1 when emptyunderflow: pop on empty · overflow: push on fullcall stack · undo · bracket matching · backtrackingQueue — first in, first out3729frontreardequeue() → 3enqueue(5)012345circular queue: index = (rear + 1) % sizereuses vacated slots, no shiftingprint spooling · CPU scheduling · packet buffers · BFSAn ADT says what operations exist and how they behave — not how they are stored. A stack can be an array or a linked list.
B2 · Binary search for 45 in a sorted array120191272333454585616747low=0  high=7  mid=333 < 45 → look right: low = 41219273345586174low=4  high=7  mid=558 > 45 → look left: high = 41219273345586174low=4  high=4  mid=445 found at index 4 ✓mid = (low + high) // 2 · each step halves the search space · O(log n) — but only on sorted dataLinear search checks every item, O(n), works on unsorted data. Sorting first (O(n log n)) only pays off if you searchmany times.Index labels above the array run 0 … len−1. Show low, high and mid at every step — that is what the marks are for.
B2 · Bubble, selection and insertion sortOne pass of bubble sort on [5, 3, 8, 1]53815 > 3 → swap35815 < 8 → no swap35818 > 1 → swap35188 has bubbled to the endRepeat passes until a pass makes no swaps (the swappedflag → O(n) best case).BubbleSelectionInsertionIdeaswapneighbours,biggest bubblesupfind minimum,put it in placetake next item,slide it intoplaceWorstO(n²)O(n²)O(n²)BestO(n) with flagO(n²) alwaysO(n) nearlysortedSwapsmanyminimal (n−1)moderateStable?yesnoyesPick whentiny data,simplicitywrites areexpensivedata is nearlysorted /streamingComplexity ladder: O(1) < O(log n) < O(n) < O(n log n) < O(n²) < O(2ⁿ)Justify the algorithm against the scenario: 50,000 nearly sorted records → insertion sort.

Python exam syntax you must know from memory

name = input("Enter name: ")          # always a string
age = int(input("Enter age: "))       # convert explicitly
print(f"{name} is {age}, avg {avg:.2f}")

for i in range(1, 6):                 # 1..5
    ...
while condition:
    ...

items.append(9); items.insert(0, 5)
items.remove(7)                       # by VALUE
del items[0]                          # by INDEX
items[1:3]; items[-1]; len(items)

d = {"a": 1}; d["b"] = 2; d.get("z", 0)
for key, value in d.items(): ...
if "a" in d: ...                      # O(1)

s.split(","); ",".join(lst); s.strip(); s.isdigit()

def total(values, start=0):
    return start + sum(values)

with open("data.txt", "r") as f:
    for line in f:
        parts = line.strip().split(",")
with open("data.txt", "a") as f:
    f.write("text\n")                   # add \n yourself

try:
    n = int(text)
except ValueError:
    print("Not a number")
except FileNotFoundError:
    ...

Websites and videos

B2 · Functions, files and exceptions — the shapes Paper 2 expects from memoryFunction with parametersdef second_largest(items):    if len(items) < 2:        return None    first, second = ...    for v in items[2:]:        ...    return second   # not print!Reading a file safelytry:    with open("data.csv") as f:        for line in f:            parts = line.strip()                        .split(",")except FileNotFoundError:    records = []   # start emptyValidating inputwhile True:    text = input("Score: ")    if not text.isdigit():        print("Numbers only")        continue    n = int(text)    if 0 <= n <= 100: breakFour slips that lose marks every sessioninput() returns a string — convert with int() / float()range(n) is 0 … n−1, not 1 … nitems.remove(x) removes by value; del items[i] by indexf.write() does not add a newline — include \n'w' overwrites · 'a' appends · 'r' reads Parameters live in the definition, arguments at the callIn the IA built-ins are fine; in the exam, “without built-in functions” means write the loop yourself.

Exam tips for B2 (Paper 2)

  • Stack/queue trace questions: draw the structure after every operation and write what each operation returns. peek() does not remove.
  • Underline the requirement. “Return the index” is not “return the value”; “do not use built-in functions” means write the loop yourself.
  • Write comments as you go — they show intent and earn marks when the code has a slip.
  • Handle the edge cases: empty list, one element, value not found, division by zero. Initialise a maximum with the first element, not 0 (negative data breaks 0).
  • Watch loop bounds: range(len(items)) not range(len(items)+1); the last valid index is len−1.
  • For sorting questions, justify the algorithm against the scenario: nearly sorted → insertion sort; minimal writes → selection sort; small and simple → bubble sort.
  • Hand-trace bubble, selection, insertion sort and binary search on 6–8 element arrays until it is automatic.
  • Minor syntax slips are rarely penalised unless syntax is the point; logic errors always are. If you forget a method name, write clear pseudocode and say what you intend.
  • Practise both modes: built-ins allowed (IA) and built-ins banned (exam).

Practice questions

1Distinguish between a variable and a constant, and state one advantage of using a constant.3 marks
Mark-scheme notes. Variable: named memory location whose value can change [1]; constant: named value fixed after initialisation [1]; advantage: prevents accidental modification / self-documenting / single point of change [1].
2Describe three types of validation that could be applied to a field storing a student's date of birth.6 marks
Mark-scheme notes. 2 marks each (name + application): presence — must not be blank; format — matches DD/MM/YYYY; range — not in the future, not >120 years ago; type — components numeric; consistency — day valid for month (reject 30 Feb).
3Distinguish between a run-time error and a logic error, giving an example of each.4 marks
Mark-scheme notes. Run-time: occurs during execution and stops the program [1], e.g. division by zero or index out of range [1]; logic: program completes but output is wrong [1], e.g. < instead of <= skipping the last element [1].
4Construct an algorithm in Python that reads a list of integers and returns the second largest value, without using built-in sorting or max functions.6 marks
Mark-scheme notes. Marks: two tracking variables [1]; initialised from the first two elements so negatives work [1]; single loop over the rest [1]; update both when a new maximum appears [1]; update only second when value lies between [1]; return second, handling lists shorter than two [1]. Sketch: if len(items) < 2: return None; first, second = (items[0], items[1]) ordered; for v in items[2:]: if v > first: second, first = first, v; elif v > second and v != first: second = v; return second.
5Trace a binary search for the value 45 in [12, 19, 27, 33, 45, 58, 61, 74]. Show low, high and mid at each step.4 marks
Mark-scheme notes. low 0, high 7, mid 3 → 33 < 45 so low 4 [1]; low 4, high 7, mid 5 → 58 > 45 so high 4 [1]; low 4, high 4, mid 4 → 45 found [1]; return index 4 after three comparisons [1].
6Explain why binary search cannot be used on an unsorted array, and evaluate whether sorting an array before searching is worthwhile.6 marks
Mark-scheme notes. Binary search discards half the array by assuming everything left of mid is smaller [1]; unsorted data breaks that assumption so the target may be discarded [1]. Sorting costs O(n log n) or O(n²) [1]; one search is O(n) linear vs O(log n) binary [1]; so sorting pays only when many searches follow [1]; conclusion conditional on search frequency [1].
7A company must sort 50,000 customer records that are already almost in order. Compare bubble, selection and insertion sort for this task and justify which is most suitable.6 marks
Mark-scheme notes. All three are O(n²) worst case [1]; selection sort is always O(n²) regardless of order [1]; bubble sort with a swapped flag approaches O(n) on nearly sorted data [1]; insertion sort is O(n) on nearly sorted data with fewer swaps than bubble [1]; both are stable [1]; choose insertion sort [1].
8Describe two errors a program reading from a text file should handle, and outline how each should be handled.4 marks
Mark-scheme notes. Missing file → catch FileNotFoundError and start with empty data or ask for a path [2]; malformed line (wrong number of fields or non-numeric value) → catch ValueError/IndexError, skip the line and warn the user [2].
9A stack contains 3, 7, 2 with 2 at the top. State the contents and any values returned after: push(9), pop(), peek(), push(5), pop().5 marks
Mark-scheme notes. push(9) → 3,7,2,9; pop() returns 9 → 3,7,2; peek() returns 2, unchanged; push(5) → 3,7,2,5; pop() returns 5 → 3,7,2. Final: 3,7,2 with 2 on top.
10Explain why a circular queue is preferable to a linear array implementation of a queue.4 marks
Mark-scheme notes. Linear: dequeue advances front leaving unusable slots [1]; rear reaches the end and reports full although space remains [1]; circular uses modulo so indices wrap to 0 [1]; reuses space without O(n) shifting [1].
11Explain the role of the base case in a recursive algorithm and describe what happens if it is omitted.3 marks
Mark-scheme notes. The base case returns a value without a further recursive call [1], guaranteeing termination [1]; without it calls continue until the call stack overflows (RecursionError) [1].
12Evaluate the use of recursion rather than iteration for calculating Fibonacci numbers.6 marks
Mark-scheme notes. For: mirrors the mathematical definition, concise, readable [2]. Against: naive recursion recomputes subproblems giving O(2ⁿ) time and O(n) stack space; iteration is O(n) time and O(1) space [3]. Conclusion: iteration (or memoised recursion) for anything beyond tiny n [1].

B3 · Object-oriented programming

Paper 2 · SL 7 hours / HL 23 hours · Single-class OOP for everyone; inheritance, polymorphism, UML and design patterns for HL.

What the syllabus expects

CodeTopicSLHL extra
B3.1OOP with a single class: benefits and trade-offs of OOP, designing classes with UML class diagrams, static vs non-static members, classes, objects and constructors, encapsulation and access modifiers✔—
B3.2OOP with multiple classes: inheritance, polymorphism including method overriding, abstraction and abstract classes, composition and aggregation, design patterns (singleton, factory, observer)—HL only

Key ideas in one screen

  • A class is a template; an object is an instance with its own state. The constructor (__init__) initialises a new object. Attributes hold state, methods define behaviour, self refers to the current object.
  • Encapsulation bundles data with the methods that act on it and restricts direct access: attributes private (self.__balance), methods public. Benefits: validated setters protect integrity, the implementation can change without breaking callers, reduced coupling. Python enforces privacy by convention (name mangling), Java by keyword.
  • Static (class) members are shared by every object; instance members belong to each object.
  • HL four pillars: abstraction (expose only what matters), encapsulation (the mechanism enforcing it), inheritance (an “is-a” relationship; super() calls the parent constructor), polymorphism (one interface, many behaviours).
  • HL: overriding = same signature in a subclass, resolved at run time; overloading = same name, different parameters, resolved at compile time. Polymorphism removes type-checking if/elif chains and lets systems grow without modification.
  • HL: abstract classes cannot be instantiated and force subclasses to implement methods; interfaces define capability contracts.
  • HL UML: + public, − private, # protected; hollow triangle points at the superclass; filled diamond = composition (part dies with the whole); hollow diamond = aggregation (part survives).
B3 · Class, objects and encapsulationBankAccount (class = template)− __holder : str− __balance : float+ __init__(holder, balance)+ deposit(amount) : bool+ withdraw(amount) : bool+ get_balance() : float− private attribute + public methodacc1 : BankAccountholder = 'Ana'balance = 120.0acc2 : BankAccountholder = 'Ben'balance = 0.0objects = instances,each with its own stateWhy encapsulate?Attributes private → outsidecodecannot set balance = −999All changes go through methodsthat validate → data integrityImplementation can changewithout breaking callersclass BankAccount:    def __init__(self, holder, balance=0):        self.__holder = holder            # __ makes it private        self.__balance = balance    def withdraw(self, amount):        if amount <= 0 or amount > self.__balance: return False   # validate first        self.__balance -= amount; return TrueStatic (class) members are shared by every object; instance members belong to each object.
B3 · Inheritance, polymorphism and UML relationships (HL)Person# name: str# email: str+ describe(): strStudent- yearGroup: int+ describe(): strTeacher- department: str+ describe(): strHollow triangle points at the superclass (“is-a”).Student and Teacher inherit name and email;each overrides describe() → polymorphism.Course- code: str- title: str+ enrol(s: Student)Room- number: strStudent1..*aggregation (hollow diamond): students surviveif the course is cancelledBuildingcomposition (filled diamond): a Room cannotexist without its BuildingOverriding: same signature in a subclass,resolved at run timeOverloading: same name, different parameters,resolved at compile timeVisibility: + public − private # protected. super() calls the parent constructor.

Websites and videos

Exam tips for B3

  • When you write a class in the exam: constructor with validation, private attributes, getters, and methods that return a success/failure result. Comment the validation — it is where the marks are.
  • “Explain how encapsulation improves reliability and maintainability” wants two threads: validated setters protect state (reliability); hidden implementation can change without touching callers (maintainability).
  • HL: for a UML question, decide the relationship type first (inheritance / composition / aggregation) from the wording — “students continue to exist if a course is cancelled” means aggregation.
  • HL: “evaluate inheritance” — reuse, extensibility and maintainability versus tight coupling, the fragile base class problem and misuse where composition fits better; conclude with when to prefer composition.
  • Do not confuse abstraction (deciding what to expose) with encapsulation (the mechanism that enforces it).

Practice questions

1Distinguish between a class and an object.2 marks
Mark-scheme notes. Class: template defining attributes and methods [1]; object: a specific instance created at run time holding its own values [1].
2Describe the purpose of a constructor.3 marks
Mark-scheme notes. Special method run automatically when an object is created [1]; initialises attributes to valid starting values [1]; ensures the object is usable and consistent from the moment it exists, possibly validating arguments [1].
3Explain how encapsulation improves the reliability and maintainability of a program.6 marks
Mark-scheme notes. Reliability: attributes private so external code cannot alter them [1]; changes go through validating mutators so invalid state is impossible [1]; faults are localised to one method [1]. Maintainability: internal representation hidden behind a public interface so it can change freely [1]; e.g. switching from array to list needs no change in callers [1]; reduced coupling [1].
4A BankAccount class stores a balance. Construct the class in Python with a constructor, a deposit method and a withdraw method. Withdrawals must not make the balance negative.8 marks
Mark-scheme notes. Marks: class with private balance [1]; further attribute such as holder [1]; constructor validating non-negative opening balance [1]; deposit method [1] validating amount > 0 [1]; withdraw method [1] checking sufficient funds [1]; returns/feedback indicating success or failure [1]. Sketch: class BankAccount: def __init__(self, holder, balance=0): ...; def deposit(self, amount): if amount <= 0: return False; self.__balance += amount; return True; def withdraw(self, amount): if amount <= 0 or amount > self.__balance: return False; self.__balance -= amount; return True.
5Distinguish between static and instance attributes, giving an example of an appropriate use of each.4 marks
Mark-scheme notes. Static/class attribute is shared by all objects [1], e.g. an interest rate or count of accounts created [1]; instance attribute is unique to each object [1], e.g. each account's balance [1].
6Distinguish between overriding and overloading.4 marks
Mark-scheme notes. Overriding: subclass redefines a method with the same signature [1], resolved at run time by the object's actual type [1]; overloading: same method name with different parameter lists in the same class [1], resolved at compile time by the arguments [1].
7Explain, with an example, how polymorphism reduces the need for conditional statements.5 marks
Mark-scheme notes. Without polymorphism, code checks the type (if isinstance(shape, Circle): ... elif ...) [1]; with polymorphism each subclass overrides area() [1]; the caller simply calls shape.area() and the correct version runs [1]; new shapes need no change to the caller [1]; example with Shape/Circle/Square [1].
8A school system has classes Person, Student, Teacher and Course. A course is taught by one teacher and has many students; students continue to exist if a course is cancelled. Construct a UML class diagram.7 marks
Mark-scheme notes. Person superclass with Student and Teacher inheriting (hollow triangle toward Person) [2]; Course class [1]; Teacher–Course association 1 to many [1]; Course–Student aggregation (hollow diamond on Course) with multiplicities 1..* [2]; attributes with visibility symbols [1].
9Distinguish between composition and aggregation, giving an example of each.4 marks
Mark-scheme notes. Composition: strong has-a, part cannot exist without the whole [1], e.g. Room in a House [1]; aggregation: weak has-a, part survives the whole [1], e.g. Student in a Course [1].

B4 · Abstract data types (HL only)

Paper 2 · HL 23 hours · Linked lists, binary search trees, sets and hash tables. HL only — stacks and queues are in B2.2 and are examined at SL and HL.

What the syllabus expects

CodeTopicHL
B4.1.1The purpose of abstract data types (ADTs): defined by operations and behaviour, not implementation✔
B4.1.2–B4.1.3Linked lists: singly, doubly and circular; evaluate, build and apply them; insertion and deletion; comparison with arrays✔
B4.1.4Binary search trees (BSTs): structure, insertion, deletion, searching and traversal✔
B4.1.5Sets: operations, membership, subset and superset checks✔
B4.1.6Hash tables and sets: how they work and how they are implemented (dict/set in Python, HashMap/HashSet in Java)✔

Key ideas in one screen

  • An ADT defines the operations and their behaviour, not the implementation. A linked list is an ADT; a node-and-pointer structure is an implementation. This is abstraction applied to data.
  • Linked list — nodes with data plus a pointer to the next node. Dynamic size and O(1) insertion at the head, but O(n) access by position and poor cache performance. When inserting, set the new node's pointer before redirecting the previous node's.
  • Binary search tree — left subtree smaller, right subtree larger. O(log n) search/insert/delete when balanced; degrades to O(n) if built from sorted input.
  • Traversals: in-order (L, N, R) gives sorted order; pre-order (N, L, R) copies a tree; post-order (L, R, N) deletes a tree.
  • Set — a collection of unique items with no required order. Key operations: add, remove, membership test, union, intersection and difference; A is a subset of B if every item of A is in B.
  • Hash table — a hash function turns a key into an index, so a value can usually be found without searching: average O(1) lookup, insertion and deletion. Two keys can hash to the same index (a collision), which the implementation must handle, for example by chaining or probing. Python's dict and set and Java's HashMap and HashSet are hash tables.
  • Stacks and queues are core content in B2.2 (SL and HL) — see the B2 page.
B4 · Inserting a node into a singly linked list (HL)head122758None40new node1 new.next = current.next2 current.next = newDo step 1 first — reversing the order loses the rest of the list.vs arrays+ dynamic size, no resizing+ O(1) insert/delete at a known spot− O(n) access by position− pointer memory, poor cache localityDoubly linked: pointers both ways. Circular: last node points back to the head.
B4 · Binary search tree built from 40, 20, 60, 10, 30, 50, 70, 35 — and its traversals (HL)4020601030507035left subtree < node < right subtree35 > 20 → right, 35 > 30 → right, 35 < 40 … so 35 is the rightchild of 30In-order (L, N, R)10 20 30 35 40 50 60 70sorted output!Pre-order (N, L, R)40 20 10 30 35 60 50 70copies the treePost-order (L, R, N)10 35 30 20 50 70 60 40deletes the treeLevel-order40 20 60 10 30 50 70 35uses a queueBalanced: search/insert/delete O(log n)Built from sorted data: a chain, O(n)If your in-order traversal is not sorted, your tree is wrong — check it before answering the rest.

Websites and videos

Exam tips for B4

  • For BST questions, draw the tree carefully from the insertion order, then write the three traversals directly underneath — the in-order must come out sorted; if it does not, your tree is wrong.
  • Linked-list insertion: explain the pointer order (new.next = current.next, then current.next = new). Reversing the order loses the rest of the list — say so.
  • “Discuss which ADT is most appropriate” answers follow the pattern: operations needed → complexity of each candidate → alternative and why it loses → conclusion.
  • Link to other topics for top marks: the call stack and recursion (B2.4.4), queues and CPU scheduling (A1.3.3), Huffman trees and compression (A1.1).

Practice questions

1Define the term abstract data type and distinguish it from a data structure.3 marks
Mark-scheme notes. ADT: defined by the operations it supports and their behaviour [1] without specifying implementation [1]; data structure: the concrete arrangement in memory realising it, e.g. a stack implemented as an array or linked list [1].
2Explain two advantages and two disadvantages of a linked list compared with an array.8 marks
Mark-scheme notes. Advantages: dynamic size with no wasted capacity or resizing [2]; O(1) insertion/deletion at a known position without shifting elements [2]. Disadvantages: O(n) access by index because nodes must be followed from the head [2]; extra memory per node for pointers and poor cache locality as nodes are scattered [2].
3Construct a binary search tree by inserting, in order: 40, 20, 60, 10, 30, 50, 70, 35.4 marks
Mark-scheme notes. Root 40; 20 left, 60 right; 10 left of 20, 30 right of 20; 50 left of 60, 70 right of 60; 35 right of 30. Marks for root, correct second level, correct third level, 35 placed under 30.
4For that tree, state the output of an in-order, a pre-order and a post-order traversal.6 marks
Mark-scheme notes. In-order: 10 20 30 35 40 50 60 70 [2]; pre-order: 40 20 10 30 35 60 50 70 [2]; post-order: 10 35 30 20 50 70 60 40 [2].
5Explain why the order in which values are inserted into a BST affects its efficiency.5 marks
Mark-scheme notes. Each value's position depends on comparisons with existing nodes [1]; inserting sorted data makes every node a right child [1], giving a degenerate tree of height n [1]; search becomes O(n) like a linked list [1]; random or balanced order keeps height about log n and operations O(log n) [1].
6A system must store many records, search by unique ID, retrieve them in sorted order, and update frequently. Discuss which ADT is most appropriate.6 marks
Mark-scheme notes. Requirements: fast search, sorted retrieval, frequent inserts/deletes [1]; sorted array gives O(log n) search but O(n) inserts [1]; linked list gives cheap inserts but O(n) search [1]; a BST gives O(log n) search, insert and delete when balanced [1] and in-order traversal yields sorted output [1]; conclusion: balanced BST, noting the need for balancing if IDs arrive in order [1].
7Describe what a hash table is and explain why looking up a value is usually fast.4 marks
Mark-scheme notes. A key is passed through a hash function to give an index [1]; the value is stored at (and retrieved from) that position [1]; so the data does not have to be searched item by item [1]; average lookup, insertion and deletion are O(1) [1].
8Explain what a collision is in a hash table and describe one way of handling it.3 marks
Mark-scheme notes. A collision is when two different keys hash to the same index [1]. Chaining: each index holds a list (for example a linked list) of all entries that hash there [2] — or open addressing: probe for the next free slot [2]. Award 1 for naming a method and 1 for how it works.
9Set A = {2, 4, 6, 8} and set B = {4, 8, 10}. State the union, the intersection and the difference A − B.3 marks
Mark-scheme notes. Union {2, 4, 6, 8, 10} [1]; intersection {4, 8} [1]; difference A − B {2, 6} [1].

Internal Assessment · The computational solution

30% at SL, 20% at HL · 35 hours · 30 marks · ≤2,000 words · mandatory video (max 5 minutes).

The IA is marked on the documentation of a development process, not on how impressive the program is. A modest program that is well specified, planned, tested and honestly evaluated beats a spectacular program with thin documentation — every time.

The five criteria

CriterionFocusMarksSuggested words
AProblem specification — problem statement, constraints, numbered success criteria4150–200
BPlanning — design (flowcharts, pseudocode, UML, ERD, data-structure and interface sketches), dated development log, test plan4200–250
CSystem overview — architecture diagram, data structures justified against alternatives, data flow, file format, menu tree6300–350
DDevelopment — 3 to 5 significant techniques: name, code extract, how it works, why chosen, difficulty resolved12700–800
EEvaluation — every success criterion checked with evidence and video timestamps; specific, justified improvements4250–300
IA · Where the 30 marks sit and what each criterion wantsA · 4B · 4C · 6D · 12E · 4Criterion D carries 12 of the 30 marks (40%) — it asks you to justify techniques, not describe what the program does.A · Problemspecificationproblem statement,constraints,6–8 numbered successcriteriaB · Planningdesign diagrams,dated dev log,test plan (normal/boundary/erroneous)C · System overviewarchitecture, datastructuresjustified vsalternatives, dataflowD · Development3–5 techniques: name,code,how, why overalternatives,difficultyE · Evaluationevery criterionchecked withevidence + videotimestamps;improvementsY1 T3choose problem,draft AY2 T1 earlydesign & test plan (B)log every weekY2 T1 mid–latebuild, test,write C and DY2 T1 endrecord videoY2 T2 earlyevaluation (E),submit ≤ 2,000 wordsDeliverables: written document (word count on page 1) · full source code appendix · video showing every success criterionand invalid input handled.

Criterion D carries 12 of the 30 marks (40%), and it is where most students underperform because they describe what the program does instead of justifying the techniques used. Deliverables: the written document (word count on page 1), full source code as an appendix, and a video of the solution running. Confirm criterion names and mark bands against your teacher's copy of the official guide.

Choosing a problem

  • Solvable in roughly 20 hours of coding — not 5, not 100.
  • Clear input → process → output structure, with data that persists in files.
  • Natural complexity: searching, sorting, validating, calculating, relating several entities.
  • Objectively testable — you can state what the right answer is.
  • Interesting enough to hold your attention for 35 hours. There is no client requirement any more; pick a problem you actually care about.
Works wellWhy
Sports league manager (fixtures, results, standings)Related entities, calculation, sorting, persistence
Library or equipment loan systemRecords, searching, dates, overdue calculation
Flashcards with spaced repetitionScheduling algorithm, persistence, statistics
Recipe manager with shopping-list generationAggregation across records, unit handling, search
Personal finance tracker with categorised reportsCalculation, grouping, date filtering, validation
Timetable clash-checkerConstraint checking, a real algorithm
Goes wrongWhy
“A game” (unspecified)All interface, little computation, hard to test
A website or web appTime drains into styling and frameworks
Anything built on ML librariesThe library does the work; the complexity is not yours
A calculator or a basic quizNot enough complexity (a quiz needs adaptive difficulty or analytics to count)
Something enormous (“a social network”)Unfinished — and Criterion E will expose it
A followed tutorialNot your work; academic integrity risk

Writing success criteria that score

IA · Success criteria that score — specific, measurable, testableWeak — cannot be testedStrong — you can prove it in Criterion EThe system will be user-friendlySC1 A result can be recorded in under 30 s using only menuselectionsThe system will store dataSC2 All fixtures persist in a CSV file and reload automaticallyon start-upThe system will be reliableSC3 Blank, non-numeric, negative or out-of-range input isrejected with a message naming the problem; no crashThe system will calculate standingsSC4 Standings ordered by points then goal difference match amanual table for all 20 test fixturesNumber them SC1, SC2 … and reference each one by number, with evidence, in the evaluation table.
WeakStrong
The system will be user-friendlyA user can record a new result in under 30 seconds using only menu selections
The system will store dataAll fixture data persists in a CSV file and reloads automatically on start-up
The system will be reliableNon-numeric, negative, out-of-range or blank input is rejected with a message naming the problem; the program never terminates unexpectedly
The system will calculate standingsStandings are calculated from stored results, ordered by points then goal difference, matching a manual table for all 20 test fixtures

Aim for six to eight numbered criteria (SC1, SC2 …) so you can reference them precisely in Criterion E.

Criterion D — the structure that works

  • Name the technique (e.g. “insertion into a dictionary with a uniqueness check”).
  • Show a focused, commented code extract — not the whole file.
  • Explain how it works, step by step.
  • Justify why you chose it over the alternatives, against a specific requirement.
  • Note a difficulty and how you resolved it.
  • Techniques that count: searching/sorting you wrote yourself, non-trivial data structures (ADTs at HL), file handling with error recovery, comprehensive validation, OOP design (inheritance/polymorphism at HL), recursion where genuinely appropriate, multi-condition aggregation, parameterised sub-programs, algorithms with a real complexity argument.
  • Techniques that do not count: printing, arithmetic, a single if, a counting loop, or a built-in that does the whole interesting job.
  • Comment the why, not the what.

Criterion E — be honest

Work through every success criterion by number with evidence (test IDs, video timestamps). Examiners can read your code and watch your video; an honest “partially met” scores better than an inflated claim. Improvements must be specific and follow from your own identified shortcomings — “replace the CSV with SQLite to enforce data types at the storage layer”, not “store data better”.

The video

  • Screen recording of no more than 5 minutes, showing the product working and examples of testing.
  • Demonstrate each success criterion in turn, narrated or captioned.
  • Show failures being handled — invalid input rejected, missing file recovered — not only the happy path.
  • Reference timestamps in your Criterion E table.

A 35-hour schedule

PhaseHoursOutput
Problem selection and research2A decided, scope-tested problem
Criterion A — specification3Problem statement, constraints, 6–8 numbered success criteria
Criterion B — design and planning4Flowcharts, structure diagram, test plan, log started
Development — core functionality10Working input, storage and main processing
Development — complexity and refinement6The techniques you will write up in D; validation; error handling
Testing and debugging4Test plan executed with actual results recorded
Criteria C and D — write-up4System overview and development documentation
Criterion E — evaluation1Evaluation table and improvements
Video and final checks1Video recorded, word count verified, code appended

Course checkpoints

WhenCheckpoint
Y1 Term 3Topic exploration, problem chosen, Criterion A drafted
Y2 Term 1 (early)Design and planning (Criterion B) approved before serious coding
Y2 Term 1 (mid–late)Development log up to date; working solution (Criterion C/D)
Y2 Term 1 (end)Video recorded
Y2 Term 2 (early)Evaluation (Criterion E); final submission

Academic integrity

  • All code must be your own except clearly identified library use.
  • Cite any adapted code in a comment at the point of use and in a bibliography.
  • AI-generated code must be declared; undeclared AI use is academic misconduct.
  • Keep the dated development log from week one — it is evidence of authorship as well as marks in Criterion B.

Final checklist

  • Word count stated on page 1 and under 2,000 (code, comments, diagrams, tables, captions and appendices excluded).
  • All five criteria in clearly headed sections; success criteria numbered and referenced in E.
  • Dated development log; test plan with actual (not just expected) results.
  • Three to five techniques explained and justified in D; complexity is not a built-in doing the interesting work.
  • Evaluation honest, including unmet criteria; improvements specific.
  • Video plays, is within the length limit, shows each criterion and invalid input handling; timestamps referenced.
  • Full source code appended; bibliography and AI declaration included.

Tools and resources for the IA

Case study · Paper 1 Section B

Compulsory for SL and HL. 2027: “Generative AI for image creation — a diffuse vision”.

SLHL
Section B marks12 (2 questions)24 (4 questions)
Paper 1 duration1 h 15 min2 h

The case study is a pre-seen scenario released about twelve months before the May session. You do not get the document in the exam. Section B rewards two things: understanding the specific technologies it names (including ones outside the syllabus) and applying syllabus knowledge to that scenario rather than answering generically. An answer that could have been written without reading the case study scores poorly however accurate it is.

A six-step method (start the week it is released)

Case study · A twelve-month method (Paper 1 Section B)1 Read × 3story → terms →tensions2 Glossary30–50 entries:define · how ·why herepros · cons ·syllabus link3 Mapone row persyllabus sub-topicthe scenariotouches4 Predictwrite 10questionswith commandterms;answer to time5 Researchlook up the namedtechnologiesbeyondthe syllabus6 Applyanchor everypointto the scenario —never generic2027: “Generative AI for image creation — a diffuse vision” → expect diffusion models, GPU/TPU training, datasets andconsent,latent space, watermarking and provenance, deepfakes, bias, environmental cost (A1.1, A4.1, A4.3, A4.4, A2.1, A3.4)SL: 12 marks, 2 questions · HL: 24 marks, 4 questions — budget time for Section B before you start Section AAn answer that could have been written without reading the case study scores poorly, however accurate it is.
  • Read it three times: once for the story, once highlighting every technical term, once for the tensions (cost vs performance, privacy vs functionality, reliability vs complexity). Examiners write questions about tensions.
  • Build a glossary of 30–50 entries at four or five a week. For each term: definition, how it works, why it is used in this scenario, advantages, limitations, syllabus link.
  • Map the case study onto the syllabus: one row per sub-topic it touches (for 2027 expect A1.1 GPU/TPU hardware, A1.1 compression and storage, A4.1 deep learning, A4.3 neural networks and CNNs, A4.4 ethics, A2.1 cloud infrastructure, A3.4 large-scale data).
  • Write your own questions using the command terms — explain why X rather than Y (6), discuss the ethical implications (8), evaluate the security/safeguards (8), describe how a named technology operates (4), recommend an improvement (6) — and answer them to time.
  • Research beyond the document: manufacturer documentation, technical overviews, standards summaries. Questions can target these terms directly.
  • Practise applying, not reciting: anchor every point to the organisation, system or data in the scenario.

Glossary entry template

FieldContent
TermExact term as it appears
DefinitionOne or two sentences in your own words
How it worksTwo to four sentences of mechanism
Why it is used hereIts role in this scenario
AdvantagesTwo or three, relevant to this context
LimitationsTwo or three, relevant to this context
Syllabus linkWhich sub-topic it connects to

Likely themes for a generative image AI case study

  • How diffusion models generate images from noise, and what training them requires (GPU/TPU clusters, datasets, energy).
  • Training data: where images come from, copyright and artist consent, bias in what the model has seen.
  • Prompting, latent representations, resolution and compute cost at inference; edge vs cloud generation.
  • Safeguards: content filtering, watermarking, provenance metadata, deepfakes and misinformation.
  • Ethics (A4.4): fairness, transparency, accountability, environmental impact, effect on creative professions.

Resources

Exam technique

Turning what you know into marks — command terms, answer structure, Paper 2 habits and the week before.

Most people lose marks they did not need to lose: they answer “explain” as if it said “describe”, or write four marks of material for a two-mark question. Fixing that is worth more than another week of content revision.

Command terms

Exam technique · Command terms — what each one is really asking forState · Identify · Define · List ·Outlinethe answer only — one point each, no developmentDescribewhat happens, in sequence, with detailExplainWHY — every point needs a “because”, “so that” or “which means”Compare · Distinguish · Contrastboth items in every sentence: “whereas X …, Y …”Analyse · Discussbreak down; several perspectives, both sidesEvaluate · Justify · Recommendboth sides AND a reasoned (ideallyconditional) conclusionConstruct · Tracethe artefact itself: diagram, code,table — correctly formedMarks tell you how many developed points: a 4-mark question wants four. About 1.5 minutes per mark.Point → because → example/consequence. Top-band answers link topics (cache → arrays → linked lists; recursion → callstack).The three that cost the most: “explain” answered as “describe”; “compare” as two separate descriptions; “evaluate” with nojudgement.
TermWhat is requiredWhat earns marks
State / IdentifyThe answer onlyOne point, no development
DefineThe precise meaningAn accurate definition
List / OutlineBrief pointsSeveral separate, brief points
DescribeA detailed accountWhat happens, in sequence, with detail
ExplainReasons or causesWhy — every point needs a “because”
CompareSimilarities and differencesBoth items in every point
Contrast / DistinguishDifferencesDifferences only, both items in every point
AnalyseBreak down and interpretComponents, relationships, implications
DiscussA balanced reviewMultiple perspectives; a conclusion is optional
EvaluateStrengths, weaknesses and a judgementBoth sides and a conclusion
JustifyValid reasons for a choiceReasons, and why alternatives are inferior
Suggest / RecommendA proposalA proposal with reasoning
ConstructProduce a diagram, algorithm or tableThe artefact, correctly formed
TraceFollow step by stepA completed trace table

The three that cost the most

  • “Explain” answered as “describe”. Test: does every point contain a “because”, “so that” or “which means”? If not, you are describing and capped at about half marks.
  • “Compare” answered as two separate descriptions. Each sentence must reference both items: “Whereas a stack removes from the same end it inserts at, a queue removes from the opposite end.”
  • “Evaluate” with no judgement. Both sides, then a reasoned, ideally conditional, conclusion: “X is preferable where the data is nearly sorted; Y at scale.”

Structure for a 6–8 mark Paper 1 answer

  • One sentence defining or setting out the key concept.
  • Three or four developed points: claim → because → example or consequence.
  • For discuss/evaluate, at least one point on the other side.
  • For evaluate/justify, a conclusion.
  • Read the mark allocation: a 4-mark question wants four developed points. Budget about 1.5 minutes per mark.
  • Top-band answers make synoptic links: cache locality → array performance → arrays vs linked lists; SQL injection → parameterised queries → input validation; abstraction → OS → three-schema architecture → encapsulation → ADTs → TCP/IP layers; recursion → call stack → stack overflow.

Paper 2 technique

  • Underline the exact requirement: return vs print, index vs value, “without built-in functions”.
  • Comment as you go; handle empty input, one element, not found, division by zero.
  • Initialise correctly (a maximum set to 0 fails on negative data); check loop bounds (range(n) is 0 to n−1).
  • Always draw the trace table — it earns marks even if the final answer is wrong.
  • “Explain your choice of data structure”: name it, give its complexity for the operations that matter here, name the alternative, say why it loses.
  • Do not panic over syntax; logic errors are what cost marks. If you forget a method name, write clear pseudocode and state your intent.

Common errors to avoid

  • Confusing validation (is the data reasonable?) with verification (was it entered correctly?).
  • Confusing abstraction with encapsulation; overriding with overloading; composition with aggregation.
  • Saying NAT provides security.
  • Treating a high accuracy figure as proof of a good ML model without checking class imbalance.
  • Forgetting that binary search needs sorted data, or that in-order traversal of a BST gives sorted order.
  • Drawing the UML inheritance triangle pointing at the subclass.
  • Running out of time on Section A and leaving Section B unattempted — it is 12 marks at SL and 24 at HL. Budget for it first.

The week before

  • Work through the key-ideas summaries on every topic page.
  • Re-read your case study glossary and predicted questions.
  • Hand-trace bubble, selection and insertion sort and binary search on small arrays until automatic.
  • Practise drawing: the CPU diagram, a logic circuit and truth table, an ERD, a UML class diagram, a BST with its three traversals.
  • Do one full past-style paper to time, including Section B, in your exam mode (paper or digital).
  • Confirm your Paper 2 language (Python) and exam mode with your coordinator.

Resources