IGCSE Computer Science (0478) – Algorithms, Programming & Logic
Contents
- Data Representation (Topic 1)
- Data Transmission (Topic 2)
- Hardware (Topic 3)
- System Software (Topic 4)
- Networks (Topic 5)
- Security & Ethics (Topic 6)
- Algorithms (Topic 7)
- Programming (Topic 8)
- Databases (Topic 9)
- Boolean Logic & Circuit Design (Topic 10)
- Assessment Checklist & Practice
1. Data Representation (Topic 1)
1.1 Number systems
- Binary (base 2) – digits 0 and 1.
- Denary / Decimal (base 10) – digits 0–9.
- Hexadecimal (base 16) – digits 0–9 and A–F (10–15).
Conversion steps (summary table)
| From → To | Method |
| Binary → Decimal | Multiply each bit by 2ⁿ (n = position from right, starting at 0) and add. |
| Decimal → Binary | Repeated division by 2, record remainders, read upwards. |
| Decimal → Hexadecimal | Repeated division by 16, use A–F for 10–15, read upwards. |
| Hex → Binary | Replace each hex digit with its 4‑bit binary equivalent. |
| Binary → Hex | Group bits in fours from the right, convert each group to a hex digit. |
1.2 Two’s‑complement (signed integers)
- Write the absolute value in binary using the required number of bits.
- Invert all bits (0→1, 1→0).
- Add 1 to the result.
Example (8‑bit, –25): 25 = 0001 1001 → invert = 1110 0110 → add 1 = 1110 0111.
1.3 Logical shift & overflow
2. Data Transmission (Topic 2)
2.1 Transmission media
- Wired – copper (twisted‑pair, coaxial), fibre‑optic.
- Wireless – radio, infrared, satellite.
2.2 Serial vs. parallel
| Serial | Parallel |
| One bit sent at a time over a single channel; cheaper, longer distances, lower pin count. |
Multiple bits sent simultaneously over multiple channels; faster over short distances, more expensive. |
2.3 Duplex modes
- Simplex – data flows in one direction only (e.g., TV broadcast).
- Half‑duplex – data can flow both ways, but not at the same time (e.g., walkie‑talkie).
- Full‑duplex – simultaneous two‑way communication (e.g., telephone, Ethernet).
2.4 Packet structure (simplified)
A typical data packet consists of:
- Header – source address, destination address, protocol ID, length.
- Payload – the actual data being transferred.
- Trailer – error‑checking information (e.g., CRC).
2.5 Example – USB vs. Wi‑Fi
- USB – wired, full‑duplex, serial transmission, high speed (up to 20 GB/s for USB 3.2).
- Wi‑Fi – wireless, full‑duplex (via separate channels), packet‑based, typical speeds 150 Mbps – 1 Gbps.
3. Hardware (Topic 3)
3.1 Core components
- CPU (Central Processing Unit) – executes instructions; contains ALU, control unit, registers.
- Memory
- Primary: RAM (volatile), ROM (non‑volatile, e.g., BIOS).
- Secondary: HDD, SSD, optical disc, USB flash.
- Input devices – keyboard, mouse, scanner, microphone.
- Output devices – monitor, printer, speaker.
- Motherboard – connects CPU, memory, I/O via buses (address, data, control).
3.2 Buses and addressing
- Address bus – carries memory addresses; width determines maximum addressable memory (e.g., 32‑bit → 4 GB).
- Data bus – carries actual data; width influences how many bits are transferred per cycle.
- Control bus – carries signals such as read/write, interrupt, clock.
3.3 Storage hierarchy
| Level | Typical device | Speed | Cost/bit |
| CPU registers | Register file | Fastest | Very high |
| Cache | L1/L2/L3 cache | Very fast | High |
| Main memory | RAM (DRAM) | Fast | Medium |
| Secondary storage | SSD / HDD | Slower | Low |
| Archive | Optical disc, tape | Slowest | Very low |
4. System Software (Topic 4)
4.1 Operating system (OS) functions
- Resource management – CPU scheduling, memory allocation.
- File system control – create, read, write, delete files.
- Device management – drivers, I/O handling.
- Security – user authentication, permissions.
- Interface – command‑line (CLI) or graphical (GUI).
4.2 Utility programs
- Disk defragmenter, antivirus, backup tools, compression (ZIP), system monitors.
4.3 Virtual machines & cloud basics
A virtual machine (VM) emulates a complete computer system, allowing multiple OSes to run on a single physical machine. Cloud services (IaaS, PaaS, SaaS) provide remote resources over the Internet.
5. Networks (Topic 5)
5.1 Network topologies
| Topology | Key features |
| Star | All nodes connect to a central hub/switch; easy to manage, single point of failure. |
| Bus | All nodes share a single cable; inexpensive but prone to collisions. |
| Ring | Each node connects to two neighbours; token passing controls access. |
| Mesh | Multiple redundant paths; high reliability, costly. |
5.2 Network hardware
- Router – forwards packets between different networks (e.g., LAN ↔ Internet).
- Switch – connects devices within a LAN; forwards frames based on MAC addresses.
- Modem – converts digital data to analog signals for telephone lines or cable.
- Access point (AP) – provides wireless connectivity to a wired LAN.
5.3 Protocols & addressing
- IP address – 32‑bit (IPv4) or 128‑bit (IPv6) identifier for a device on a network.
- MAC address – 48‑bit hardware address of a network interface card.
- Common protocols – TCP/IP (reliable), UDP (unreliable), HTTP/HTTPS (web), FTP (file transfer), SMTP (email).
5.4 The Internet & World Wide Web
The Internet is a global network of networks using the TCP/IP suite. The Web is an application layer that uses HTTP/HTTPS to retrieve hyper‑text documents (HTML) from web servers.
6. Security & Ethics (Topic 6)
6.1 Threats and vulnerabilities
- Malware – viruses, worms, trojans, ransomware.
- Unauthorised access – hacking, phishing, social engineering.
- Data loss – accidental deletion, hardware failure, natural disaster.
6.2 Protective measures
- Authentication – passwords, biometrics, two‑factor.
- Encryption – symmetric (AES) and asymmetric (RSA) for confidentiality.
- Firewalls – packet filtering, proxy firewalls.
- Back‑up strategies – full, incremental, cloud backup.
6.3 Legal & ethical issues
- Copyright and licensing (e.g., GPL, MIT).
- Data protection (GDPR, privacy laws).
- Computer misuse – hacking, piracy, cyber‑bullying.
- Professional responsibility – accuracy, honesty, respecting intellectual property.
7. Algorithms (Topic 7)
7.1 Algorithm life‑cycle
- Analyse – read the problem, list inputs, outputs, constraints.
- Design – choose a standard method, decompose into sub‑steps, sketch a flowchart.
- Implement – write pseudocode, then translate to real code.
- Test & Debug – create trace tables, run boundary and edge‑case tests.
- Document – comment code, label flowchart symbols, write a brief explanation.
7.2 Validation vs. verification
| Validation (Does it do the right thing?) | Verification (Is it written correctly?) |
| Compare results with the problem specification; use a range of test data covering all requirements. |
Check syntax, correct use of control structures, proper indentation and naming conventions in pseudocode/code. |
7.3 Trace tables
A trace table records the values of all relevant variables after each step of an algorithm.
# Example: add numbers 1‑5 using a FOR loop
Step | i | total
-----+---+-------
Init | – | 0
i=1 | 1 | 1
i=2 | 2 | 3
i=3 | 3 | 6
i=4 | 4 |10
i=5 | 5 |15
7.4 Standard solution methods (Cambridge)
- Linear search – scan an unsorted list sequentially.
- Binary search – repeatedly halve a sorted list (divide‑and‑conquer).
- Bubble sort / Selection sort – simple O(n²) sorting techniques.
- Totalling / Counting – sum or count items that meet a condition.
- Min / Max / Average – find smallest, largest, or mean value.
7.5 Writing, interpreting & amending algorithms
All three representations must be kept in sync:
- Pseudocode – language‑independent, uses Cambridge symbols (←, IF…THEN, ENDIF, FOR…ENDFOR, etc.).
- Program code – Python or Java, respecting syntax and indentation.
- Flowchart – visual control‑flow using standard symbols (oval, rectangle, diamond, parallelogram).
Example problem – Find the maximum value
Read a sequence of positive integers (terminated by a negative number) and output the largest value, the number of values entered, and the position of the maximum.
Pseudocode
max ← -∞
count ← 0
pos ← -1
i ← 0
WHILE TRUE DO
i ← i + 1
READ value
IF value < 0 THEN
EXIT WHILE
ENDIF
count ← count + 1
IF value > max THEN
max ← value
pos ← i
ENDIF
ENDWHILE
WRITE "Maximum value is:", max
WRITE "Numbers entered:", count
WRITE "Position of maximum:", pos
Python implementation
def find_max():
max_val = float('-inf')
count = 0
pos = -1
i = 0
while True:
i += 1
value = int(input("Enter a number (negative to stop): "))
if value < 0:
break
count += 1
if value > max_val:
max_val = value
pos = i
print("Maximum value is:", max_val)
print("Numbers entered:", count)
print("Position of maximum:", pos)
find_max()
Flowchart outline
- Start (oval)
- Input
value (parallelogram)
- Decision:
value < 0? (diamond)
- Yes → Output results → End.
- No → Continue.
- Process:
count ← count + 1; i ← i + 1 (rectangle)
- Decision:
value > max?
- Yes →
max ← value; pos ← i
- No → (no change)
- Loop back to step 2.
Systematic amendment procedure
- State the new requirement (e.g., “also output the average of the entered numbers”).
- Identify where the change belongs (after each successful input).
- Update:
- Pseudocode – add a variable
total and update it inside the loop.
- Python code – add
total += value and compute average = total / count after the loop.
- Flowchart – insert a new process box for the addition and a final output box for the average.
- Test with a trace table covering normal, boundary and empty‑input cases.
8. Programming (Topic 8)
8.1 Core concepts
- Variables & constants –
variable ← expression; constants written in UPPERCASE and never altered.
- Data types – integer, float, string, Boolean.
- Input / Output –
READ, WRITE in pseudocode; input(), print() in Python.
- Operators
- Arithmetic:
+, -, *, / (float), // (integer division), % (modulus).
- Relational:
=, ≠, <, >, ≤, ≥.
- Boolean:
AND, OR, NOT.
- Control structures
- Sequence – statements executed one after another.
- Selection –
IF … THEN … ELSE … ENDIF (or if … else … in Python).
- Iteration –
FOR … ENDFOR, WHILE … ENDWHILE.
- Nested statements – any structure may appear inside another.
- Procedures / Functions – up to two parameters; may return a value (use
RETURN).
- Arrays
- 1‑D:
scores[10] – indices start at 1 in Cambridge pseudocode.
- 2‑D:
matrix[3][3] – rows then columns.
- Library routines –
len(), range(), Math.sqrt(), sorted(), etc.
8.2 File handling (required for Topic 8)
OPEN file_name FOR READ AS f
WHILE NOT EOF(f) DO
READ line FROM f
… # process line
ENDWHILE
CLOSE f
Python equivalent:
with open('data.txt', 'r') as f:
for line in f:
# process line
pass
8.3 Common syntax errors & fixes
- Missing loop increment – add
i ← i + 1 (pseudocode) or i += 1 (Python).
- Incorrect indentation – Python relies on consistent indentation to define blocks.
- Using “=” for comparison – use
= in pseudocode, == in Python.
9. Databases (Topic 9)
9.1 Relational database basics
- Table – rows = records, columns = fields.
- Primary key – uniquely identifies each record.
- Field types – INTEGER, VARCHAR(n), DATE, FLOAT, BOOLEAN.
9.2 Simple SQL commands
-- SELECT
SELECT field1, field2
FROM table_name
WHERE condition
ORDER BY field ASC|DESC;
-- AGGREGATE functions
SELECT SUM(sales) FROM orders WHERE year = 2023;
SELECT COUNT(*) FROM students WHERE grade = 'A';
SELECT AVG(score) FROM results;
9.3 Example table – students
| student_id (PK) | name | age | grade |
| 1 | Alice | 14 | A |
| 2 | Bob | 15 | B |
| 3 | Clara | 14 | A |
9.4 Typical exam task
Write an SQL query to list the names of all students who scored above the class average.
SELECT name
FROM students
WHERE grade > (SELECT AVG(grade) FROM students);
10. Boolean Logic & Circuit Design (Topic 10)
10.1 Boolean expressions
- Use
AND, OR, NOT (or symbols ∧, ∨, ¬).
- Apply De Morgan’s laws to simplify:
NOT (A AND B) ≡ (NOT A) OR (NOT B)
NOT (A OR B) ≡ (NOT A) AND (NOT B)
10.2 Truth tables
Construct a row for every possible combination of inputs (2ⁿ rows for n inputs) and compute the output.
10.3 Gate symbols
- AND – flat‑fronted shape.
- OR – curved‑fronted shape.
- NOT – triangle with a small circle (inverter).
- NAND, NOR, XOR – variations of the above.
10.4 Example design
Design a circuit for (A AND B) OR NOT C.
- Truth table – 8 rows, output 1 when (A∧B)=1 or C=0.
- Gate diagram – two inputs (A,B) into an AND gate; C into a NOT gate; outputs of AND and NOT feed an OR gate.
Assessment Checklist & Practice
Checklist for exam markers
| Criterion | What Examiners Look For |
| Algorithm design |
Correct choice of method, appropriate decomposition, clear flow‑control, no off‑by‑one errors. |
| Pseudocode |
Consistent indentation, correct Cambridge symbols, meaningful variable names, use of constants where required. |
| Program code |
Valid syntax, correct use of loops/conditions, proper handling of input‑output and file operations. |
| Flowchart |
All required symbols present, arrows show unambiguous direction, loop back‑arrows labelled, no crossing lines. |
| Testing & debugging |
Trace tables included, edge cases covered, evidence of validation and verification. |
| Boolean logic & circuits |
Correct truth‑table entries, simplified Boolean expression, accurate gate diagram. |
| Database & SQL |
Correct identification of primary key, appropriate field types, syntactically correct SELECT statements. |
| Security & ethics |
Relevant terminology used, awareness of legal/ethical implications. |
Practice Questions
- Write pseudocode to calculate the factorial of a number
n using a FOR loop.
- Convert the above pseudocode into a flowchart (list the symbols you would use).
- Identify and correct the error in the following Python code:
i = 1
while i <= 10:
print(i)
# missing increment
- Amend the “Find Maximum” algorithm so that it also reports the average of the entered numbers.
- Using a trace table, show the values of
max, count, pos and total for the input sequence 7, 3, 9, 2, -1.
- Write a Boolean expression for the truth table below and draw the corresponding gate diagram.
| A | B | C | Result |
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 0 |
- Convert the binary number
11010110 to decimal and hexadecimal.
- Explain the difference between a router and a switch. Provide one real‑world example of each.
- Write an SQL query to list the
student_id and name of all students whose grade is higher than the class average.
Answers (key points only)
- Pseudocode:
factorial ← 1
FOR i ← 1 TO n DO
factorial ← factorial * i
ENDFOR
WRITE factorial
- Flowchart symbols: Start (oval) → Process (factorial ← 1) → Loop (diamond) → Process (multiply) → Loop back → Output (parallelogram) → End.
- Missing increment: add
i += 1 inside the while block.
- Amended pseudocode – add
total ← total + value inside the loop and after the loop compute average ← total / count; output average as well.
- Trace table (partial):
Step | value | max | count | pos | total
1 | 7 | 7 | 1 | 1 | 7
2 | 3 | 7 | 2 | 1 |10
3 | 9 | 9 | 3 | 3 |19
4 | 2 | 9 | 4 | 3 |21
5 | -1 | 9 | 4 | 3 |21 (loop ends)
- Expression:
Result = NOT C AND (NOT A OR NOT B) (or equivalently Result = ¬C ∧ (¬A ∨ ¬B)). Gate diagram uses a NOT gate on C, NOT gates on A and B, an OR gate combining ¬A and ¬B, then an AND gate with the output of the OR and ¬C.
- Binary
11010110₂ = 214₁₀ = D6₁₆.
- Router – forwards packets between different networks (e.g., home Wi‑Fi router connecting LAN to the Internet). Switch – connects devices within the same LAN, forwarding frames based on MAC addresses (e.g., office Ethernet switch).
- SQL:
SELECT student_id, name
FROM students
WHERE grade > (SELECT AVG(grade) FROM students);