IB Computer Science HL cheat sheet
IB Computer Science HL · Keep the key ideas within reach.
System Fundamentals
A system is a set of interrelated components working toward a goal; its boundary separates it from its environment, and inputs/outputs cross that boundary.
Waterfall suits fixed, well-understood requirements; iterative/incremental and Agile suit changing requirements because each cycle delivers a testable working product.
Deployment methods: direct changeover (fast, total, high risk), parallel running (safe, costly, duplicates data entry), phased (staged by module or site), pilot (one group first).
Data migration risks: loss of precision on field-type changes, orphan records from broken foreign keys, truncation of over-long strings, and encoding mismatch in text fields.
A backup is a copy for recovery; archiving moves inactive data to cheaper storage for retention. Neither is a substitute for the other.
Acceptance testing uses real users and real data against agreed criteria; alpha testing is in-house, beta testing is at end-user sites.
Release notes and user documentation are deliverables: a version number, a change list, known issues, and rollback instructions should accompany every release.
Data loss safeguards: validation at input (type, range, presence, format, check digit), verification (double entry, visual proofreading), and access control by role.
Computer Organization
Von Neumann architecture: a single memory holds both instructions and data; the CPU fetches, decodes, and executes sequentially through the fetch-execute cycle.
Fetch-execute: PC -> MAR, memory read -> MBR, MBR -> CIR, PC incremented, CIR decoded, operands fetched, ALU executes, result written back.
Address bus width n gives 2^n addressable locations; data bus width m transfers m bits per cycle; control bus carries read/write and clock signals.
Cache hierarchy: L1 fastest and smallest, then L2, L3, then RAM; hit rate and locality (temporal, spatial) determine effective access time.
Two's complement negation: invert all bits and add 1. Range for n bits is -2^(n-1) to 2^(n-1)-1; the MSB is the sign bit.
Floating point follows sign, exponent, mantissa: value = (-1)^s x 1.mantissa x 2^(exponent-bias). More mantissa bits give precision, more exponent bits give range.
Pipelining overlaps instruction stages to raise throughput; hazards are data, control, and structural, mitigated by forwarding, stalls, and branch prediction.
RISC favours simple fixed-length instructions and many registers; CISC favours complex variable-length instructions. Clock speed alone does not determine performance.
Networks
TCP is connection-oriented with sequencing, acknowledgements, and retransmission; UDP is connectionless with no delivery guarantee, suited to streaming and DNS queries.
OSI seven layers: physical, data link, network, transport, session, presentation, application. TCP/IP collapses these into link, internet, transport, application.
IPv4 address plus subnet mask identifies network and host portions; the network address has all host bits 0 and the broadcast address has all host bits 1.
A packet's TTL is decremented at each router and discarded at zero, preventing indefinite circulation; traceroute exploits this by varying TTL.
DHCP assigns IP configuration dynamically; DNS resolves names to addresses; NAT maps private addresses to a public address at the gateway.
Switches forward frames by MAC address within a LAN; routers forward packets by IP address between networks.
Wireless security: WEP is broken, WPA2/WPA3 use stronger encryption. Open networks allow traffic interception, so HTTPS/TLS is needed for confidentiality.
Threat mitigations: firewall for filtering, encryption for confidentiality, digital certificates for authentication, hashing for integrity, and access logs for audit.
Computational Thinking and Programming
Decomposition, pattern recognition, abstraction, and algorithm design are the four computational thinking pillars; abstraction removes detail irrelevant to the problem.
Algorithm properties: finite, unambiguous, has defined inputs and outputs, and terminates. A flowchart or pseudocode must be traceable by hand.
Search: linear is O(n) and needs no order; binary is O(log n) but requires a sorted collection and random access.
Sorting: bubble/selection/insertion are O(n^2) comparisons; merge sort is O(n log n) and stable but needs O(n) extra space.
Recursion needs a base case and progress toward it; each call consumes stack space, so deep recursion risks stack overflow.
Boolean identities: De Morgan's laws, distributivity, absorption, and A + A' = 1 allow simplification of logic expressions before building circuits.
Standard constructs: sequence, selection (if/else, switch), iteration (count-controlled, condition-controlled, collection-controlled).
Programming paradigms: procedural, object-oriented (encapsulation, inheritance, polymorphism), and declarative, each shaping how a problem is modelled.
Abstract Data Structures (HL)
A static structure has fixed capacity (array); a dynamic structure grows at run time (linked list, dynamic array), trading memory overhead for flexibility.
Stack is LIFO with push/pop/peek; queue is FIFO with enqueue/dequeue. Both are O(1) at the ends, O(n) for search.
Linked list operations: insert or delete at a known node is O(1); access by index is O(n) because nodes must be traversed.
Binary search tree: in-order traversal yields sorted output; search/insert/delete are O(log n) when balanced, O(n) when degenerate.
Hash table collisions are handled by chaining (lists per bucket) or open addressing (probing); load factor drives resizing.
Graph representations: adjacency matrix is O(V^2) memory with O(1) edge lookup; adjacency list is O(V+E) memory with O(degree) edge lookup.
Traversals: BFS uses a queue and finds shortest unweighted paths; DFS uses a stack or recursion and suits cycle detection and topological ordering.
Priority queue: a binary heap gives O(log n) insert and O(log n) extract-min; a sorted array gives O(1) extract-min but O(n) insert.
Resource Management (HL)
The operating system manages processor time, main memory, secondary storage, and I/O devices, and provides a user interface and file abstraction.
Scheduling: FCFS is simple but suffers convoy effect; round robin is fair with a time quantum; shortest-job-first minimises average wait but risks starvation.
A process control block holds process state, program counter, registers, scheduling info, and memory limits; context switching saves and restores this.
Virtual memory maps logical to physical addresses via page tables; a page fault triggers loading from disk, and thrashing occurs when faults dominate.
Paging divides memory into fixed-size frames and pages; segmentation uses variable-size logical segments, which can suffer external fragmentation.
Deadlock requires mutual exclusion, hold-and-wait, no preemption, and circular wait; prevention breaks one condition, avoidance uses safe-state checks.
Interrupt handling saves context and dispatches to a handler; interrupts enable responsive I/O without polling.
Disk scheduling: FCFS, SSTF, SCAN (elevator), C-SCAN. SSTF reduces seek time but can starve distant requests.
Control (HL)
A control system has a sensor, controller, actuator, and process; feedback compares measured output to the set point and produces an error signal.
Open-loop control ignores output; closed-loop control uses feedback, improving accuracy and disturbance rejection at the cost of complexity and possible oscillation.
A sensor converts a physical quantity into an electrical signal; an actuator converts a control signal into physical action (motor, valve, heater).
Analogue signals are continuous; digital are discrete. ADC samples, quantises, and encodes; sampling below the Nyquist rate causes aliasing.
PID control: proportional responds to present error, integral removes steady-state offset, derivative damps overshoot; gains must be tuned.
A microcontroller contains CPU, memory, and programmable I/O on one chip; it suits embedded control where size, cost, and power matter.
Flowcharts for control use sensor read, compare to threshold, actuate, repeat; hysteresis prevents chatter near a threshold.
Reliability concerns: sensor drift, actuator saturation, and failure modes; fail-safe design defaults to a safe state on error.
Internal Assessment: Computational Solution
The solution must address a real client's problem; a named client with a documented need and success criteria anchors the criterion.
Criterion A records the problem situation, rationale, consultation evidence, and proposed success criteria; each success criterion should be testable.
Criterion B requires decomposing the problem into a system overview, then modelling the data (classes, relations) and algorithms before coding.
Criterion C is development: iterative cycles with evidence of testing after each increment, plus techniques used (structures, libraries, algorithms).
Criterion D is the video: it must show the product functioning against the success criteria, with the student explaining the design and testing.
Criterion E evaluates the product against each success criterion, records client feedback, and proposes justified extensions.
Data structures and algorithms chosen should be appropriate: a lookup by key suggests a hash table or dictionary, ordered output suggests sorting or a tree.
Version control and a test log (input, expected output, actual output, fix) provide the evidence trail expected across criteria C and E.