CAMBRIDGE INTERNATIONAL AS LEVEL
AS Computer Science (9618)
Access structured revision notes, topical questions, and video explanations
tailored for Cambridge 9618 paper preparation.
1.1 Number Systems & Conversions
Computers utilize the Binary (Base-2) number system consisting of 0 and 1. Decimal uses Base-10, while Hexadecimal uses Base-16 (0–9 and A–F).
Interactive 8-Bit Binary Converter
Click on individual bits to toggle between 0 and 1, or type a denary number (0–255):
Hexadecimal System (Base 16)
Hexadecimal simplifies long binary strings by grouping them into 4-bit nibbles.
| Hex | Binary | Denary |
|---|---|---|
| A | 1010 | 10 |
| B | 1011 | 11 |
| C | 1100 | 12 |
| D | 1101 | 13 |
| E | 1110 | 14 |
| F | 1111 | 15 |
Practical Hexadecimal Uses
- MAC Addresses: 48-bit unique hardware identifiers represented as 6 hex pairs.
- IPv6 Addresses: Network layer addressing.
- HTML Color Codes: Encodes RGB values (e.g.,
#FBBC04). - Error Codes: Refers to specific memory locations.
1.2 Binary Addition, Shifts & Two's Complement
Binary Addition Rules
- 0 + 0 = 0 (Carry 0)
- 0 + 1 = 1 (Carry 0)
- 1 + 1 = 0 (Carry 1)
- 1 + 1 + 1 = 1 (Carry 1)
Logical Binary Shifts
Shifting bits changes value exponentially:
- Logical Left Shift: Moves bits left, padding 0s on the right. Multiplies by 2n.
- Logical Right Shift: Moves bits right, padding 0s on the left. Divides by 2n.
Two's Complement Generator (Signed Integers)
Represents negative numbers in binary. The Most Significant Bit (MSB) carries a negative weight.
1.3 Sound Representation & Sampling
Sound is naturally continuous (analogue). Computers convert analogue sound to digital signals using an Analogue-to-Digital Converter (ADC) via sampling.
Key Sampling Terms
- Sampling: Measuring amplitude at regular intervals.
- Sampling Rate: Samples taken per second (Hz).
- Sampling Resolution: Bits allocated per sample.
Impact of Higher Sampling
| Benefits | Drawbacks |
|---|---|
| Better quality Less distortion |
Larger file size Slower transmission |
Visualizer: Analogue Wave vs Digital Sampling
1.4 Bitmap vs Vector Graphics
Bitmap Graphics
Composed of a 2D matrix of tiny squares called pixels.
- Colour Depth: Bits per pixel (2n colors).
- Resolution: Total grid dimension (Width × Height).
- File Header: Stores metadata.
Vector Graphics
Uses 2D coordinates to draw geometric shapes defined by properties.
- Drawing List: Commands defining objects.
- Scalability: Resized without quality loss.
- File Formats:
SVG,CGM,ODG.
Scaling Comparison
Bitmap (Pixelates)
Vector (Sharp Scaling)
1.5 File Size Calculations & Compression
Prefixes: Decimal vs Binary
| Decimal | Base 10 | Binary | Base 2 |
|---|---|---|---|
| kilo (kB) | 103 | kibi (KiB) | 210 |
| mega (MB) | 106 | mebi (MiB) | 220 |
Compression Techniques
Lossy: Permanently removes unnecessary data (e.g., JPEG, MP3).
Lossless: Reduces size without losing detail (e.g., RLE).
Interactive RLE Encoder
Chapter Summary & Quick Reference
Core Formulas
-
Bitmap Image Size (bits):
Width × Height × Colour Depth -
Mono Sound Size (bits):
Sample Rate × Resolution × Duration
| Topic | Key Takeaway |
|---|---|
| Number Systems | Binary, Denary, Hexadecimal, BCD. |
| Text Encoding | ASCII vs Unicode. |
| Sound | Analogue waves sampled via ADC. |
| Graphics | Bitmaps store pixels; Vectors store shapes. |
| Compression | Lossy discards data; Lossless uses RLE. |
- Private Networks: Owned by a single organization (LANs/intranets), restricting entry via authentication parameters like User IDs and Passwords.
- Public Networks: Owned by telecommunication carriers (PSTN); accessible without passwords, though subnetworks may impose security controls.
| Network Type | Geographical Reach | Connection Medium | Ownership / Example |
|---|---|---|---|
| LAN | Single room, building, or small localized site. | Physical cables connected to central switches or hubs. | Owned directly by the organization. |
| WLAN | Short range (up to 100 metres). | Radio or infrared signal links (no physical wires). | Wireless localized coverage. |
| WAN | Vast geographical distances, linking remote nodes. | Joined via external routers, modems, or leased lines. | Bank Automated Teller Machine (ATM) systems. |
- Client-Server Model: Uses dedicated servers to control access to shared databases and hardware. Central servers handle email distribution, file hosting, and automatic nightly data backups. Offers central user authentication, but risks network bottlenecking under high concurrent traffic.
- Peer-to-Peer Model: Every joined node functions simultaneously as both a provider and consumer of resources. Uses a designated "lookup" computer to coordinate node capabilities. Recommended for small setups (under 10 nodes) due to security limitations and decentralization.
| Metric | Thin Client | Thick Client |
|---|---|---|
| Processing | Relies completely on remote server processing. | Executes applications locally using native resources. |
| Resource Needs | Minimal local storage (RAM, CPU, SSD). | Requires substantial local system hardware. |
| Network Dependency | Requires a continuous, high-speed connection. | Can process data offline without active connections. |
| Pros & Cons | Lower device cost; vulnerable to server failure. | High local control; difficult to update individually. |
- Bus Topology: Uses a central line cable. Simple, but a break in the backbone brings down the whole network. Data travels unidirectionally.
- Star Topology: Nodes connect independently to a central switch/hub. High installation cost, but failure of one node does not impact others.
- Mesh Topology: Configured via Routing (uses node logic to send data along the shortest operational path) or Flooding (broadcasts data to all nodes indiscriminately).
- Hybrid Topology: Integrates two or more distinct topologies. Handles heavy data volumes efficiently, though maintenance is complex.
| Cable Type | Relative Cost | Bandwidth Potential | Attenuation Susceptibility | Interference Impact |
|---|---|---|---|---|
| Twisted Pair | Lowest | Lowest | High loss over distance | Worst affected by EMI |
| Coaxial Cable | Moderate | Moderate | Most affected over long spans | Moderately shielded |
| Fibre-Optic | Highest | Extremely High | Lowest signal loss | Immune to EMI |
- Radio Waves (3 kHz–3 GHz): Penetrate physical structures easily; suitable for localized Wi-Fi signals.
- Microwaves (3 GHz–300 GHz): Directional propagation with higher bandwidth capacities.
- Infrared (300 GHz–400 THz): High signal attenuation; cannot breach physical walls, making it secure for short-range indoor controls.
- Satellites: Relays directional microwave signals across extensive global distances.
- Hub: Receives incoming packets and broadcasts them out to every connected port, wasting network bandwidth.
- Switch: Examines incoming frames for MAC addresses and forwards data packets only to the specified recipient node.
- Repeater: Amplifies signals on copper (analog) or fiber (digital) links to correct data attenuation over long runs.
- Bridge: Links two discrete LAN segments using identical protocols into a unified operational network.
- Router: Maps optimal paths between dissimilar networks (e.g., LAN to WAN) by reading IP targets and translating frame headers.
- Gateway: Converts data protocol structures completely when bridging networks running on entirely different systems.
- Modem: Modulates digital compute signals into analog formats (and demodulates incoming signals back to digital) for transmission over telephone infrastructure.
- NIC / WNIC: Interfacing hardware providing a hardware MAC address for device identification over wired or wireless mediums.
| Feature | Router | Gateway |
|---|---|---|
| Primary Role | Routes packet data along optimal routes across network boundaries. | Translates data packets between incompatible network protocols. |
| Protocol Conversion | Translates basic transport headers (e.g., Ethernet to Wi-Fi). | Performs full multi-layer protocol conversion. |
| Routing Logic | Supports dynamic routing selection. | Does not use dynamic routing. |
- Device checks signal voltage level on shared network line.
- If line is busy, device pauses for a random interval before re-checking.
- If line is clear, the node begins frame transmission.
- Continuous line voltage monitoring occurs while transmitting data.
- If a voltage spike occurs (collision), transmission halts immediately and a Jam Signal is broadcast.
- Transmitting nodes wait a random length back-off interval before re-queuing frames.
- Public Cloud: Architecture hosted by third-party suppliers, serving resources to multiple commercial tenants across shared hardware.
- Private Cloud: Dedicated server environment operated behind an organization's specific firewall.
- Hybrid Cloud: Integrates private infrastructure for core sensitive data alongside public cloud instances for scalable operations.
- Pros: Ubiquitous data access from any device; offsite disaster-recovery protection; virtually unlimited capacity scalability.
- Cons: Total dependency on high-speed internet connections; ongoing storage subscription fees; risk of data loss if provider defaults.
- Real-Time Streaming: Live content streamed without persistent storage on the client; video cannot be paused or fast-forwarded.
- On-Demand Streaming: Pre-recorded files streamed from media servers to local buffers, allowing pause, rewind, and playback controls.
- Buffer Requirement: Server data transfer speeds to the buffer must remain higher than the playback rate from the buffer to the media software to prevent playback stalls.
| Class | Starting Bits | Address Range | NetID Bits | HostID Bits |
|---|---|---|---|---|
| Class A | 0 | 0.0.0.0 to 127.255.255.255 | 8 | 24 |
| Class B | 10 | 128.0.0.0 to 191.255.255.255 | 16 | 16 |
| Class C | 110 | 192.0.0.0 to 223.255.255.255 | 24 | 8 |
- Classless Inter-Domain Routing (CIDR): Avoids traditional Class A–C IP wastage by using flexible prefix notations (e.g.,
192.30.250.00/18indicates an 18-bit network ID). - IPv6 Infrastructure: Uses 128-bit hex blocks (e.g.,
A8FB:7A88:FFF0:0FFF:3D21:2085:66FB:F0FA) separated by colons. Eliminates NAT reliance and avoids address conflicts.
- Private IP Ranges: Reserved for internal LANs behind NAT routers.
- 10.0.0.0 to 10.255.255.255
- 172.16.0.0 to 172.31.255.255
- 192.168.0.0 to 192.168.255.255
- Public IP Addresses: Globally unique endpoints directly reachable on the internet, assigned to WAN router interfaces, public servers, and DNS nodes.
- User enters a URL in a browser; client requests matching address from local DNS Server 1.
- If missing from cache, DNS Server 1 queries external DNS Server 2.
- DNS Server 2 matches domain to IP address, returning numerical route to Server 1.
- Server 1 caches the mapped mapping and sends target IP address to client system.
- Client browser connects to server host to load target HTML resources.
- JavaScript: Executes client-side inside user browser instances to handle dynamic page logic.
- PHP: Executes server-side before serving plain HTML output down to requesting browsers.
- Network Scope: LANs handle localized communications; WANs bridge distant sites over external lines.
- System Models: Client-Server configurations utilize central servers for security, backup, and file management. Peer-to-Peer networks distribute processing across equivalent workstations. Thin clients rely on server processing, while Thick clients process data locally.
- Topology & Media: Star topology is common in modern LANs to isolate line faults. Transmission lines range from copper twisted pairs to high-bandwidth fiber optics and wireless spectrums.
- Hardware & CSMA/CD: Switches direct traffic via MAC addresses. Shared legacy Ethernet lines rely on CSMA/CD to detect line voltage changes and handle collisions via jam signals and back-off timers.
- Cloud & Bit Streaming: Cloud options include private, public, and hybrid models. Streaming requires server transfer rates to stay ahead of buffer playback to prevent interruptions.
- Addressing & DNS: Internet communications rely on IPv4/IPv6 addresses. Subnetting and CIDR optimize routing boundaries. DNS maps human-readable URLs to destination server IPs.
- Primary Memory: Storage accessible directly by the CPU to process applications and temporary operational instructions .
- RAM (Random Access Memory): Data location access speeds are uniform regardless of physical memory address . Volatile (loses state on power loss) . Supports read/write modifications to running programs and OS elements .
- ROM (Read Only Memory): Permanent, non-volatile storage used to store bootstrap start-up software (such as BIOS) .
| Feature | Dynamic RAM (DRAM) | Static RAM (SRAM) |
|---|---|---|
| Internal Construction | Consists of transistors and capacitors . | Constructed using logical flip-flops . |
| Refresh Requirements | Requires constant charge refreshing . | Does not require constant refreshing . |
| Access Speed & Density | Slower access; higher density & lower cost . | Faster access; lower density & higher cost . |
| Typical Application | Main System Memory . | CPU High-Speed Cache Memory . |
| Power Consumption | Higher baseline power (refresh cycle draw) . | Lower baseline; scales with access rate . |
- PROM (Programmable ROM): Manufactured with a matrix of microscopic fuses . Programmed once using a PROM writer through high electric currents that selectively burn fuses . Commonly used in mobile devices and RFID tags .
- EPROM (Erasable Programmable ROM): Built using floating-gate transistors and capacitors . Erased by exposing the chip to Ultraviolet (UV) light through a transparent quartz window . Often used for prototype development setups like unreleased game consoles .
- EEPROM (Electrically Erasable Programmable ROM): Erased and reprogrammed using electric voltage pulses rather than UV light; forms the underlying architecture of flash memory devices .
An embedded system incorporates a dedicated microprocessor inside a dedicated hardware shell to monitor and run control routines . Examples include web-managed refrigerators, modern cookers, and central heating controllers .
| Advantages | Disadvantages |
|---|---|
| Small physical form factor; fits into small enclosures . | Upgrading hardware to new standards is difficult . |
| Low manufacturing costs due to high-volume production . | Fault troubleshooting requires specialized technicians . |
| Simple interface; often operates without a dedicated OS . | Interface navigation can be unintuitive (e.g., setting a cooker clock) . |
| Low power consumption; fast real-time response times . | Internet-connected systems create security vulnerabilities . |
| High reliability in mass-produced devices . | Faulty units are often discarded rather than repaired, causing electronic waste . |
- Data is written digitally onto spinning magnetic platters operating around 7,000 RPM .
- Read/Write heads move across concentric tracks divided into fixed-size sectors .
- Latency Issue: Time lost while waiting for a specific disk sector to rotate under the read-write head . File fragmentation forces additional head positioning moves, increasing latency . Defragmentation software reorganizes non-adjacent file blocks to optimize access speeds .
- Non-volatile rewritable media constructed without moving parts, eliminating rotational latency .
- Controls electron movement across floating gate transistors inside NAND logic flash arrays (or NOR arrays in EEPROM setups) .
- Benefits: Highly durable, lighter, lower power consumption, cooler operation, and faster data access speeds compared to HDDs .
- Drawback: Limited write endurance compared to magnetic media over extended usage cycles .
| Format | Laser Type | Wavelength | Disc Construction | Track Pitch |
|---|---|---|---|---|
| CD | Red Laser | 780 nm | Single 1.2 mm Polycarbonate | 1.60 µm |
| DVD | Red Laser | 650 nm | Two 0.6 mm Polycarbonate layers | 0.74 µm |
| Blu-ray | Blue Laser | 405 nm | Single 1.1 mm Polycarbonate layer | 0.30 µm |
- Document data is sent to the printer driver software .
- Driver converts data into a compatible printer format .
- Driver verifies printer availability (checking paper, ink, and status) .
- Data is buffered into local printer RAM .
- Printing drum receives a positive charge; a sweeping laser beam selectively discharges areas to leave negative charges that form the document image .
- Positively charged toner powder is applied, sticking only to the negatively charged drum areas .
- Negatively charged paper rolls over the drum, transferring the toner to the paper .
- Electric charge is neutralized to prevent paper sticking to the drum .
- A heated fuser unit melts toner permanently into the paper fibers .
- Discharge lamps clear lingering electrical charges from the drum .
- Additive Manufacturing (3D Printing): Builds physical objects layer-by-layer using powdered materials (plastics or metals) .
- Subtractive Manufacturing (CNC Machining / Carving): Cuts away unwanted material from a solid block to form the final object .
- Loudspeaker Output: Digital audio passes through a Digital-to-Analogue Converter (DAC) and an amplifier to generate varying electrical currents . Current passes through an iron core coil placed near a permanent magnet . The changing magnetic field causes the core and attached synthetic cone to vibrate, generating sound waves in the air .
- Microphone Input: Sound waves cause an internal diaphragm to vibrate . An attached copper coil moves relative to a permanent magnet, inducing an analogue electrical current . An Analogue-to-Digital Converter (ADC) inside a sound card digitizes the waveform for storage .
| Type | Working Principle | Pros | Cons |
|---|---|---|---|
| Capacitive | Multi-layer glass acts as a capacitor, tracking electrostatic field shifts on touch . | High durability, multi-touch support, clear visibility in sunlight . | Requires conductive touch (bare fingers or specialized styluses) . |
| Resistive | Flexible top polyester layer touches a bottom glass layer, closing an electrical circuit . | Low cost, operational with bare fingers, gloved hands, or any stylus . | Lower durability, single touch only, prone to calibration drift . |
| Sensor Type | Primary Applications |
|---|---|
| Temperature | Central heating management, chemical process tracking, greenhouse climate control . |
| Moisture / Humidity | Soil moisture analysis, industrial dampness detection . |
| Light | Automated street lighting, automatic vehicle headlight activation . |
| Infrared / Motion | Security intrusion alarms, visitor counting systems . |
| Pressure | Intruder detection pads, liquid pressure safety monitoring . |
| Acoustic / Sound | Security noise tracking, pipe leak acoustic detection . |
| Gas ($\text{O}_2 / \text{CO}_2$) | Greenhouse gas tracking, power station leak warnings . |
| pH Level | Soil acidity monitoring, river pollution tracking . |
| Magnetic Field | Mobile phone orienting, Anti-lock Braking Systems (ABS) . |
Adjust simulated temperature to observe closed-loop sensor/actuator operations.
Evaluates expression: X = (A AND B) OR (B NOR C) XOR C
Intermediate Wire Q (B NOR C): 1
Intermediate Wire R (P OR Q): 1
Final Output X (R XOR C): 1
| A | B | C | P = A AND B | Q = B NOR C | R = P OR Q | X = R XOR C |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 0 | 0 | 1 |
| 1 | 0 | 0 | 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 | 1 |
| 1 | 1 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 | 0 |
To derive a canonical logic expression from a truth table, construct boolean product terms for each row where the output $X = 1$ :
- For Row with inputs (A=1, B=0, C=0) $\rightarrow$ term is A AND NOT B AND NOT C .
- For Row with inputs (A=1, B=1, C=1) $\rightarrow$ term is A AND B AND C .
Combine terms using OR operators :
X = (A AND NOT B AND NOT C) OR (A AND B AND C)
- Memory Systems: Primary memory (RAM/ROM) connects directly to the CPU . Dynamic RAM requires periodic refreshing, while Static RAM uses flip-flops for high-speed cache applications . Non-volatile ROM types include PROM (fusible links) and EPROM (UV-erasable) .
- Storage Technologies: Secondary storage provides high-capacity, non-volatile data retention . Magnetic HDDs use spinning platters subject to mechanical latency and fragmentation . Non-moving NAND flash SSDs offer higher access speeds and lower power consumption . Optical media (CD, DVD, Blu-ray) use distinct laser wavelengths to read spiral track pit configurations .
- Peripherals & Actuators: Laser printers apply drum charges and heated fusers to bond toner to paper . DACs transform digital sound samples into physical speaker cone vibrations . Capacitive touchscreens rely on skin conductivity, while resistive screens use pressure-activated circuit contacts .
- Sensors & Control Systems: Sensors convert physical environmental metrics into analogue voltages, which ADCs convert into digital values for microprocessors . Monitoring systems issue alerts without changing environment variables, while Control systems send output signals to actuators to maintain closed-loop parameters .
- Logic Gates: Digital logic systems process inputs using standard logic gates (NOT, AND, OR, NAND, NOR, XOR) . Truth tables evaluate intermediate node paths and output logic equations .
4.1 Central Processing Unit (CPU) Architecture
The Von Neumann Model establishes that computer systems store both data and program instructions in a shared memory unit, executing instructions sequentially.
Core CPU Components
- Arithmetic Logic Unit (ALU): Performs arithmetic (+, -) and logical (AND, OR, XOR) operations. Can feature separate units for fixed-point and floating-point math.
- Control Unit (CU): Fetches instructions from memory, decodes them, and coordinates hardware components using timing signals.
- System Clock: Emits timing pulses on the control bus to synchronize CPU operations.
- Immediate Access Store (IAS): High-speed internal memory holding data and programs currently being processed for fast read/write cycles.
Special Purpose Registers
| Register | Abbr. | Primary Function |
|---|---|---|
| Program Counter | PC | Holds the memory address of the next instruction to be fetched. |
| Memory Address Register | MAR | Holds the address in memory currently being written to or read from. |
| Memory Data Register | MDR | Stores data read from memory or waiting to be written to memory. |
| Current Instruction Register | CIR | Holds the instruction currently being decoded and executed. |
| Accumulator | ACC | Temporary general-purpose register holding intermediate ALU results. |
| Index Register | IX | Used to store offset values during indexed addressing operations. |
| Status Register | SR | Contains individual flag bits updated after arithmetic/logic operations:
|
System Buses & Hardware Ports
System Buses
- Address Bus: Unidirectional. Carries memory addresses from CPU to memory/IO. Wider buses increase memory address space (2n locations).
- Data Bus: Bidirectional. Transfers instructions, addresses, and data between CPU, memory, and IO. Bus width determines CPU word length.
- Control Bus: Bidirectional. Transmits operational control and timing signals from the CU across components (typically 8 bits wide).
Hardware Ports Comparison
| Port Type | Key Features | Pros | Cons |
|---|---|---|---|
| USB (Universal Serial Bus) | Asynchronous serial connection. Auto-detects device connection via voltage changes. | Auto-loads drivers; global standard; one-way keyed connector prevents incorrect plugin; backward compatible. | Max cable length ~5m; older standards limited to <500 Mbps. |
| HDMI | High-definition digital visual and audio output. Widescreen 16:9, resolutions up to 1920 × 1080 @ 120Hz. | Modern high-speed standard; high refresh rate and color depth; built-in piracy protection. | Connection is physically fragile; limited cable length for signal preservation; 5 distinct connector standards. |
| VGA | Legacy analog video interface. Supports 640 × 480 @ 60Hz (16 colors) or 320 × 200 (256 colors). | Simple, single standard; physically secure screw-in design; easy signal splitting. | Outdated analog tech; connection pins bend easily; requires high-grade shielded cable. |
The Fetch-Execute (F-E) Cycle & Interrupts
Register Transfer Notation (RTN)
MAR ← [PC] : Copy address from PC to MARPC ← [PC] + 1 : Increment PC to point to next instruction addressMDR ← [[MAR]] : Fetch instruction stored at memory address in MAR into MDRCIR ← [MDR] : Copy instruction from MDR to CIR for decodingInterrupt Handling Routine
An interrupt is a signal generated by hardware or software requiring CPU attention (e.g., user input, hardware failure, timer, program error).
- During each cycle, the CPU checks the Interrupt Register.
- If an interrupt signal exists, the CPU suspends current task execution and saves current register contents (registers pushed to stack).
- Control transfers to the specific Interrupt Service Routine (ISR).
- Once serviced, original register contents are restored, allowing the primary program to resume.
4.2 Assembly Language & Assemblers
Assembly language uses mnemonic opcodes and symbolic operands, providing a direct 1:1 mapping to binary machine code.
Two-Pass Assembler Process
| Pass 1 | Pass 2 |
|---|---|
|
|
Addressing Modes
- Immediate (
#n): Operand is the actual numeric value. - Direct (
<address>): Operand is the memory address holding the data. - Indirect (
<address>): Operand holds a memory address which points to the target data location. - Indexed (
LDX <address>): Target address = Specified Base Address + Index Register (IX) value. - Relative (
JMR #n): Address used is current instruction address + operand offset. - Symbolic: Label used in place of an absolute numerical memory address.
Instruction Set Quick Reference (CS 9618)
| Group | Opcode | Operand | Description |
|---|---|---|---|
| Data Movement | LDM | #n | Load denary number n into ACC |
| LDD | <address> | Load content of direct address into ACC | |
| STO | <address> | Store ACC contents at target address | |
| MOV | <register> | Move ACC contents to specified register (IX) | |
| I/O & System | IN | - | Read character from keyboard into ACC (ASCII) |
| OUT | - | Output ASCII character in ACC to screen | |
| Arithmetic | ADD | <address> / #n | Add memory content or immediate value to ACC |
| INC | <register> | Increment contents of register (ACC or IX) by 1 | |
| Control / Jump | JMP | <address> | Unconditional jump to specified address |
| JPE / JPN | <address> | Jump to address if previous comparison was True / False |
4.3 Bit Manipulation & Binary Shifts
Shift Types Summary
- Logical Shift (LSL / LSR): Shifts bits left or right; vacated positions are padded with zeros. Used for unsigned multiplication/division by powers of 2.
- Arithmetic Shift (ASR / ASL): Preserves the sign bit (MSB) during right shifts to maintain two's complement sign integrity during integer division.
- Cyclic Shift (ROL / ROR): No bits lost. Bits pushed off one end re-enter at the opposite end.
Bit Masking Operations
| Operation | Logic Gate | Mask Bit | Use Case |
|---|---|---|---|
| Test Bit / Clear Bits | AND | 0 = Clear / 1 = Retain | Isolates individual flag bits to check status or reset targeted bits. |
| Set Bit | OR | 1 = Set / 0 = Retain | Forces specific bit positions to 1 while keeping other bits unchanged. |
| Invert / Toggle Bit | XOR | 1 = Toggle / 0 = Retain | Flips target bit states (0 to 1, 1 to 0) or clears matched bit patterns. |
Chapter Summary: Processor Fundamentals
Core Takeaways
- Von Neumann Architecture: Relies on stored program execution where data and instructions share primary memory, processed sequentially by CPU registers, CU, and ALU.
- Registers & Buses: Special-purpose registers (PC, MAR, MDR, CIR, ACC, IX, SR) coordinate execution. Performance depends on bus widths (Address/Data), clock speed, cache size, and multi-core configurations.
- Fetch-Execute Cycle: Governed by RTN (
MAR ← [PC],PC ← [PC] + 1,MDR ← [[MAR]],CIR ← [MDR]). Interrupts are checked at each cycle end and handled by an ISR. - Assembly & Translation: Low-level code translated via a two-pass assembler. Pass 1 generates symbol address mappings; Pass 2 outputs object machine code.
- Bit Manipulation: Bit masking with AND, OR, XOR enables direct hardware device monitoring and control, while logical, arithmetic, and cyclic shifts manage binary data manipulation.
5.1 Operating System & Key Management Tasks
An Operating System (OS) provides the software platform required to run applications and provides the interface between human users and the hardware.
Key Management Functions
- Memory Management: Handles memory optimization (allocating/deallocating RAM, swapping data with HDD/SSD), memory organization (contiguous, partitioned, paged, or segmented allocation), and memory protection (preventing programs from overwriting each other's memory space).
- Process Management: Allocates resources and synchronizes data exchange between simultaneously running execution processes.
- Hardware & Peripheral Management: Uses device drivers to translate I/O data formats, manages hardware resource priority, and handles queues/buffers (e.g., printer queues and print buffers).
- File Management: Controls directory structures, file naming conventions, access control rights/file locks, logical formats (FAT/NTFS), and file operations (create, move, delete).
- Security Management: Manages updates, firewalls, passwords, multi-user access privileges, system restore functions, and security software integration.
Interface Comparison
| Interface Type | Description | Characteristics |
|---|---|---|
| Command Line Interface (CLI) | Requires users to type text commands directly to execute software and manage files. | Direct communication; flexible control; not restricted to predetermined menu options. |
| Graphical User Interface (GUI) | Allows interaction using visual icons, windows, menus, and pointers. | User-friendly; visual interaction; ideal for end-user consumer devices. |
5.1 Operating System Utility Software
Utilities are system software tools provided with the OS that assist in maintaining, optimizing, and securing the computer system.
Common Utilities Overview
| Utility | Primary Functions |
|---|---|
| Disk Formatter | Organizes disk space into partitions/contiguous blocks. Performs sector-checking tests to flag and replace bad sectors. Full formatting overwrites sectors with zeros. |
| Antivirus Software | Constantly monitors the system; compares files against known virus databases; performs heuristic checking for suspicious behavior; quarantines or deletes infected files. |
| Defragmentation Software | Rearranges fragmented file blocks on HDDs into contiguous sectors and consolidates free space. Reduces read/write head movement to speed up file access. |
| Back-up & Recovery | Schedules automated file backups (triggering only when files change), creates system restore points, and restores lost/corrupted files. |
Hard Bad Sectors vs. Soft Bad Sectors
| Bad Sector Type | Primary Causes |
|---|---|
| Hard Bad Sectors (Physical/Permanent) | Manufacturing imperfections, physical contact between read-write head and platter, moving HDD without parking heads, or physical crashes. |
| Soft Bad Sectors (Logical/Fixable) | Sudden loss of power causing interrupted writes, static electricity, or data corruption in specific sector header records. |
5.1 Program Libraries & Dynamic Link Libraries (DLL)
Program libraries consist of pre-written subroutines that developers can incorporate into their applications to shorten development time.
Dynamic Link Libraries (DLL)
DLL files are stand-alone library subroutines that are linked to the main application at runtime rather than being compiled into the main executable. Multiple applications can share a single DLL file concurrently in memory.
Advantages & Disadvantages of DLLs
| Pros of DLL Files | Cons of DLL Files |
|---|---|
| Smaller Executable Size: Main program code remains smaller as subroutines load into memory only at runtime. | Dependency Risks: Main executable is not self-contained; missing DLL files prevent the program from running. |
| Independent Updates: DLL files can be updated or patched without recompiling the main application. | Linking Errors: Changes or corruption in DLL files can lead to unexpected runtime crashes or instability. |
| Resource Efficiency: Conserves system memory and disk storage through shared module access. | Malware Vulnerability: Malicious modifications to DLL files pose severe security risks to all linked applications. |
5.2 Language Translators
Translators are system software tools that convert source code written in assembly or high-level languages into binary machine code that the CPU can execute.
Translator Types Comparison
| Feature | Assembler | Compiler | Interpreter |
|---|---|---|---|
| Input Language | Assembly Language | High-Level Language | High-Level Language |
| Machine Dependence | Yes | No | No |
| Executable Object File Produced? | Yes (Stored on disk/RAM) | Yes (Stored on disk/RAM) | No (Executed directly) |
| Instruction Translation Ratio | 1 : 1 (1 instruction = 1 machine code line) | 1 : Many (Instruction explosion) | 1 : Many (Instruction explosion) |
Compiler vs. Interpreter Trade-offs
| Metric | Compiler | Interpreter |
|---|---|---|
| Execution Speed | Fast execution; code is pre-compiled and optimized. | Slower; each line must be translated at runtime every time it runs. |
| Source Code Protection | High protection; end users only receive executable object code. | Low protection; source code must be distributed to the end user. |
| Debugging & Development | Harder; must recompile entire source program after fixing errors. | Easier; execution stops directly at error line for immediate fixing. |
5.2 Integrated Development Environment (IDE)
An IDE is a comprehensive software suite that provides programmers with all necessary tools for writing, testing, and debugging software applications.
Key IDE Features
- Source Code Editor: Text editor equipped with syntax highlighting (prettyprinting) and code block collapsing. Includes context-sensitive auto-completion prompts.
- Dynamic Syntax Checking: Scans code in real-time as it is typed to alert the programmer to syntax errors immediately.
- Run-time Environment & Translators: Integrated compilers or interpreters to execute applications directly within the IDE workspace.
- Debugger Tools:
- Single Stepping: Executes code line-by-line to monitor step-by-step logic.
- Breakpoints: Pauses program execution at a specific line.
- Report / Variable Window: Displays real-time values stored in variables and expressions at execution pause.
- Auto-documenter: Analyzes source code structures and automatically generates documentation detailing program logic and function definitions.
Chapter 5 Summary: System Software
Key Takeaways
- Operating System Functions: The OS acts as the core interface (GUI/CLI) and manages RAM allocation/protection, CPU processes, I/O peripherals via drivers and queues, file storage structures, and user security permissions.
- Utility Software: Essential maintenance tasks are fulfilled by disk formatters (repairing bad sectors), virus checkers (heuristic scanning), defragmenters (consolidating fragmented HDD blocks), and backup utilities.
- Program Libraries & DLLs: DLLs allow dynamic module loading at runtime, reducing executable file sizes and permitting modular updates without full program recompilation.
- Translators: Assemblers translate assembly code 1-to-1. Compilers generate standalone optimized machine code files. Interpreters execute HLL source code line-by-line without saving an object file, making them ideal for development.
- IDE Productivity: IDEs integrate code editing (syntax highlighting, dynamic checking), execution runtime, and debugging suites (breakpoints, single-stepping, variable tracking).
6.1 Data Security, Privacy & Integrity Concepts
Data stored on computer systems requires comprehensive safeguards to maintain usability, maintain confidentiality, and protect against corruption.
Core Terminology Distinction
| Concept | Definition | Primary Focus |
|---|---|---|
| Data Security | Methods used to protect data against unauthorized access, corruption, or loss, alongside recovery mechanisms if lost. | Protection & Recoverability |
| Data Privacy | Ensuring data subject rights through legal compliance and rules governing data collection and processing. | Legal Rights & Access Control |
| Data Integrity | Ensuring stored data remains accurate, consistent, reasonable, and up-to-date. | Accuracy & Consistency |
6.1.1 Principles of Data Privacy Laws
Data privacy is regulated by data protection laws requiring compliance across eight core principles:
- Data must be fairly and lawfully processed.
- Data can only be processed for stated purposes.
- Data must be adequate, relevant, and not excessive.
- Data must be kept accurate and up-to-date.
- Data must not be retained longer than necessary.
- Data must be processed in accordance with data subject rights.
- Data must be kept secure against unauthorized processing or loss.
- Data must not be transferred abroad without adequate protective laws.
6.1 Threats to Security & Protective Measures
Computer networks and stand-alone systems face constant threats targeting infrastructure and sensitive information.
Malware & Security Risks
| Threat Category | Mechanism & Impact |
|---|---|
| Hacking | Malicious: Illegal system access without permission. Ethical: Authorized testing to check system robustness. |
| Viruses & Worms | Virus: Code replicating to corrupt/delete files. Worm: Stand-alone malware spreading across networks automatically. |
| Trojan Horse | Malicious code disguised as legitimate software to cause system damage. |
| Spyware | Monitors user activity (e.g., keyloggers recording keystrokes) and transmits data back. |
| Phishing | Sending legitimate-looking emails with fake links to trick users into giving credentials. |
| Pharming | Malicious code installed on a PC or server that redirects traffic to fake sites automatically. |
Methods to Restrict Security Risks
- User Accounts & Access Rights: Restrict system permissions based on credentials.
- Firewalls & Encryption: Filter network traffic and encode data to render it unreadable without keys.
- Biometrics & Digital Signatures: Authenticate identity using unique biological traits or cryptographic signatures.
- Pharming Mitigation: Use updated web browsers, verify HTTPS/green padlock symbols, check URL spellings, and maintain active anti-virus software.
6.1 Data Loss Causes & Recovery Protocols
System failures, accidental operations, or software issues require predefined backup and recovery procedures.
| Cause of Data Loss | Preventative & Recovery Measures |
|---|---|
| Accidental File Deletion | Perform regular backups; store backups off-site or on secondary media; restrict access rights. |
| Hardware Failure (e.g., HDD Head Crash) | Maintain regular backups; install Uninterruptible Power Supplies (UPS); deploy parallel redundant systems. |
| Software Faults & Crashes | Frequent automated saving; regular backups; testing software compatibility prior to deployment. |
| Incorrect User Operation | Implement rigorous user training programs; enforce strict operational protocols (e.g., safe removal procedures). |
6.2 Data Validation Methods
Validation is an automated computer check ensuring entered data is reasonable and conforms to specified criteria. It cannot check if data is correct or accurate.
Validation Methods Reference
| Validation Check | Description | Fail Example | Pass Example |
|---|---|---|---|
| Type Check | Ensures non-numeric data is not entered into numeric fields. | sk34 |
34.50 |
| Range Check | Verifies data lies between an upper and lower limit. | 120 (Age) |
48 |
| Format Check | Ensures entry matches a specified pattern (e.g., dd/mm/yyyy). |
12-12-20 |
12/12/2020 |
| Length Check | Checks for an exact or required number of characters. | 012 345 678 |
01234567890 |
| Presence Check | Ensures a mandatory field is not left blank. | (empty field) |
AB1234567CD |
| Existence Check | Verifies if data actually exists in a stored database or file. | Plate A123 BCD |
File books_in_stock |
| Limit Check | Tests entry against a single boundary limit (upper or lower). | Earnings: -25 |
Earnings: 720 |
| Consistency Check | Checks if data across two or more fields logically matches. | Title: Mr / Sex: Female |
Title: Ms / Sex: Female |
| Uniqueness Check | Ensures an entered value is not already registered. | Existing Username | New Domain Name |
6.2 Data Verification Methods
Verification checks whether data has been accurately copied or transferred without corruption.
Verification During Data Entry
- Double Entry: Data is entered twice (often by different operators) and automatically compared.
- Visual Check: Manual comparison between entered screen data and the original physical source document.
- Check Digit: An extra calculated digit appended to identification numbers (e.g., ISBNs, barcodes) to catch entry errors.
Verification During Data Transfer
| Transfer Check | Operational Mechanism |
|---|---|
| Checksum | A value computed from a data block sent alongside the transmission. The recipient recalculates and compares it. |
| Parity Check | Appends a parity bit to bytes or blocks to ensure the total count of 1s is consistently even or odd. |
| ARQ Protocol | Uses positive acknowledgments and timeouts. Automatically requests retransmission if errors occur or timeouts expire. |
Chapter 6 Summary: Security, Privacy & Data Integrity
Key Takeaways
- Security vs. Privacy vs. Integrity: Security protects systems from unauthorized access/loss; Privacy enforces compliance with data protection laws; Integrity ensures data is accurate, consistent, and up-to-date.
- Security Threats: Includes viruses, worms, Trojans, spyware, phishing, and automated pharming attacks.
- Protective Measures: Mitigated via user access levels, strong passwords, firewalls, encryption, biometrics, and active anti-virus software.
- Data Loss Recovery: Mitigated through regular backups, UPS installations, parallel systems, and strict user training.
- Validation Checks: Computer-automated checks (range, format, length, presence, existence, limit, consistency, uniqueness) verifying if data is reasonable.
- Verification Checks: Data entry checks (double entry, visual check, check digits) and data transfer protocols (parity bits, checksums, ARQ) ensuring accurate transfer.
7.1 Legal, Moral, Ethical and Cultural Implications
Computer ethics is a set of principles used to regulate computing technologies, evaluating intellectual property rights, data privacy, and societal impacts.
Definitions of Conduct Domains
| Domain | Core Definition | Primary Context |
|---|---|---|
| Legal | Covered by formal laws; determines whether an action is punishable by law. | Judicial System & Legislation |
| Moral | Questions of right and wrong based on personal choices and individual beliefs. | Personal & Individual Choice |
| Ethical | Questions of right and wrong within a formal or professional context. | Professional Conduct & Industry Standards |
| Cultural | Attitudes, values, and practices shared by a society or specific group. | Societal & Regional Practices |
7.1.1 Computer Ethics Considerations
Computer ethics regulates three main factors:
- Intellectual Property Rights: Protecting creations such as preventing unauthorized software copying.
- Privacy Issues: Preventing hacking, keylogging, and unauthorized access to personal data.
- Effect on Society: Evaluating structural job losses, social dynamics, and digital divides.
Plagiarism: The act of taking another person's work or idea and claiming it as one's own, heavily amplified by internet accessibility.
7.1.2 Professional Ethical Bodies & Codes of Conduct
Joining professional organizations like the British Computer Society (BCS) and the Institute of Electrical and Electronics Engineers (IEEE) ensures accountability and upholds public trust.
BCS Code of Conduct (4 Core Pillars)
- The Public Interest: Prioritizing public safety, health, and privacy.
- Professional Competence and Integrity: Maintaining high technical standards and honesty.
- Duty to Relevant Authority: Acting responsibly toward employers and clients.
- Duty to the Profession: Upholding the reputation and integrity of the computing field.
IEEE Code of Ethics (Key Excerpts)
| Principle | Requirement Summary |
|---|---|
| Public Welfare | Hold paramount the safety, health, and welfare of the public and practice sustainable design. |
| Conflicts of Interest | Avoid real or perceived conflicts of interest and disclose them when present. |
| Honesty & Claims | Be honest and realistic in stating claims or estimates based on available data. |
| Bribery Rejection | Reject bribery in all its forms. |
| Competence & Quality | Maintain technical competence and undertake tasks only if qualified. |
| Fair Treatment | Treat all persons fairly, rejecting discrimination based on race, religion, gender, or age. |
Software Engineering Code of Ethics (8 Principles)
Jointly established by ACM and IEEE-CS: 1. Public, 2. Client and Employer, 3. Product, 4. Judgement, 5. Management, 6. Profession, 7. Colleagues, and 8. Self.
7.2 Copyright Issues & Software Protection
Software is protected by copyright legislation in the same manner as physical publications, videos, and music. Purchasing software grants a license to use it under specific conditions.
Illegal Actions Under Software Copyright Laws
- Making copies of software to sell or give away to third parties.
- Using single-user software across networks or multiple computers without a multi-use license.
- Incorporating copyrighted source code into personal projects and distributing or selling it without authorization.
- Renting out commercial software packages without permission.
- Using copyrighted software names or branding on third-party products without agreement.
7.2.2 Software Licensing Models
Software licensing dictates how source code can be accessed, copied, modified, and distributed.
Comparison of Licensing Types
| Licensing Type | Source Code Access | Cost | Modification & Distribution Rights |
|---|---|---|---|
| Commercial Software | Closed / Restricted | Paid Fee | No code access. Restricted to single-device or licensed multi-use installations. |
| Free Software / Open Source | Fully Accessible | Free | Includes the Four Freedoms: run, study/modify, redistribute copies, and distribute modified code. |
| Freeware | Closed Source | Free | Free to download and use, but protected by copyright. Code modification is prohibited. |
| Shareware | Closed Source | Free Trial (Fee later) | Provided free during a trial period, often with limited features until the full license fee is paid. |
The Four Freedoms of Free Software (FSF / OSI)
- Freedom 0: Run the program for any legal purpose.
- Freedom 1: Study the source code and modify it to suit personal needs.
- Freedom 2: Redistribute exact copies of the software to others.
- Freedom 3: Distribute modified versions of the code to others.
7.3 Artificial Intelligence (AI)
Artificial Intelligence refers to machines or applications designed to perform tasks that typically require human intelligence, such as natural language processing, mathematical analysis, facial recognition, machinery operation, and predictive analytics.
Asimov's Three Laws of Robotics
| Law | Directive |
|---|---|
| First Law | A robot may not injure a human being or, through inaction, allow a human being to come to harm. |
| Second Law | A robot must obey orders given to it by human beings, except where such orders conflict with the First Law. |
| Third Law | A robot must protect its own existence as long as such protection does not conflict with the First or Second Law. |
Impacts of AI Systems
- Transport & Automation: Autonomous driverless vehicles streamline taxi fleets and logistics, reducing human driver employment while increasing operational efficiency.
- Criminal Justice System: Facial recognition technologies replace traditional fingerprinting, and automated legal analytics assist in case processing.
Chapter 7 Summary: Ethics & Ownership
Key Takeaways
- Conduct Domains: Legal regulations govern laws; Morals deal with personal choices; Ethics govern professional standards; Culture covers societal values.
- Professional Bodies: Membership in organizations like BCS and IEEE enforces adherence to strict codes of conduct prioritizing public interest and technical integrity.
- Copyright Laws: Protect creators by penalizing software piracy, unauthorized copying, multi-device installation without licenses, and code theft.
- Licensing Models: Open Source allows full access to code and modifications; Commercial requires paid licensing; Freeware is free but closed-source; Shareware provides temporary trial access.
- Artificial Intelligence: Simulates human intelligence across task domains. AI deployment requires ethical guidelines, such as the Three Laws of Robotics, to balance technological advances with economic and social impacts.
11.01 Limitations of a File-Based Approach
A file-based approach relies on flat text files or custom file formats written for specific software applications. As organizations grow, storing and retrieving data using separate files leads to critical operational flaws.
1. Data Integrity Issues in a Single File
When data entry is uncontrolled, errors are easily introduced into individual files. Human mistakes (e.g., swapping first and family names) or omissions (e.g., leaving fields blank) cannot be easily detected without automated validation.
| Given Name | Family Name | Band Name | Integrity Issue Observed |
|---|---|---|---|
| Xiangfei | Jha | ComputerKidz | Valid entry |
| Dylan | Stoddart | [Blank] | Missing Band Name (Validation failure) |
| Vandana | Graham | ITWizz | Name order swapped upon initial entry |
| Graham | Vandana | ITWizz | Duplicate correct re-entry without deleting incorrect original |
| Precious | Olsen | ComputerKidz | Inconsistent entry (assigned to two different bands) |
2. Data Redundancy and Inconsistency Across Department Files
To preserve partial privacy, departments often create their own independent files holding overlapping information.
| Department | Stored Data Items |
|---|---|
| Contract | Member Names, Band Name, Gig Details |
| Finance | Bank Details, Member Names, Gig Details |
| Publicity | Band Name, Gig Details |
| Recruitment | Member Names, Band Name, Agent Details |
Consequence: If a band member updates their bank details, changing it in the Finance file but missing the Recruitment file creates Data Inconsistency.
3. Data Dependency and Security Concerns
- Data Dependency: Programmers write applications tailored to specific file layouts (e.g., assuming Band Name is strictly the 4th field on line 1). If the file layout changes to accommodate new data, every existing program must be re-written.
- Lack of Data Privacy: File systems lack granular access restrictions. Finance staff and recruitment staff both access whole files, preventing selective permissioning for sensitive fields like banking details.
File-Based vs. Relational Database Approach
| Feature / Limitation | File-Based Approach | Relational Database Approach |
|---|---|---|
| Data Redundancy | High. Data items are duplicated across separate application files, wasting storage . | Minimal/None. Data items are stored once in linked tables, eliminating waste . |
| Data Consistency | Poor. Data modified in one application may not update in another, causing inconsistency . | High. Data changes in one table are immediately visible across all applications . |
| Data Independence | Dependent. Enquiries rely heavily on specific data structures and software applications . | Independent. Data structure is decoupled from applications using the DBMS . |
11.02 The Relational Database
A relational database resolves file-based problems by organizing data into structured relational tables (relations) governed by explicit rules.
- Relation: A special mathematical table structure containing rows and columns.
- Attribute: A column in a relation representing a single property (e.g.,
BandName). - Tuple: A single row in a relation representing one unique record instance. Values within a tuple must be atomic (single-valued).
- Primary Key (PK): An attribute or minimal set of attributes that uniquely identifies each tuple in a relation. Represented as underlined in designs.
- Candidate Key: Any attribute/combination that could uniquely identify a tuple.
- Secondary Key: A candidate key not chosen as the primary key, often used for indexing.
- Foreign Key (FK): An attribute in one table that matches the primary key of another table, creating an explicit relational link.
- Referential Integrity: Rules enforced by the DBMS ensuring that foreign key values must strictly match an existing primary key value in the referenced table.
Logical View of Relational Tables
Member Table Schema: Member(MemberID, MemberGivenName, MemberFamilyName, BandName*)
| MemberID (PK) | MemberGivenName | MemberFamilyName | BandName (FK) |
|---|---|---|---|
| 0001 | Dylan | Stoddart | ComputerKidz |
| 0005 | Xiangfei | Jha | ComputerKidz |
| 0009 | Mahesh | Ravuru | ITWizz |
| 0025 | Vandana | Graham | ITWizz |
Band Table Schema: Band(BandName, AgentID)
| BandName (PK) | AgentID |
|---|---|
| ComputerKidz | 01 |
| ITWizz | 07 |
11.03 & 11.04 Entity-Relationship (E-R) Modelling
Entity-Relationship modelling is a top-down database design method used to represent real-world entities and the logical connections between them.
Steps to Create an E-R Diagram
- Identify Entities: Nouns in system requirements that have multiple instances (e.g.,
Booking,Band,Member,Venue). - Identify Relationships: Logically link entities (e.g., Band has Members, Booking is made at Venue).
- Determine Cardinalities: Specify 1:1, 1:M, M:1, or M:M bounds and participation constraints.
- Resolve M:M Relationships: Relational databases cannot directly execute Many-to-Many relationships. A Link Entity (Associative Table) must be created to split the M:M into two 1:M relationships.
Entity-Relationship (E-R) Cardinality Types
- One-to-One (1:1): Each record in Entity A relates to at most one record in Entity B .
- One-to-Many (1:M): Each record in Entity A relates to multiple records in Entity B .
- Many-to-One (M:1): Multiple records in Entity A relate to a single record in Entity B .
- Many-to-Many (M:N): Multiple records in Entity A relate to multiple records in Entity B (requires a junction table to resolve into two 1:M relationships) .
Interactive Canvas Diagram: Full Logical E-R Diagram
Logical Key Table Specification
| Table Name | Primary Key | Foreign Key(s) |
|---|---|---|
| Member | MemberID | BandName |
| Band | BandName | None |
| Band-Booking (Link) | BandName, BookingID (Compound Key) | BandName, BookingID |
| Booking | BookingID | VenueName |
| Venue | VenueName | None |
11.05 Database Normalisation
Normalisation is a systematic design technique that organizes attributes into tables to eliminate redundant data and prevent insertion, update, and deletion anomalies.
- Unnormalised Data (UNF): Contains repeating groups of attributes.
- First Normal Form (1NF): All repeating groups are removed into separate tables; all attributes are atomic.
- Second Normal Form (2NF): Must be in 1NF, and all non-key attributes must be fully functionally dependent on the entire primary key (removes partial dependencies).
- Third Normal Form (3NF): Must be in 2NF, and no non-key attribute can depend on another non-key attribute (removes transitive dependencies).
Normal Forms Overview
| Stage | Rule & Criteria | Resolution Strategy |
|---|---|---|
| First Normal Form (1NF) | Entities must not contain repeating groups of attributes or non-atomic values . | Separate repeating groups into new rows/tables with composite primary keys . |
| Second Normal Form (2NF) | Must be in 1NF and contain no partial dependencies (non-key attributes depend on the full primary key) . | Move fields dependent on only part of a composite key into dedicated tables . |
| Third Normal Form (3NF) | Must be in 2NF and contain no transitive dependencies (non-key attributes depend on other non-key attributes) . | Extract non-key attributes that determine other non-key attributes into separate tables . |
Normalisation Stage Breakdown Visualizer
Interactive Normalisation Pipeline Simulator
Select a stage below to see how raw booking form data is transformed to resolve data anomalies:
11.06 Database Management System (DBMS) Architecture
A DBMS is software that acts as an interface between users/applications and the underlying stored database.
ANSI-SPARC Three-Level Architecture
DBMS Core Features & DBA Functions
| Feature / Tool | Functionality |
|---|---|
| Data Dictionary | Hidden system catalog holding metadata: table layouts, data types, constraints, physical storage schemas, and user permissions. |
| Developer Interface | Graphical tools enabling system creators to build forms, define table structures, establish relationships, and design custom reports. |
| Query Processor | Executes, parses, and optimizes high-level query languages (SQL) into direct internal physical disk access commands. |
| Indexing | Small lookup secondary tables containing key values and memory pointers for rapid searching without scanning entire full tables. |
| Transaction Security & Recovery | Ensures operations execute completely or rollback automatically to maintain consistency during system failures; coordinates regular backups. |
Security & Management Features
- Access Control & Passwords: Restricts system access to authorized users via credentials .
- User Access Rights & Views: Defines read, write, append, or delete rights per user or group, presenting tailored logical schemas (views) .
- Backup Procedures & Audit Logs: Automated backup scheduling and continuous activity logs to trace modifications and maintain recovery paths .
- Data Encryption: Encodes stored and transmitted data to guard against interception .
DBMS Software Components
| Tool / Component | Functionality |
|---|---|
| Data Dictionary | A centralized repository storing metadata about database structures, table definitions, relationships, validation rules, and access permissions . |
| Developer Interface | Provides tools for developers to write direct SQL commands (DDL/DML) for advanced queries and structure creation . |
| Query Processor | Translates and executes SQL queries . Contains a DDL interpreter, DML compiler, and query evaluation engine that optimizes query performance . |
11.07 Structured Query Language (SQL)
SQL is the standard language used to define (DDL) and manipulate (DML) relational database structures.
Data Definition Language (DDL) Commands & Data Types
| DDL Command | Description | Data Types |
|---|---|---|
CREATE DATABASE db_name |
Creates a new database container . | CHARACTER (Fixed-length string) |
CREATE TABLE tbl (...) |
Defines a new table structure and attributes . | VARCHAR(n) (Variable string up to n) |
ALTER TABLE tbl ... |
Modifies existing table schema (e.g., adding keys) . | INTEGER, REAL (Numeric types) |
PRIMARY KEY (field) |
Designates the unique identifier attribute . | BOOLEAN (0 or 1 integer flag) |
FOREIGN KEY ... REFERENCES |
Establishes relational links between tables . | DATE (YYYY-MM-DD), TIME (HH:MM:SS) |
Data Manipulation Language (DML) Commands
SELECT ... FROM ... WHERE: Interrogates and filters table data .ORDER BY / GROUP BY: Sorts output ascending/descending or groups rows for aggregation .INNER JOIN ... ON: Combines related records across multiple tables based on key matching .SUM(), COUNT(), AVG(): Aggregate functions operating on targeted dataset columns .INSERT INTO / UPDATE / DELETE FROM: Adds, updates, or removes records within tables .
1. Data Definition Language (DDL)
DDL establishes or alters database structures.
-- Create Database
CREATE DATABASE BandBooking;
-- Create Tables
CREATE TABLE Band (
BandName VARCHAR(25),
NumberOfMembers INTEGER
);
CREATE TABLE Booking (
BookingID VARCHAR(8),
BookingDate DATE,
VenueName VARCHAR(25)
);
-- Primary and Foreign Key Constraints
ALTER TABLE Band ADD PRIMARY KEY (BandName);
ALTER TABLE Booking ADD PRIMARY KEY (BookingID);
ALTER TABLE Booking ADD FOREIGN KEY (VenueName) REFERENCES Venue(VenueName);
2. Data Manipulation Language (DML)
DML populates, alters, deletes, and retrieves operational record data.
-- Populate Data
INSERT INTO Band (BandName, NumberOfMembers) VALUES ('ComputerKidz', 5);
INSERT INTO Band (BandName, NumberOfMembers) VALUES ('ITWizz', 3);
-- Update Record
UPDATE Band SET NumberOfMembers = 6 WHERE BandName = 'ComputerKidz';
-- Delete Record (Observe foreign key dependency sequence)
DELETE FROM Band-Booking WHERE BandName = 'ITWizz';
DELETE FROM Band WHERE BandName = 'ITWizz';
-- Complex Multi-Table INNER JOIN Query
SELECT Booking.VenueName, Booking.BookingDate
FROM Booking
INNER JOIN Band-Booking ON Booking.BookingID = Band-Booking.BookingID
WHERE Band-Booking.BandName = 'ComputerKidz';
Interactive SQL Execution Engine
Test live SQL queries against the pre-populated Theatrical Agency database in real-time.
Query Execution Result
Chapter 11 Core Knowledge Summary
- Limitations of File-Based Systems: Characterized by severe data redundancy, risk of data inconsistency, tight program-data dependency, poor data security/privacy, and vulnerability to unvalidated entry errors.
- Relational Database Architecture: Eliminates redundancy by organizing data into linked relations (tables). Utilizes Primary Keys for unique identification and Foreign Keys to enforce referential integrity across entity connections.
- Entity-Relationship Modelling: Top-down conceptual design mapping entities and cardinalities (1:1, 1:M, M:M). Many-to-Many relationships require a Link Entity to form valid 1:M relations.
- Normalisation Pipeline:
- 1NF: Eliminates repeating groups; guarantees atomic fields and primary keys.
- 2NF: Meets 1NF + removes partial key dependencies.
- 3NF: Meets 2NF + removes transitive (non-key) dependencies. Every non-key attribute depends on "the key, the whole key, and nothing but the key".
- DBMS Infrastructure: Software suite managing user security access, query processing, data dictionaries, index optimization, and crash recovery mechanisms across the ANSI Three-Level architecture (External, Conceptual, Internal).
- SQL Operations: Data Definition Language (DDL) creates and modifies relational structures (`CREATE`, `ALTER`). Data Manipulation Language (DML) manages data entries (`INSERT`, `UPDATE`, `DELETE`, `SELECT` with `JOIN`).
9.1 Computational Thinking Skills
Computational thinking is a structured methodology for formulating and solving problems so that their solutions can be executed by computers or humans .
1. Abstraction
The process of extracting essential information while ignoring non-relevant details for a solution .
Key Benefits:- Reduces development time, allowing faster delivery .
- Programs occupy less memory and decrease download times .
- Tailors systems to user needs without extraneous complexity .
2. Decomposition
The process of breaking down a complex system into smaller, more manageable sub-systems . Each sub-system can then be developed, tested, and maintained independently .
3. Pattern Recognition
The identification of similar components or logic sequences across a problem that can utilize identical algorithmic solutions[cite: 5].
Airline Booking Abstraction Case Study
| Information Item | Essential | Not Essential |
|---|---|---|
| Departure time | ✔ | |
| Flight number | ✔ | |
| Departure airport | ✔ | |
| Aircraft type | ✔ | |
| Ticket price | ✔ | |
| Number of seats in aircraft | ✔ |
9.2 Methods of Finding the Solution
Structured English
Uses an agreed subset of straightforward English commands and mathematical terms to show logical steps without strict programming syntax[cite: 6].
Stepwise Refinement Example: Bubble Sort
Stepwise refinement breaks high-level algorithm descriptions down into actionable sub-steps:
1. Declare index variable as Integer to iterate through array.
2. Loop through the array from start to array length - 1.
3. Compare the current index value with the next index value.
4. If current value > next value, swap them using a Temp variable:
a. Temp <- Array[Index]
b. Array[Index] <- Array[Index + 1]
c. Array[Index + 1] <- Temp
5. Otherwise, move to the next index.
Flowcharts vs Pseudocode (Averaging Algorithm)
Below is a direct side-by-side logical comparison between flowcharts and pseudocode:
Flowchart Representation
Uses standard graphical symbols connected by flow lines to outline decision paths:
- Oval: Start / End
- Rectangle: Process (e.g.,
Total = 0) - Parallelogram: Input / Output (e.g.,
INPUT Number) - Diamond: Decision (e.g.,
Counter > Number?)
Pseudocode Equivalent
Total ← 0
OUTPUT "Enter number of values to average"
INPUT Number
FOR Counter ← 1 TO Number
OUTPUT "Enter value"
INPUT Value
Total ← Total + Value
NEXT Counter
Average ← Total / Number
OUTPUT "Average is ", Average
Pseudocode Syntax & Statements
1. Standard Pseudocode Operators
| Operator | Operation | Operator | Operation |
|---|---|---|---|
+ | Addition | ← | Assignment |
- | Subtraction | = | Equal to |
* | Multiplication | <> | Not equal to |
/ | Division | > / < | Greater / Less than |
& | String Concatenation | AND / OR / NOT | Logical Operations |
Selection Statements
// IF-ELSE Structure
IF Mark < 40 THEN
Grade ← "Fail"
ELSE IF Mark < 60 THEN
Grade ← "Pass"
ELSE
Grade ← "Merit"
ENDIF
// CASE Structure
CASE OF Direction
'N': Y ← Y + 1
'S': Y ← Y - 1
'E': X ← X + 1
'W': X ← X - 1
OTHERWISE OUTPUT "Error"
ENDCASE
Iteration Loops
// Count-Controlled (FOR Loop)
FOR Counter ← 1 TO 10
INPUT Number
Total ← Total + Number
NEXT Counter
// Post-Condition (REPEAT...UNTIL)
REPEAT
INPUT Number
UNTIL Number > 0
// Pre-Condition (WHILE...ENDWHILE)
WHILE Number >= 0 DO
INPUT Number
ENDWHILE
Interactive Algorithm Simulators
1. Variable Swap Trace Simulation
Trace how values migrate across registers via a temporary buffer:
// Pseudocode Variable Swap
DECLARE Val1, Val2, Temp : INTEGER
Temp ← Val1
Val1 ← Val2
Val2 ← Temp
2. Interactive Bubble Sort Visualizer
Observe array sorting mechanics aligned step-by-step with pseudocode execution:
FOR I ← 1 TO Length - 1
IF Array[I] > Array[I+1] THEN
Temp ← Array[I]
Array[I] ← Array[I+1]
Array[I+1] ← Temp
ENDIF
NEXT I
Chapter Summary
- Abstraction: Eliminates non-essential details to decrease development time, save memory, and simplify core system design .
- Decomposition: Subdivides complex systems into independent, manageable sub-components represented via structure diagrams .
- Structured English: A simplified, logical English format used to communicate steps clearly before coding[cite: 6].
- Pseudocode Fundamentals: Precise statements utilizing standard operators, explicit selection blocks (
IF-ELSE,CASE), and loops (FOR,REPEAT,WHILE). - Stepwise Refinement: The systematic process of refining high-level concepts into executable pseudocode algorithms.
Chapter 10 & 11: Data Types & Structures
Cambridge International AS & A Level Computer Science (9618)
10.1 Data Types and Records
In Computer Science, primitive data types are defined simply by commands built into the programming language. When variables of different data types form a logical group, a Record (user-defined/composite type) is used.
| Data Type | Description | Pseudocode Keyword |
|---|---|---|
| INTEGER | Signed whole number | INTEGER |
| REAL | Signed number with a decimal point | REAL |
| CHAR | Single alphanumerical character | CHAR |
| STRING | Sequence of zero or more characters | STRING |
| BOOLEAN | Logical values (TRUE / FALSE) | BOOLEAN |
| DATE | Calendar date (day, month, year) | DATE |
Record Structure Pseudocode
TYPE StockItem
DECLARE ProductCode : STRING
DECLARE Price : REAL
DECLARE NumberInStock : INTEGER
ENDTYPE
// Variable Declaration & Access
DECLARE Item1 : StockItem
Item1.ProductCode ← "BGR24-C"
Item1.Price ← 102.76
Item1.NumberInStock ← 15
10.2 Arrays & Data Searching/Sorting
An array is an ordered set of elements of the same data type identified by a single name. Elements are indexed continuously using upper and lower bounds.
1. 1D Array Pseudocode & Indexing
// 1D Array Declaration (1-based index from 1 to 5)
DECLARE Scores : ARRAY[1:5] OF INTEGER
// Assigning values via FOR loop
FOR i ← 1 TO 5
Scores[i] ← i * 10
NEXT i
2. 2D Array Pseudocode & Matrix Access
// 2D Array Declaration (3 Rows by 3 Columns)
DECLARE Grid : ARRAY[1:3, 1:3] OF INTEGER
// Nested FOR Loop Traversal
FOR Row ← 1 TO 3
FOR Col ← 1 TO 3
Grid[Row, Col] ← Row + Col
NEXT Col
NEXT Row
Interactive Simulation: 2D Array Matrix Grid
Select a Row and Column index to inspect direct element access in a 3x3 2D array.
Selected Cell: Grid[1, 1] = Value 11
3. Linear Search vs Bubble Sort
Interactive Simulation: Bubble Sort Visualizer
Status: Ready to sort.
Bubble Sort Pseudocode (Improved)
DECLARE myList : ARRAY[0:8] OF INTEGER
DECLARE top, index, temp : INTEGER
DECLARE swap : BOOLEAN
top ← 8
REPEAT
swap ← FALSE
FOR index ← 0 TO top - 1
IF myList[index] > myList[index + 1] THEN
temp ← myList[index]
myList[index] ← myList[index + 1]
myList[index + 1] ← temp
swap ← TRUE
ENDIF
NEXT index
top ← top - 1
UNTIL (NOT swap) OR (top = 0)
10.3 File Handling & Built-in String Operations
Files allow data to be stored permanently on secondary storage after program execution completes.
| Mode | Pseudocode Command | Description |
|---|---|---|
| READ | OPENFILE "file.txt" FOR READ | Opens existing file for reading lines. |
| WRITE | OPENFILE "file.txt" FOR WRITE | Creates a new file or overwrites contents. |
| APPEND | OPENFILE "file.txt" FOR APPEND | Adds data to the end of an existing file. |
Writing to a File:
OPENFILE "StudentData.txt" FOR WRITE
WRITEFILE "StudentData.txt", "Alice, 85"
CLOSEFILE "StudentData.txt"
Interactive Simulation: Virtual File Buffer
Status: Virtual File Ready.
Built-in String Operations Reference
| Function | Return Type | Description | Example |
|---|---|---|---|
LEFT(str, x) | STRING | Extracts leftmost x characters. | LEFT("Computer", 4) → "Comp" |
RIGHT(str, x) | STRING | Extracts rightmost x characters. | RIGHT("Science", 3) → "nce" |
MID(str, x, y) | STRING | Extracts y chars starting at index x. | MID("Cambridge", 4, 3) → "bri" |
LENGTH(str) | INTEGER | Returns total character count. | LENGTH("9618") → 4 |
UCASE(str) | STRING | Converts string to uppercase. | UCASE('b') → 'B' |
ASC(char) | INTEGER | Returns ASCII numerical code. | ASC('A') → 65 |
Interactive String Function Tester
Result: Output will appear here
Practice Questions
1. What value is returned by MID("COMPUTE", 3, 4)?
2. What is the value of CHR(ASC('A') + 3)?
3. Trace: RIGHT(LEFT("ALGORITHM", 5), 3)
10.4 Abstract Data Types (ADTs)
An Abstract Data Type is a collection of data and a set of operations on that data (e.g., Stack, Queue, Linked List).
1. LIFO Stack Operations
Stack Pointer (Top): -1 (Empty)
2. FIFO Queue Operations
Front Pointer: -1 | Rear Pointer: -1
3. Pointer-Based Linked List
Head Pointer: Null
Chapter Summary
- Primitive Data Types: INTEGER, REAL, CHAR, STRING, BOOLEAN, DATE.
- Records: Composite structures grouping multiple field types.
- Arrays: Static structures with bounds; searched via linear search and sorted via bubble sort.
- Files: Managed via READ, WRITE, or APPEND modes using EOF checks.
- ADTs: Stacks (LIFO), Queues (FIFO), and Linked Lists (Pointer-driven).
Chapter 12: Software Development
Cambridge International AS & A Level Computer Science (9618)
12.1 Program Development Life Cycle (PDLC)
Software requires structured development and ongoing adjustments throughout its active life to accommodate changing user requirements or to correct discovered faults[cite: 8]. The continuous progression of stages is termed a Life Cycle[cite: 8].
Interactive Stages Visualizer
Five Core Stages of PDLC
| Stage | Core Purpose & Description | Key Deliverables |
|---|---|---|
| Analysis | Investigation into user requirements leading to a complete specification of what the program must achieve[cite: 8]. | Requirements Specification, Data Flow Diagrams, System Constraints. |
| Design | Translates requirements into formal program specifications showing how the software will be built[cite: 8]. | Structure Charts, Algorithms/Pseudocode, State-Transition Diagrams, Flowcharts[cite: 8]. |
| Coding | Writing program code using a suitable high-level programming language based on the design specifications[cite: 8]. | Source Code, Module Documentation, Program Builds. |
| Testing | Executing software repeatedly using tailored sets of test data to verify correctness against design goals[cite: 8]. | Test Strategy, Test Plan, Bug Reports, Verification Logs. |
| Maintenance | Ongoing support to correct errors, adapt to changing systems, and enhance operational features[cite: 8]. | Patch Builds, Maintenance Logs, Upgraded Software Versions. |
12.2 Development Life Cycle Models
Depending on project scope, complexity, and stability of requirements, development teams choose different lifecycle methodologies[cite: 8].
1. The Waterfall Model
Linear, sequential flow where each phase completes before the next begins[cite: 8]. Feedback loops allow returning to previous stages if revisions are necessary[cite: 8].
2. The Iterative Model
Starts with a basic subset of requirements[cite: 8]. Successive iterations repeat review, design, and coding cycles to build up full functionality incrementally[cite: 8].
3. Rapid Application Development (RAD)
Emphasizes minimal upfront planning, extensive prototyping, automated code generation, and parallel development across skilled teams[cite: 8].
Methodology Comparison Matrix
| Model | Principles | Benefits | Drawbacks |
|---|---|---|---|
| Waterfall[cite: 8] | Linear & sequential; clear stage completion order; thorough documentation throughout[cite: 8]. | Simple to manage and understand[cite: 8]; distinct deliverables per stage[cite: 8]; ideal for stable requirements[cite: 8]. | Inflexible to changes late in development[cite: 8]; working software delivered late[cite: 8]; low initial customer involvement[cite: 8]. |
| Iterative[cite: 8] | Incremental development; partial software created early; repeated cycles expand requirements[cite: 8]. | Working versions produced quickly[cite: 8]; easier to debug smaller releases[cite: 8]; customer feedback occurs at each iteration[cite: 8]. | Whole architecture must be clear early[cite: 8]; complex overall project management required[cite: 8]; unsuited for tiny projects[cite: 8]. |
| RAD[cite: 8] | Minimal pre-planning; heavy prototype reliance; parallel module building; reusable code[cite: 8]. | Fast delivery speed[cite: 8]; highly flexible to evolving needs[cite: 8]; constant direct user evaluation[cite: 8]. | Requires modular architecture[cite: 8]; demands highly skilled teams[cite: 8]; inappropriate for simple low-budget projects[cite: 8]. |
12.3 Program Design & Diagramming Tools
1. Structure Charts
A structure chart models software by decomposing a system into modular sub-tasks[cite: 8]. It illustrates structural hierarchy and parameter passing (data coupons with open circles, control flags with filled circles)[cite: 8].
Worked Example: Car Rental System (RentCar)
Equivalent Module Pseudocode
FUNCTION RentCar(HireCost : REAL, PayMethod : STRING) RETURNS BOOLEAN
DECLARE Success : BOOLEAN
IF PayMethod = "CARD" THEN
Success ← PayByCard(HireCost)
ELSE
Success ← PayByAccount(HireCost, AccountNum, CurrBalance, AccLimit)
ENDIF
RETURN Success
ENDFUNCTION
2. Finite State Machines (FSM) & State-Transition Diagrams
State-transition diagrams map machines with fixed states, transitions between states via inputs, and optional output actions[cite: 8].
Interactive FSM State Machine Simulator
FSM Transition Logic Table
| Current State | Input Event | Output Action | Next State |
|---|---|---|---|
| S1 (START) | Input-A | Output-X | S2 |
| S1 (START) | Input-B | None | S4 |
| S2 | Input-A | None | S2 |
| S2 | Input-B | Output-W | S3 |
| S3 | Input-B | None | S3 |
| S3 | Input-A | Output-W | S4 |
| S4 | Input-A | None | S1 |
12.4 Program Testing & Maintenance
Types of Program Errors
Violations of language grammar rules detected during compilation/parsing (e.g., misspelled keywords, missing brackets).
Flaws in algorithm design causing incorrect results without crashing the application (e.g., using < instead of >)[cite: 8].
Errors occurring during execution causing program failure (e.g., division by zero, stack overflow, file not found)[cite: 8].
Interactive Test Data Classifier
Validation Rule under test: 12 <= Score <= 32[cite: 8]
Testing Methods & Stages
| Testing Method | Scope & Operational Mechanism |
|---|---|
| Dry Run / Walkthrough[cite: 8] | Manual paper-based trace of an algorithm's logic using trace tables prior to execution[cite: 8]. |
| White-Box Testing[cite: 8] | Internal structure/code analysis; tests every internal path and logic branch[cite: 8]. |
| Black-Box Testing[cite: 8] | Functional testing checking inputs against outputs without examining code internal logic[cite: 8]. |
| Integration & Stub Testing[cite: 8] | Combining separately developed modules[cite: 8]. Stubs act as dummy modules replacing unwritten functions[cite: 8]. |
| Alpha / Beta / Acceptance[cite: 8] | Alpha: In-house testing[cite: 8]. Beta: Early user testing[cite: 8]. Acceptance: Final customer sign-off[cite: 8]. |
Maintenance Categories
Fixing bugs and run-time errors discovered during operational use (e.g., patching unexpected unhandled exceptions)[cite: 8].
Enhancing performance, optimizing execution speed, or improving code organization without altering requirements[cite: 8].
Modifying software to work under new environments, operating systems, hardware setups, or new user requirements[cite: 8].
Chapter 12 Summary & Key Takeaways
- PDLC Stages: Encompasses Analysis, Design, Coding, Testing, and Maintenance[cite: 8].
- Lifecycle Models: Waterfall (linear, structured)[cite: 8], Iterative (incremental releases)[cite: 8], and RAD (rapid prototyping, parallel teams)[cite: 8].
- Design Tools: Structure Charts decompose problems into sub-task hierarchies with parameter passing[cite: 8]. State-Transition Diagrams model Finite State Machines using states and inputs[cite: 8].
- Testing Strategies: Utilizes Normal, Extreme, Boundary, and Abnormal test sets[cite: 8]. Testing techniques include White-box, Black-box, Integration, Alpha, Beta, and Acceptance[cite: 8].
- Maintenance: Categorized into Corrective (bug fixing), Perfective (performance optimization), and Adaptive (environment changes)[cite: 8].