Skip to content
Marlbridge

Free flashcards · OxfordAQA A Level · 9645

Computer Science flashcards

146 cards covering every topic of the 9645 syllabus (2024-onwards). Study one topic or mix them all, turn each card, and mark yourself honestly.

Study mode needs JavaScript. Every card is listed below, so you can still cover the answers and test yourself.

All 146 cards

For a quick read-through or printing. Cover the right-hand side to test yourself.

AS Topic 1: Procedural programming

Procedure vs function
A procedure carries out a task and returns nothing. A function returns a value.
Parameter vs argument
Parameters appear in the subroutine definition. Arguments are the actual values passed when it is called.
Passing by value vs by reference
By value: a copy is passed, so the original is unaffected. By reference: the address is passed, so the original can be changed.
Why prefer local variables and passing by value?
They prevent side effects, where one subroutine unintentionally alters data another depends on, and make each subroutine independently testable.
What does a recursive subroutine need?
A base case that stops the recursion, and a general (recursive) case that moves towards the base case.
Why can deep recursion cause a stack overflow?
Each unfinished call is held on the call stack with its own local variables and return address. Too many calls, or no base case, fill the stack.
Recursion vs iteration
Recursion is more elegant for tree and divide-and-conquer problems, but uses more memory and is usually slower because of stack overhead. Any recursive algorithm can be rewritten iteratively.
Syntax vs logic vs runtime errors
Syntax: breaks the language rules, so the program will not run. Logic: it runs but gives the wrong output, the hardest to find. Runtime: it fails during execution, e.g. division by zero.
White box vs black box testing
White box testing tests every path through the code. Black box testing checks inputs against expected outputs without knowledge of the code. Regression testing re-runs earlier tests after a change.

AS Topic 2: Fundamental data structures

Static vs dynamic data structures
Static: fixed size at creation, giving fast, predictable indexed access, but wasting memory if oversized or failing if undersized. Dynamic: grows and shrinks while the program runs, at the cost of resizing overhead.
Is a Python list static or dynamic?
Dynamic: it grows and shrinks as the program runs. Python has no built-in array type; the array module and numpy provide arrays.
Would you use a static or dynamic structure for a year of daily temperatures, and for game high scores?
Temperatures: static, because the count (365 or 366) is known and fixed. High scores: dynamic, because the count is unknown and growing.
What is a two-dimensional array or list of lists?
A structure indexed by two coordinates, usually row and column, used for tabular or grid data. E.g. seating[2][5] is row index 2, seat index 5. Exam questions use no more than two dimensions.
What is a record?
A data structure holding fields of different data types about one entity, handled as a single item, e.g. a student with a name (string), age (integer) and fees paid (Boolean).
Record vs array
A record groups fields of different types about one entity, accessed by field name. An array holds items of the same type, accessed by index.
How can a record be stored in Python?
Python has no record type, so a class (or data class) with one attribute per field is commonly used, or a dictionary with one key per field. A list of records holds many entities.
What is a queue?
A first in, first out (FIFO) structure: items are added (enqueued) at the rear and removed (dequeued) from the front.
Give three uses of queues
Print spooling, process scheduling, keyboard and data buffers, and breadth-first search.
Linear vs circular queue in a one-dimensional array
In a linear queue the front moves along as items leave, so space at the start is wasted. In a circular queue the rear pointer wraps round to the start, reusing freed space.
Which tests and pointers does an array-based queue need?
Front and rear pointers (and usually a count). Test for empty before dequeuing and for full before enqueuing.
What is a stack?
A last in, first out (LIFO) structure: items are pushed onto and popped off the top.
Push vs pop vs peek
Push adds an item to the top. Pop removes and returns the top item. Peek returns the top item without removing it.
Give three uses of stacks
The call stack for subroutines, undo in an application, evaluating expressions, and depth-first search.
Stack overflow vs stack underflow
Overflow: trying to push onto a full stack. Underflow: trying to pop from an empty stack. Check full before pushing and empty before popping.

AS Topic 3: Program design

What is the structured approach to program design?
Designing and building a program from separate modules, passing data by parameters and return values, and using local (or block scope) variables.
Hierarchy chart vs structure chart
Both show the modules and which module calls which. Only a structure chart also shows the data passed between modules: parameters down, return values up.
Abstraction vs decomposition
Abstraction removes unnecessary detail ("what can I leave out?"). Decomposition breaks a problem into sub-problems, each doing an identifiable task ("what smaller jobs is this made of?").
What is an algorithm?
A sequence of steps that can be followed to complete a task and that always terminates.
What is the critical path in software development?
The part of a solution that everything else depends on. Implementation may be iterative, solving the critical path first.
Normal, boundary and erroneous test data
Normal: typical valid data that should be accepted. Boundary: values at the edges of the valid range and just outside them. Erroneous: data that should be rejected.
Name the five aspects of software development
Analysis, design, implementation, testing and evaluation.
Name three criteria for evaluating a system
Correctness, efficiency and maintainability.

AS Topic 4: Searching and sorting algorithms

Linear search vs binary search
Linear checks each item in turn from the start; the list can be in any order. Binary repeatedly checks the middle item of an ordered list and discards the half that cannot hold the target.
How do worst-case comparisons grow for linear and binary search?
Linear: in step with the list length. Binary: by just one each time the list length doubles.
How does a bubble sort work?
It repeatedly compares adjacent pairs and swaps any in the wrong order. One sweep through the list is a pass.
What are the two improvements to the basic bubble sort?
Check one fewer item on each pass (the end is already sorted), and stop after a pass with no swaps.
How does merge sort work?
Split the list into single-item lists, then repeatedly merge sorted lists in pairs until one list remains.
Bubble sort vs merge sort: time and memory
Bubble sort is slow on large unsorted lists but sorts in place with one temporary variable and stops early on a nearly sorted list. Merge sort is much faster on large lists but needs extra memory for the sub-lists.
Give the best and worst Big O for linear search, binary search and bubble sort
Linear search O(1) best, O(n) worst. Binary search O(1) best, O(log n) worst. Bubble sort O(n) best, O(n²) worst. Merge sort is O(n log n). (Big O is International A-level only.)
Definite vs indefinite iteration
Definite iteration runs a fixed number of times (FOR). Indefinite iteration runs until a condition is met (WHILE).

AS Topic 5: Representing data

What range can n bits represent unsigned and in two's complement?
Unsigned: 0 to 2ⁿ − 1. Two's complement: −2ⁿ⁻¹ to +2ⁿ⁻¹ − 1. For 8 bits: 0 to 255, or −128 to +127.
Binary vs decimal prefixes
Binary: Ki = 2¹⁰, Mi = 2²⁰, Gi = 2³⁰, Ti = 2⁴⁰. Decimal: k = 10³, M = 10⁶, G = 10⁹, T = 10¹².
How do you subtract using two's complement?
a − b = a + (the two's complement of b). Ignore any carry out of the leftmost bit.
What are the mantissa and exponent of a floating point number?
The mantissa holds the significant digits; the exponent is the power of 2 the mantissa is multiplied by. Value = mantissa × 2^exponent.
Why normalise a floating point number?
Each value then has one unique representation, and no mantissa bits are wasted on leading 0s (or 1s), so precision is as high as the format allows.
Overflow vs underflow
Overflow: a result too large to be represented in the available bits. Underflow: a result so close to zero that its closest representation is zero.
Absolute vs relative error
Absolute error: the stored value minus the true value, ignoring sign. Relative error: the absolute error divided by the true value.
What does the Nyquist theorem say?
The sampling rate must be at least twice the highest frequency in the signal.
Perfect security vs computational security
Perfect security (e.g. the Vernam cipher): nothing can be learned about the plaintext from the ciphertext. Computationally secure: cracking it takes an unfeasible time or has a very low chance of success.
Where do the ASCII codes for digits, upper-case and lower-case letters start?
Digits from 48, upper-case letters from 65 and lower-case letters from 97. ASCII is a 7-bit code with 128 characters.

AS Topic 6: Computer systems

Hardware vs software
Hardware is the electronic components of a computer system. Software is the sequences of instructions executed using the hardware.
Name the four types of system software on the 9645 specification
Operating system, utility programs, libraries and translators.
What are libraries?
Collections of pre-written, tested subroutines that programs call, so code is not rewritten and errors are reduced.
Name four functions of an operating system
Scheduling (which process uses the processor next), memory allocation, I/O device management through device drivers, and interrupt handling.
Low-level vs high-level languages: advantages
Low-level: direct control of hardware and registers; can be fast and use little memory. High-level: quicker to write, easier to read, debug and maintain, portable, with libraries available.
What is an imperative high-level language?
A high-level language in which the commands describe the process to be followed to carry out a task.
Compiler vs interpreter
A compiler translates the whole program once, before execution, producing object code that runs fast without the source. An interpreter translates and executes one statement at a time on every run, producing no object code.
How is intermediate (byte) code run?
A virtual machine interprets it, or a just-in-time (JIT) compiler converts it into machine code for the computer it is running on.
Source code vs object code
Source code is the program as written in a high-level or assembly language; it is not directly executable. Object (executable) code is machine code output by a compiler or assembler.

AS Topic 7: Computer organisation and architecture

What do the address, data and control buses carry?
Address bus: addresses, one way out of the processor. Data bus: data and instructions, two ways. Control bus: timing and command signals such as read, write, clock and interrupt.
How much memory can 22 address lines address with 1 byte per location?
2²² = 4,194,304 bytes = 4 MiB.
What is the stored program concept?
The program sits in main memory as machine code, and the processor fetches and executes those instructions one at a time, in order.
Von Neumann vs Harvard architecture
Von Neumann: shared memory and buses for instructions and data; simpler and cheaper, for general-purpose machines. Harvard: separate instruction and data memories and buses, accessed at once; used in embedded systems.
What do the PC, CIR, MAR, MBR and SR hold?
PC: address of the next instruction. CIR: instruction being decoded or executed. MAR: address for the next memory read or write. MBR: value going to or from memory. SR: condition flags and interrupt-enable state.
Describe the fetch stage of the fetch-execute cycle
The PC is copied to the MAR; the instruction at that address is read into the MBR; the PC is incremented; the MBR is copied to the CIR.
Name six factors that affect processor performance
Number of cores, cache size, clock speed, word length, address bus width and data bus width.
What is the cycle time of a 1.25 GHz clock?
Cycle time = 1 ÷ frequency = 1 ÷ (1.25 × 10⁹) s = 0.8 ns.
How do a hard disk and an SSD store data?
Hard disk: spinning magnetic platters in tracks and sectors, read and written by a head on a moving arm. SSD: NAND flash cells trap charge, with no moving parts; erased in whole blocks with limited write cycles.

AS Topic 8: Machine code and assembly language

Opcode vs operand
The opcode says which operation to perform. The operand is the data it works on: a value, a memory address or a register.
Why is machine code processor specific?
It is written for one processor's instruction set (all the instructions it can carry out), so it is not generally usable on another processor type.
Immediate vs direct vs indirect addressing
Immediate: the operand is the value itself (MOV R0, #12). Direct: the operand is the address or register holding the value (LDR R0, 12). Indirect: a register holds the memory address (LDR R0, [R4]).
R4 holds 70 and location 70 holds 5. What do LDR R0, [R4] and MOV R0, R4 put in R0?
LDR R0, [R4] puts 5 in R0 (indirect). MOV R0, R4 puts 70 in R0.
LDR vs STR
LDR loads a value from memory into a register. STR stores a value from a register into memory.
What do ORR, EOR and MVN do?
ORR is bitwise OR; EOR is bitwise XOR (exclusive OR); MVN is bitwise NOT.
How do you clear, set and toggle chosen bits?
Clear: AND with 0s in those positions. Set: ORR with 1s in those positions. Toggle: EOR with 1s in those positions.
What do LSL and LSR do to a value?
LSL Rd, Rn, #n shifts left n places, multiplying by 2ⁿ. LSR shifts right n places, dividing by 2ⁿ and losing the remainder. Zeros come in; bits falling off are lost.
How does CMP work with a conditional branch?
CMP Rn, operand2 compares the two and sets up the following branch, such as BEQ, BNE, BGT or BLT, whose condition reads "Rn compared with operand2".

A Level Topic 9: Object-oriented and additional programming

Class vs object
A class defines the attributes and methods common to a type of object; it is written once. An object is one instance of a class, with its own attribute values.
What are instantiation and a constructor?
Instantiation is creating an object from a class. The constructor is called on instantiation and initialises the object to a given state.
What is encapsulation?
Hiding how a class works and how it represents data from other classes, usually by making attributes private and accessing them through methods.
What are inheritance and overriding?
Inheritance: one class is a more specialised version of an existing class. Overriding: a base-class method is redefined in a subclass so subclass objects behave differently.
Inheritance vs association
"Is a more specialised kind of" means inheritance. "Uses" or "has a link to" means association, which is much weaker. A Ward is associated with its Patients; it is not a kind of Patient.
Public, private and protected access modifiers
Public (+): accessible from anywhere. Private (−): the class only. Protected (#): the class and its subclasses.
How are private and protected members written in Python?
Private: a double underscore prefix, which triggers name mangling. Protected: a single underscore prefix, which is a convention only.
Why use the object-oriented paradigm?
It models problems as interacting objects, protects data behind methods, lets subclasses reuse tested code, and lets each class be built and tested separately.

A Level Topic 10: Advanced data structures

Directed vs undirected vs weighted graphs
Undirected: edges work both ways. Directed: each edge points one way. Weighted: each edge has a value such as distance, time or cost.
When is an adjacency matrix better than an adjacency list?
Matrix: when the graph is dense, or edges are often added, removed or tested. List: when the graph is sparse (few edges relative to vertices), as it stores only each vertex's neighbours.
What is a tree, and what is a rooted tree?
A tree is a connected, undirected graph with no cycles; it does not need a root. A rooted tree has one vertex designated as the root, giving parent-child relationships.
What is a binary search tree?
A binary tree (each node has at most two children) in which, at every node, smaller values are in the left subtree and larger values in the right subtree.
What makes a good hash function?
It spreads records evenly across the table and is quick to compute. Using key MOD size keeps the result in the range 0 to size − 1.
What is a collision, and how does rehashing deal with it?
A collision is when two keys produce the same hash. Rehashing (the specification's method) stores the second record in the next available position.
Hash table vs array searched by key
A hash table calculates a record's position from its key, so no search is needed and inserting needs no shifting; but it needs spare space and records are not in key order. An array can be kept in order but must be searched.
What is a priority queue?
A queue in which each item has a priority: items are removed in priority order, and items of equal priority leave in arrival order. Used in Dijkstra's algorithm and job scheduling.
What is a dictionary?
A collection of key-value pairs in which each value is accessed by its key, e.g. a look-up table.

A Level Topic 11: Advanced algorithms

Breadth-first vs depth-first search
BFS visits vertices layer by layer outwards using a queue, and finds the fewest-edge path in an unweighted graph. DFS follows one branch as far as possible then backtracks, using a stack or recursion, e.g. to navigate a maze.
What does Dijkstra's algorithm find?
The shortest (lowest total weight) route from one vertex to all others in a weighted graph. At each step the unvisited vertex with the smallest total distance is picked and its distance becomes final.
Why is BFS not used for shortest routes in a weighted graph?
BFS counts edges and ignores weights, so a route with fewer edges can still cost more.
Give two applications of Dijkstra's algorithm
Satellite navigation and route planners, and routing data across networks (link-state protocols such as OSPF).
Pre-order, in-order and post-order traversal
Pre-order: node, left, right. In-order: left, node, right. Post-order: left, right, node.
What is each binary tree traversal used for?
Pre-order: copying a tree; prefix expressions. In-order: outputting a BST in ascending order. Post-order: postfix expressions; emptying a tree.
What is an expression tree?
A binary tree with operators at the internal nodes and operands at the leaves. Pre-order gives prefix notation and post-order gives postfix; neither needs brackets.
In code, how do the loop versions of BFS and DFS differ?
BFS removes from the front of the collection (a queue, e.g. popleft), while DFS removes from the end (a stack, e.g. pop).

A Level Topic 12: Functional programming

What do f: A → B, the domain and the co-domain mean?
f takes arguments of type A and returns results of type B. The domain (A) is the set inputs come from; the co-domain (B) is the set outputs come from, though not every member has to be output.
What is a first-class object?
A value that may appear in expressions, be assigned to a variable, be passed as an argument and be returned from a function call. In functional languages, functions are first-class objects.
What is function composition g ∘ f?
It combines f: A → B and g: B → C into one function of type A → C, with f applied first. The co-domain of f must match the domain of g.
What is a higher-order function?
A function that takes a function as an argument, returns a function, or both, e.g. map, filter and fold.
What do map, filter and fold do?
map applies a function to every element of a list. filter keeps the elements for which a condition is true. fold (foldl or foldr) combines the elements into one value, starting from a given value.
What do head, tail and null return for the list [5, 2]?
head gives 5 (the first element). tail gives [2] (the rest, always a list). null gives False (the list is not empty).
How does Haskell choose which equation of a function to use?
By pattern matching: it tries the equations from top to bottom and uses the first pattern that fits, such as 0, [], a name, (x:xs) for any non-empty list or [x] for a one-item list.
How is a function applied in Haskell, and how is whole-number division written?
Arguments follow the name with spaces and no brackets or commas, e.g. name 7 2. div and mod are written between back-quotes: 17 div 5 = 3 and 17 mod 5 = 2.
Name the number sets ℕ, ℤ, ℚ and ℝ
ℕ: natural numbers 0, 1, 2, ... (zero included). ℤ: integers. ℚ: rational numbers p/q with integers p and q. ℝ: real numbers, including π and √2.

A Level Topic 13: Theory of computation

What is a finite state machine?
A machine with a fixed number of states that changes state as it reads each input symbol. Without output, the input is accepted if it ends in an accepting state.
What is a Mealy machine?
An FSM with output, in which each output is produced on a transition; arcs are labelled input / output.
What do *, +, ? and | mean in a regular expression?
* means 0 or more repetitions; + means 1 or more; ? means 0 or 1 (optional); | means alternation (or). Brackets group a regular expression.
Does k(o|i)+t match kt, kot and koit?
It matches kot and koit, but not kt, because + needs at least one o or i.
What is a regular language?
A language that can be represented by a regular expression (equivalently, accepted by an FSM).
What are the parts of a Turing machine?
A finite set of states (one start state; halting states have no outgoing transitions), a finite alphabet, a tape infinite in one direction divided into squares, and a read-write head that moves one square at a time.
What is a universal Turing machine, and why is it important?
A Turing machine that can simulate any other, with the other machine's description and input stored on its tape. It shows one machine can run any program held as data, and Turing machines define what is computable.
Tractable vs intractable problems
A tractable problem has a polynomial (or less) time solution. An intractable problem has no polynomial time solution, so heuristics may be used to find an acceptable answer.
What is the halting problem?
The unsolvable problem of determining, without running it, whether a program will eventually stop for a given input. It shows some problems cannot be solved by any algorithm.
What is BNF used for?
Backus-Naur form is a notation of production rules for defining the syntax of a language.

A Level Topic 14: Networking and cyber security

Synchronous vs asynchronous transmission
Synchronous: a continuous data stream with sender and receiver clocks kept in step by a timing signal. Asynchronous: characters sent individually, framed by start and stop bits.
Baud rate vs bit rate
Baud rate is the number of signal changes per second. Bit rate is the number of bits transmitted per second; it can be higher than the baud rate if each signal change carries more than one bit.
Why is serial transmission better than parallel over long distances?
There is no skew between bits, no crosstalk between neighbouring wires, and the cable is cheaper with fewer conductors.
Peer-to-peer vs client-server networks
Peer-to-peer: all computers equal; cheap with no dedicated server, but no central control. Client-server: servers provide services that clients request; central backups, security and user management, but server cost and a single point of failure.
Thin client vs thick client
Thin client: processing and storage mostly on the server; cheap terminals, but a fast, reliable network is essential. Thick client: processing and storage on the local machine; lighter network load, but each machine is maintained separately.
How does CSMA/CA with RTS/CTS work?
The sender transmits a Request to Send to the access point, which broadcasts Clear to Send; all other stations stay quiet while the data frame is sent and acknowledged. It solves the hidden-node problem.
How can a wireless network be secured?
Use WPA2 encryption, disable SSID broadcast, and use a MAC address allow list.
What does a packet contain, and what does time to live do?
Source and destination addresses, sequence number, time to live, payload and error detection data. TTL is reduced by 1 at each router and the packet is discarded at 0.

A Level Topic 15: Databases

What is a relational database?
Data held in separate tables, one per entity type, linked by common key fields.
Primary key, composite primary key and foreign key
Primary key: attribute(s) that uniquely identify each record. Composite key: two or more attributes combined. Foreign key: a field matching another table's primary key, linking the two tables.
How is a many-to-many relationship resolved?
By adding a link entity between the two, giving two one-to-many relationships, e.g. Climber and Route linked by Ascent.
Why normalise a database?
Every fact is stored in one place, so redundant copies disappear, data stays consistent, less storage is used, and update, insertion and deletion problems are avoided.
Give the SQL patterns for UPDATE, INSERT and DELETE
UPDATE table SET field = value WHERE condition INSERT INTO table (f1, f2) VALUES (v1, v2) DELETE FROM table WHERE condition
What does GROUP BY do in SQL?
It groups rows that share a value so an aggregate function such as COUNT, SUM or AVG gives one result per group, e.g. SELECT field, COUNT(*) FROM table GROUP BY field.
What is the lost update problem?
Two clients read the same record and both change it; the second save overwrites the first, so one update is lost.
How does record locking preserve integrity?
The record is locked while one client updates it, so no other client can update it until the lock is released.
What do volume and velocity mean for Big Data?
Volume: too much data to fit on a single server. Velocity: data arrives as a stream and responses are needed in milliseconds to seconds.

A Level Topic 16: Artificial intelligence

When is a system often called artificially intelligent?
There is no one accepted definition. A system is often called AI if it solves a complex problem using a method like a human's, or one at least as good as a human's, on problems once thought to need human intelligence.
Narrow AI vs generally intelligent AI
Narrow AI works in one field and is what exists and is widely used today. Generally intelligent AI would learn and reason across any field; it is an area of research only.
What is a neural network?
A network of nodes connected in a similar way to neurons in the brain. Each node takes weighted inputs and produces an output, in input, hidden and output layers.
What is backpropagation?
A training method in which the output error is passed backwards through the network and the weights are adjusted to reduce it.
Deep learning vs machine learning
Machine learning is a type of AI whose performance improves based on experience. Deep learning uses neural networks with several hidden layers, allowing more complex problems to be solved.
A node gets inputs 0.6, 0.2 and 0.9 on weights 0.5, −1.5 and 0.8. What is the weighted sum?
0.30 − 0.30 + 0.72 = 0.72. With a threshold of 0.7 the node outputs 1.
How does bias arise in an AI system?
From the training data: if a group is under-represented, or the historical decisions in the data were unfair. Careful selection of data and testing each group separately reduce the risk.
Give three benefits and three risks of AI
Benefits: more consistent decisions; very large data sets analysed quickly; continuous availability; lower cost. Risks: job losses; bias; false information from bad training data; plagiarism; surveillance.