Translate a piece of Cambridge‑approved pseudocode into a correct flowchart using the standard symbols defined in the 9618 syllabus.
INPUT, IF, WHILE).← for storing values.Full details are available in the Cambridge Pseudocode Guide.
| Symbol | Name | Purpose |
|---|---|---|
| ○ | Start / End | Marks the beginning or termination of the algorithm. |
| ▷ | Input / Output | Reads data from the user or displays results. |
| ▯ | Process | Performs a calculation, assignment or any non‑decision operation. |
| ◇ | Decision | Tests a condition; produces two branches (Yes/No or True/False). |
| ● | Connector | Links separate parts of a large flowchart when space constraints require it. |
IF … THEN … ELSE … END IF) → Decision (diamond).FOR, WHILE) → Decision combined with a backward arrow to form a loop.n = 0 or n < 0.
INPUT n
IF n < 0 THEN
OUTPUT "Invalid input"
ELSE
SET fact ← 1
SET i ← 1
WHILE i ≤ n DO
SET fact ← fact × i
SET i ← i + 1
END WHILE
OUTPUT fact
END IF
n (▷)n < 0 (◇)
fact ← 1 (▯)i ← 1 (▯)i ≤ n (◇)
fact ← fact × i (▯)i ← i + 1 (▯) → back to the decision.fact (▷) → End.If n = 0, the loop condition i ≤ n is false on the first test, so the flowchart jumps directly to the final output, correctly returning fact = 1.
Convert the following pseudocode into a flowchart. Use the steps above and the mini‑checklist.
INPUT a, b
IF a = b THEN
OUTPUT "Numbers are equal"
ELSE
IF a > b THEN
SET max ← a
SET min ← b
ELSE
SET max ← b
SET min ← a
END IF
OUTPUT "Maximum = ", max
OUTPUT "Minimum = ", min
END IF
OUTPUT statements can be combined into a single Process block for a more compact diagram.IF makes the chart too wide.| Operation | 8‑bit Two’s‑Complement Result |
|---|---|
| 120 + 20 | 140 → 10001100 (binary) → Overflow → wraps to –116 |
| −70 − 60 | −130 → 11111110 (binary) → Overflow → wraps to 126 |
| Code‑point (hex) | Plane | UTF‑8 Bytes | Example Character |
|---|---|---|---|
| U+0041 | Basic Latin (Plane 0) | 1 (0x41) | A |
| U+00E9 | Latin‑1 Supplement | 2 (0xC3 0xA9) | é |
| U+20AC | Currency Symbols | 3 (0xE2 0x82 0xAC) | € |
| U+1F600 | Emoticons (Plane 1) | 4 (0xF0 0x9F 0x98 0x80) | 😀 |
Exercise: Encode the string “Café 😀” in UTF‑8 and calculate the total number of bytes.
| Codec | Type | Typical Bit‑rate | Compression Ratio | Typical Use |
|---|---|---|---|---|
| MP3 | Lossy | 128 kbps (stereo) | ≈10 : 1 | Music streaming |
| FLAC | Lossless | ~900 kbps (CD‑quality) | ≈2 : 1 | Archival audio |
| AAC | Lossy | 96 kbps (stereo) | ≈12 : 1 | YouTube, mobile |
Given the binary string 111100001111, apply Run‑Length Encoding and write the result as (value, count) pairs.
Answer: (1,4) (0,4) (1,4)
Use the free online tool Huffman Coding Visualiser to build a tree for the character frequencies: {A:5, B:9, C:12, D:13, E:16, F:45}. Record the resulting binary codes.
| CIDR | Subnet Mask | Number of Hosts |
|---|---|---|
| /24 | 255.255.255.0 | 2⁸ − 2 = 254 |
| /28 | 255.255.255.240 | 2⁴ − 2 = 14 |
| /64 (IPv6) | ffff:ffff:ffff:ffff:: | 2⁶⁴ ≈ 1.84 × 10¹⁹ |
Exercise: Convert the IPv4 address 192.168.12.0/26 into its binary form and list the first usable host address.
| Model | What the Provider Supplies | What the User Manages | Typical Example |
|---|---|---|---|
| IaaS | Virtual machines, storage, networking | OS, middleware, runtime, data, applications | AWS EC2, Azure Virtual Machines |
| PaaS | OS, runtime, middleware, development tools | Applications and data | Google App Engine, Heroku |
| SaaS | Everything (application delivered over the web) | None (except user data) | Office 365, Google Workspace |
Security note: As you move up the stack (IaaS → SaaS) the provider assumes more responsibility for patching and hardening, but the user must still manage access control and data protection.
Label each header field (MAC, IP, ICMP) on a diagram and indicate where TTL is decremented.
| Level | Typical Size | Typical Latency | Location |
|---|---|---|---|
| L1 | 16 KB – 64 KB | ≈1 cycle | Integrated into each core |
| L2 | 256 KB – 1 MB | ≈3–5 cycles | Per core (often shared by 2 cores) |
| L3 | 2 MB – 32 MB | ≈10–20 cycles | Shared among all cores on the chip |
Performance tip: Programs that exhibit good spatial and temporal locality (e.g., iterating through an array sequentially) make better use of the cache and run faster.
| Hazard Type | Description | Simple Mitigation |
|---|---|---|
| Data (RAW) | Instruction needs a result that a previous instruction has not yet produced. | Insert a NOP or use forwarding/bypass hardware. |
| Control (Branch) | Pipeline must decide which instruction to fetch after a branch. | Branch prediction or delay slots. |
| Structural | Two instructions compete for the same hardware resource (e.g., a single memory port). | Duplicate the resource or stall the pipeline. |
Mini‑exercise: For the following three‑instruction sequence, identify any hazards and suggest a single‑cycle stall if forwarding is not available.
1: LOAD R1, 0(R2) 2: ADD R3, R1, R4 3: STORE R3, 0(R5)
Design a flowchart for an algorithm that reads an integer n, checks whether it is a valid IPv4 host address (0 ≤ n ≤ 255), stores the value in a cache‑friendly array, and then outputs the binary representation using two’s‑complement (showing overflow handling). Include at least one decision that illustrates a pipeline hazard (e.g., a load followed by an add).
Use the mini‑checklists from the three sections to verify completeness, correctness, and alignment with the Cambridge 9618 syllabus.
Create an account or Login to take a Quiz
Log in to suggest improvements to this note.
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.