Cambridge IGCSE Computer Science (0478) – Operators, Logic and Computer Systems
Learning objectives
- Explain the main components of a computer system and how data are represented.
- Design, develop and test simple algorithms using flowcharts, trace tables and pseudocode.
- Identify and apply all arithmetic, relational and Boolean operators required by the syllabus.
- Use operator‑precedence rules correctly and construct truth tables for Boolean expressions.
- Understand basic concepts of arrays, file handling, databases and Boolean‑gate circuits.
1. Computer Systems – an overview (Syllabus Areas 1‑6)
1.1 Number systems and data representation
- Binary (base‑2) – the language of computers; each digit is a bit (0 or 1).
- Denary (decimal, base‑10) – used by humans.
- Hexadecimal (base‑16) – convenient for representing binary groups; digits 0‑9 and A‑F.
- Conversion methods:
- Binary ↔ Decimal (repeated division / multiplication).
- Binary ↔ Hexadecimal (group bits in fours).
- Two’s‑complement for signed integers – invert bits and add 1.
- Logical shifts (left/right) – multiply/divide by powers of two.
1.2 Text, sound and image representation
- Text: ASCII (7‑bit) and Unicode (up to 32‑bit). One character = one byte (ASCII) or more (Unicode).
- Sound: sampled at a given sample rate (e.g., 44 kHz) and stored with a bit depth (e.g., 16‑bit). Size ≈ sample rate × bit‑depth × duration.
- Images:
- Resolution – number of pixels (width × height).
- Colour depth – bits per pixel (e.g., 24‑bit true colour = 16 777 216 colours).
- Common formats: BMP (uncompressed), JPEG (lossy), PNG (lossless).
1.3 Data storage & compression
- Units: bit, byte (8 bits), kilobyte (KB = 10³ B), megabyte (MB = 10⁶ B), gigabyte (GB = 10⁹ B). For RAM, binary prefixes (KiB = 2¹⁰ B) are also used.
- Lossless compression – data can be restored exactly (e.g., ZIP, PNG).
- Lossy compression – some information is discarded for smaller size (e.g., MP3, JPEG).
1.4 Data transmission & networking
- Transmission media: copper cable, fibre‑optic, wireless (Wi‑Fi, Bluetooth).
- Packets – units of data sent over a network; contain header (addressing) and payload.
- Error‑detection methods: parity bit, checksum, CRC.
- Encryption basics – symmetric (same key) vs asymmetric (public‑private key).
1.5 Core hardware
- CPU – fetch‑decode‑execute cycle, registers, ALU, control unit.
- Cache memory – speeds up access to frequently used data.
- Multi‑core processors – parallel execution of threads.
- Embedded systems – computers built into appliances, robots, IoT devices.
1.6 Software layers
- Firmware – low‑level software stored in ROM/flash.
- Operating System (OS) – manages resources, provides system calls.
- Application software – programs written by users (e.g., word processors, games).
- Interrupts – signals that temporarily suspend the CPU to handle urgent tasks.
1.7 Internet basics
- URL structure – protocol, domain, path, query string.
- HTTP/HTTPS – request/response protocol; HTTPS adds TLS encryption.
- DNS – translates domain names to IP addresses.
- Cookies – small pieces of data stored on the client side.
1.8 Cyber‑security
- Common threats: malware, phishing, denial‑of‑service, man‑in‑the‑middle.
- Counter‑measures: firewalls, antivirus, strong passwords, two‑factor authentication, regular updates.
1.9 Emerging technologies (AO1 – knowledge)
- Artificial Intelligence – machine learning, neural networks.
- Robotics – sensors, actuators, control algorithms.
- Internet of Things (IoT) – networked everyday objects.
- Cloud computing – on‑demand resources, SaaS, PaaS, IaaS.
2. Algorithms, Program Development and Logic (Syllabus Areas 7‑10)
2.1 Program development life‑cycle
- Analysis – understand the problem, define inputs & outputs.
- Design – decompose the solution, create structure diagrams, flowcharts.
- Coding – write pseudocode or a program using the correct syntax.
- Testing & debugging – validation (does the program meet the specification?) and verification (does it work correctly?).
- Documentation – comments, user guide, maintenance notes.
2.2 Decomposition and structure diagrams
Break a problem into smaller sub‑routines. Example – “Calculate a student’s final grade”.
MAIN
INPUT marks for three tests
CALL Average
CALL DetermineGrade
OUTPUT final grade
ENDMAIN
2.3 Flowchart symbols (exact syllabus symbols)
| Symbol | Name | Purpose |
| ▭ | Process | Arithmetic, assignment, input, output |
| ◇ | Decision | Boolean test – two possible paths |
| ⬭ | Sub‑routine | Call a separate routine |
| ▶︎ / ◀︎ | Connector | Join or split flow lines |
| ⭘ | Start / End | Program entry and termination |
2.4 Pseudocode conventions (Cambridge style)
- Keywords in UPPERCASE:
IF … THEN … ELSE … ENDIF, FOR … TO … NEXT, WHILE … REPEAT … ENDWHILE.
- Indentation – each new block indented one level (usually 4 spaces).
- Comments start with
// or # and are placed on a separate line.
- Identifiers – start with a letter, may contain letters, digits or underscore, case‑insensitive.
- Use
← for assignment (or = if the language requires it).
2.5 Trace tables
A trace table records the values of variables after each step of execution. Include columns for:
- Step number
- Variable values (all that change)
- Output (if any)
Worked example – average of three numbers
| Step | num1 | num2 | num3 | sum | average |
| 1 | 12 | 15 | 9 | | |
| 2 | | | | 36 | |
| 3 | | | | | 12 |
2.6 Validation and verification
- Validation checks – ensure input data are within acceptable ranges (e.g.,
IF age < 0 OR age > 120 THEN ERROR).
- Verification tests – use normal, boundary and extreme test data to prove the program works correctly.
2.7 Arrays (1‑D and 2‑D)
Arrays store a collection of values of the same type.
// 1‑D array of 5 integers
scores[5] ← {0,0,0,0,0}
// 2‑D array (3 rows × 2 columns)
matrix[3][2] ← {{1,2},{3,4},{5,6}}
Common operations: indexing, looping with FOR i ← 1 TO n, finding the sum or maximum.
2.8 File handling (basic syllabus requirements)
OPEN "data.txt" FOR READ AS f
WHILE NOT EOF(f) DO
READ line FROM f
// process line
ENDWHILE
CLOSE f
2.9 Databases and simple SQL (AO2 – application)
- Table structure – rows (records) and columns (fields).
- Key concepts: primary key, foreign key.
- Typical queries:
SELECT name, grade FROM students WHERE grade >= 70;
INSERT INTO students (name, grade) VALUES ('Ali', 85);
2.10 Boolean‑gate circuits (AO1 – knowledge)
| Gate | Symbol | Truth table |
| AND |
 |
|
| OR |
 |
|
| NOT |
 |
|
3. Operators – arithmetic, relational and Boolean
3.1 Arithmetic operators
| Operator | Name | Pseudocode example | Result |
| + | Addition | c ← a + b | Sum of a and b |
| - | Subtraction | c ← a - b | Difference of a and b |
| * | Multiplication | c ← a * b | Product of a and b |
| / | Division (real number) | c ← a / b | Quotient, may contain a fractional part |
| ^ | Exponentiation | c ← a ^ b | a raised to the power b |
| MOD | Modulus (remainder) | c ← MOD(a, b) | Remainder after a ÷ b |
| DIV | Integer division | c ← DIV(a, b) | Whole‑number part of a ÷ b |
3.2 Relational (logical) operators
| Operator | Meaning | Pseudocode example | Result |
| = | Equal to | a = b | TRUE if a and b are the same |
| <> | Not equal to | a <> b | TRUE if a and b differ |
| < | Less than | a < b | TRUE if a is smaller than b |
| > | Greater than | a > b | TRUE if a is larger than b |
| <= | Less than or equal to | a <= b | TRUE if a ≤ b |
| >= | Greater than or equal to | a >= b | TRUE if a ≥ b |
Note: In many languages equality is written == and inequality !=, but the IGCSE exam requires = and <>.
3.3 Boolean operators
| Operator | Name | Expression | Result |
| AND | Logical AND | A AND B | TRUE only if both A and B are TRUE |
| OR | Logical OR | A OR B | TRUE if at least one of A or B is TRUE |
| NOT | Logical NOT | NOT A | TRUE when A is FALSE, and FALSE when A is TRUE |
3.4 Operator precedence (highest → lowest)
- Parentheses
( )
- Unary operators –
NOT, unary minus -
- Exponentiation
^
- Multiplicative –
*, /, MOD, DIV
- Additive –
+, -
- Relational –
=, <>, <, >, <=, >=
- Logical AND
- Logical OR
Use parentheses to make the intended order explicit.
3.5 Example evaluation (step‑by‑step)
result ← (a + b) ^ 2 DIV c AND (d > e)
- Parentheses: evaluate
(a + b) and (d > e).
- Exponentiation:
(a + b) ^ 2.
- Integer division:
… DIV c (still a numeric value).
- Relational test:
(d > e) yields TRUE or FALSE.
- Logical AND combines the numeric result (treated as TRUE if non‑zero) with the Boolean result of step 4.
4. Truth tables for Boolean operators
AND
| A | B | A AND B |
| TRUE | TRUE | TRUE |
| TRUE | FALSE | FALSE |
| FALSE | TRUE | FALSE |
| FALSE | FALSE | FALSE |
OR
| A | B | A OR B |
| TRUE | TRUE | TRUE |
| TRUE | FALSE | TRUE |
| FALSE | TRUE | TRUE |
| FALSE | FALSE | FALSE |
NOT
| A | NOT A |
| TRUE | FALSE |
| FALSE | TRUE |
5. Example programs (pseudocode)
5.1 Average of three numbers
num1 ← 12
num2 ← 15
num3 ← 9
sum ← num1 + num2 + num3
average ← sum / 3
OUTPUT "Average = ", average
5.2 Eligibility test (relational + Boolean)
age ← 17
hasPermit← TRUE
eligible ← (age >= 16) AND hasPermit
IF eligible THEN
OUTPUT "You may drive."
ELSE
OUTPUT "You are not eligible."
ENDIF
5.3 Exponentiation and integer division
base ← 5
exp ← 3
power ← base ^ exp // 5³ = 125
quot ← DIV(125, 12) // 10
remainder ← MOD(125, 12) // 5
OUTPUT power, quot, remainder
5.4 Sum of an array (1‑D)
DECLARE scores[5] ← {8, 7, 9, 6, 10}
total ← 0
FOR i ← 1 TO 5 DO
total ← total + scores[i]
ENDFOR
OUTPUT "Total =", total
5.5 Simple file read (list of names)
OPEN "names.txt" FOR READ AS f
WHILE NOT EOF(f) DO
READ line FROM f
OUTPUT line
ENDWHILE
CLOSE f
5.6 Database query (SQL style)
SELECT name, grade
FROM students
WHERE grade >= 70;
5.7 Boolean‑gate circuit example (AND followed by NOT)
Expression: NOT (A AND B) – this is a NAND gate.
| A | B | A AND B | NOT (A AND B) |
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
6. Practice questions (with brief guidance)
- Precedence: Evaluate
5 + 3 * 2.
Multiplication first → 3*2 = 6; then addition → 5+6 = 11.
- Write a Boolean expression that is TRUE only when
n is between 10 and 20 inclusive.
Answer: (n >= 10) AND (n <= 20).
- Given
a ← 7 and b ← 3, evaluate MOD(a, b) = 1.
7 MOD 3 = 1 → expression is TRUE.
- Translate: “A student passes if they score at least 40 in the exam and have attendance of at least 75 %.”
Pseudocode: pass ← (examScore >= 40) AND (attendance >= 75).
- Using precedence, find the value of
result ← NOT (x > 5) OR (y = 0 AND z <> 2) for x←6, y←0, z←2.
Step‑1: (x > 5) → TRUE; NOT TRUE → FALSE.
Step‑2: (y = 0) → TRUE.
Step‑3: (z <> 2) → FALSE.
Step‑4: TRUE AND FALSE → FALSE.
Step‑5: FALSE OR FALSE → FALSE. Hence result = FALSE.
- Calculate integer division and remainder of 47 ÷ 6.
quot ← DIV(47, 6) // 7
rem ← MOD(47, 6) // 5
Write both statements in pseudocode as shown.
7. Summary of key points
- Computer systems: binary, hexadecimal, data representation, hardware, software, networking and security fundamentals.
- Algorithm design: life‑cycle, decomposition, flowcharts, trace tables, validation & verification.
- Operators: arithmetic (
+, -, *, /, ^, MOD, DIV), relational (=, <>, <, >, <=, >=), Boolean (AND, OR, NOT).
- Precedence determines the order of evaluation; parentheses override it.
- Truth tables are essential for checking Boolean logic and for designing gate circuits.
- Arrays, file handling and databases extend the basic programming toolkit and are required for many exam questions.
- Always follow the Cambridge pseudocode conventions – uppercase keywords, clear indentation and comments.