Data representation
Two's complement represents negative integers: write the positive number in binary, flip every bit, then add 1. In 8 bits, −5 is 11111011. The leftmost bit has a negative place value (−128), so 8-bit two's complement covers −128 to +127.
Searching and sorting
| Algorithm | Time complexity | Note |
|---|---|---|
| Linear search | O(n) | Works on unsorted data |
| Binary search | O(log n) | Data must be sorted |
| Bubble sort | O(n²) | Simple; stops early if no swaps |
| Insertion sort | O(n²) | Fast on nearly sorted data |
Abstract data types
| Structure | Order | Typical use |
|---|---|---|
| Stack | LIFO: last in, first out | Undo, subroutine calls, recursion |
| Queue | FIFO: first in, first out | Print jobs, keyboard buffer |
| Linked list | Nodes joined by pointers | Easy insertion and deletion |
| Binary tree | Each node has up to two children | Fast searching when ordered |
Pseudocode and programming
Cambridge pseudocode uses DECLARE, ← for assignment, IF…THEN…ELSE…ENDIF, FOR…TO…NEXT, WHILE…ENDWHILE and REPEAT…UNTIL. A procedure performs a task; a function returns a value. Parameters can be passed BYVAL (a copy) or BYREF (the original, which the subroutine can change).
Worked example
Write pseudocode to count how many values in Marks[1:30] are 50 or more.
- DECLARE Count : INTEGER; Count ← 0
- FOR i ← 1 TO 30
- IF Marks[i] >= 50 THEN Count ← Count + 1 ENDIF
- NEXT i; OUTPUT Count
Key words
Test yourself
Build your own quiz: pick topics, number of questions and a time limit. It's marked for you, with the working for every answer.
5 questions available
Build a quizQuestions students ask
Which programming language should I use for A Level Computer Science?
Cambridge allows Python, Java or Visual Basic for the practical paper. Python is the most popular choice in Pakistani schools because its syntax is short and clear.
How do I improve at pseudocode questions?
Learn the exact Cambridge keywords from the pseudocode guide and practise writing short algorithms (totals, counts, searches, sorts) until the structure feels automatic.
Want one-to-one help?
A checked Computer Science tutor, at home in Islamabad or Rawalpindi or online. The first 30 minutes are free.
Find a Computer Science tutor