Comprehensive Senior School Computer Science Study Notes

Essence and Framework of the Computer Science Curriculum

The Computer Science curriculum at Senior School is designed to equip learners with competencies, skills, and attitudes regarding computing principles, concepts, and techniques. It targets the design, implementation, and management of computing systems to provide social, economic, industrial, and technological solutions.

  • Foundational Pillars: The curriculum is anchored on:

    • National Goals of Education No. 2: Focuses on skills and attitudes for industrial development.
    • Kenya Vision 2030: Aims to make education responsive to emerging needs.
    • Sessional Paper No 1 of 2019: Recommends the promotion of Technical and Vocational Education with an emphasis on Science, Technology, and Innovation (ST&I).
    • Africa Agenda 2063 (Second Pillar).
    • National ICT Policy of Kenya 2016 (revised 2020): Emphasizes ICT as a foundation for a robust economy.
  • General Subject Learning Outcomes:

    • Apply computer science knowledge to daily activities.
    • Practice ethical and safe use of technology.
    • Develop applications for real-world problem-solving.
    • Configure and manage computer networks.
    • Initiate career and entrepreneurship opportunities in the field.
    • Adapt to the dynamic digital world.

Evolution and Early Computing Devices

Early computing tools introduced fundamental computational concepts that paved the way for modern electronic machines.

  • Abacus (Around 2400 BC): A manual calculating tool consisting of beads on rods representing place values. It introduced the concept of representing numbers physically and data processing through manipulation.
  • Napier's Bones (Early 17th Century): A set of numbered rods for multiplication and division. It demonstrated the use of pre-calculated information and structured tools to simplify complex math.
  • Pascaline (1642): Invented by Blaise Pascal, it was the first mechanical calculator capable of addition and subtraction using gears and dials.
  • Slide Rule (Around 1620): An analog computer using two sliding logarithmic scales for multiplication, division, roots, logarithms, and trigonometry.
  • Difference Engine (Early 19th Century): Designed by Charles Babbage to calculate polynomial functions automatically to eliminate manual errors. It featured mechanical memory and autonomous task execution.
  • Analytic Engine (Mid-19th Century): A general-purpose mechanical computer design by Charles Babbage. It included modern concepts: an arithmetic unit ("mill"), control unit, memory ("store"), and input/output via punched cards. Ada Lovelace is credited as the first programmer for this engine.
  • Jacquard Loom (Early 19th Century): A mechanical loom using punched cards to automate textile patterns. This introduced the concept of programmable instructions and data storage via punched cards.

Principle Technologies and Computer Generations

The history of computing is categorized by the dominant electronic technologies used.

  • Vacuum Tubes: Early electronic switches/amplifiers. Facilitated the first generation but were large, power-hungry, and unreliable.
  • Transistors: Replaced vacuum tubes. Smaller, faster, more reliable, and more energy-efficient. Ushered in the second generation.
  • Integrated Circuits (SSI/MSI): Single chips containing multiple components. Reduced size and cost while increasing efficiency.
  • VLSI (Very Large Scale Integration): Allows millions of transistors on one chip, leading to microprocessors (CPU on a single chip).

Generation Summary Table:

  • First (1940s - 1950s): Vacuum Tubes. Characteristics: Large, hot, slow, unreliable. Examples: ENIAC, UNIVAC I.
  • Second (1950s - 1960s): Transistors. Characteristics: Smaller, faster, more reliable. Examples: IBM 1401, PDP-1.
  • Third (1960s - 1970s): ICs (SSI/MSI). Characteristics: Efficient, cost-effective. Examples: IBM System/360, DEC PDP-8.
  • Fourth (1970s - Present): LSI & VLSI. Characteristics: Microprocessors, high power, low cost. Examples: Apple Macintosh, IBM PC, Laptops.
  • Fifth (Present - Beyond): AI, Parallel Processing, Quantum Computing. Characteristics: Natural language understanding, advanced AI. Examples: Supercomputers, AI systems.

Von Neumann Architecture and Data Representation

The von Neumann architecture (1945) is the foundation of most modern computers.

  • Five Functional Units:
    1. Input Unit: Feeds data/instructions (e.g., keyboard, scanner).
    2. Central Processing Unit (CPU): Contains the Arithmetic Logic Unit (ALU) for calculations and the Control Unit (CU) for coordination.
    3. Memory Unit: Uses a single address space for both data and instructions. Includes RAM (volatile/temporary) and Secondary Storage (non-volatile/long-term).
    4. Output Unit: Presents processed info (e.g., monitor, printer).
    5. Buses: Electrical conductors for transmission.
      • Data Bus: Carries actual data.
      • Address Bus: Carries memory addresses from CPU to memory.
      • Control Bus: Carries control signals from the CU.

Data Representation (Number Systems):

  • Binary (Base-2): Digits 00 and 11. Fundamental language of electronic states.
    • Example: 131013_{10} to binary. 13/2=613 / 2 = 6 rem 11; 6/2=36 / 2 = 3 rem 00; 3/2=13 / 2 = 1 rem 11; 1/2=01 / 2 = 0 rem 11. Result: 110121101_{2}.
  • Octal (Base-8): Digits 00-77. Shorthand for binary (1 octal digit = 3 binary bits).
  • Hexadecimal (Base-16): Symbols 00-99 and AA-FF (A=10A=10, F=15F=15). Used for memory addresses.
    • Example: 421042_{10} to hex. 42/16=242 / 16 = 2 rem 1010 (AA). Result: 2A162A_{16}.

Input and Output (I/O) Devices

  • Input Devices:

    • Keying: Keyboard, Numeric Keypad.
    • Pointing: Mouse, Trackball, Touchpad, Joystick, Light Pen.
    • Scanning: Flatbed Scanner, Barcode Reader, QR Code Reader, 3D Scanner.
    • Voice: Microphone (converts sound to electrical signals).
    • Touch Screens:
      • Resistive: Pressure-based, conductive layers touch.
      • Capacitive: Disrupts electrical field (supports multi-touch).
      • Infrared: Beams around edges; touch interrupts beams.
    • Others: Digitizer (Graphics Tablet), Digital Cameras.
  • Output Devices:

    • Monitors: CRT (bulky/older), LCD (liquid crystals), LED (LED backlighting).
    • Printers:
      • Inkjet: Sprays ink droplets; good for color.
      • Laser: Uses laser/electrostatic drum/toner; cost-effective for volume.
      • Dot Matrix: Pins strike ribbon; noisy; used for multi-part forms.
    • Production/Multimedia: Speakers, Projectors, Plotters (large-format graphics like blueprints), Actuators (produce physical movement like motors or robotic arms).

Computer Storage and Memory

  • Primary Storage (Main Memory): Directly accessible by CPU, volatile (loses data on power loss).

    • RAM (Random Access Memory):
      • DRAM (Dynamic): Uses 1 transistor + 1 capacitor per bit. Needs periodic refreshing. Higher density, cheaper.
      • SRAM (Static): Uses 6 transistors forming a flip-flop. No refreshing needed. Faster, used for CPU cache.
    • ROM (Read-Only Memory): Permanent storage (Non-volatile).
      • PROM: Programmable once.
      • EPROM: Erasable by UV light.
      • EEPROM: Electrically erasable (Flash memory is a type).
  • Secondary Storage (Auxiliary): Non-volatile, long-term.

    • Magnetic: HDD (Hard Disk Drive) - uses magnetic platters.
    • Solid State: SSD, USB Flash, Memory cards - use chips, no moving parts, faster, more durable.
    • Optical: CD, DVD, Blu-ray - use lasers to read/write.
  • Remote Storage (Cloud): Storing data on network servers (e.g., Google Drive, Dropbox). Benefits include accessibility, automatic synchronization, and redundancy. Risks include dependency on internet and privacy concerns.

Central Processing Unit (CPU) Detail

The CPU is the "brain" of the computer.

  • Structural Elements:

    • ALU: Performs computations (+, -, *, /) and logic (AND, OR).
    • Control Unit (CU): Fetches and decodes instructions.
    • Registers: High-speed storage.
      • Program Counter (PC): Next instruction address.
      • Instruction Register (IR): Current instruction being decoded.
      • Memory Address Register (MAR): Target memory location.
      • Memory Data Register (MDR): Data being moved to/from memory.
      • Accumulator: Intermediate calculation results.
  • The Fetch-Decode-Execute Cycle:

    1. Fetch: CU gets instruction from memory (address in PC) into IR. PC increments.
    2. Decode: CU interprets the instruction.
    3. Execute: CU sends signals to ALU or other parts to perform the operation.
  • CPU Architectures:

    • RISC (Reduced Instruction Set Computer): Simple, one-cycle instructions (e.g., ARM).
    • CISC (Complex Instruction Set Computer): Large, complex instruction sets (e.g., Intel x86).
    • Cores: Independent processing units. Multi-core (Dual, Quad, Octa-core) allows parallel processing.

Operating Systems (OS)

System software that acts as an intermediary between user and hardware.

  • Key Functions: Booting (loading the kernel), Resource management (CPU/memory), User Interface (GUI or CLI), File management, Process management.
  • Classifications:
    • By Task: Single-tasking vs. Multi-tasking.
    • By User: Single-user vs. Multi-user (e.g., UNIX, Windows Server).
    • By Interface: GUI (icons), CLI (commands), Menu-driven.
  • Communication:
    • Device Drivers: Translators between OS and specific hardware.
    • System Calls: Requests from user programs to the OS kernel for privileged operations.

Data Communication and Networking

  • Signals:

    • Analog: Continuous waves.
    • Digital: Discrete high/low levels (11s and 00s).
  • Network Categories:

    • PAN: Personal Area Network (Bluetooth range).
    • LAN/WLAN: Local Area Network (office/home).
    • MAN: Metropolitan (city-wide).
    • WAN: Wide Area (global/Internet).
  • Data Flow Modes:

    • Simplex: One way only (Radio).
    • Half-Duplex: Two-way, but one at a time (Walkie-talkie).
    • Full-Duplex: Two-way simultaneously (Internet, Telephone).
  • Network Elements:

    • DTE (Data Terminal Equipment): Source/Sink (Computer).
    • DCE (Data Circuit-terminating Equipment): Interface (Modem, NIC).
    • Devices: Hub (broadcasts to all), Switch (forwards to specific port), Router (connects networks), Gateway (connects networks with different protocols), Repeater (amplifies signal).
  • Transmission Media:

    • Guided: Twisted pair (UTP/STP), Coaxial, Fiber Optic (light pulses).
    • Unguided: Radio waves (3 kHz3\,kHz to 300 GHz300\,GHz), Microwaves (1 GHz1\,GHz to 300 GHz300\,GHz), Infrared.

Network Topologies

  • Physical Topology: The actual layout (Star, Bus, Ring, Mesh, Tree, Hybrid).
    • Bus: All share one cable. Single point of failure.
    • Star: All connect to a central hub/switch. Very common in LANs.
    • Mesh: Every device connects to every other. High redundancy.
  • Logical Topology: How data flows (Broadcast, Token Passing, Point-to-Point, Client-Server).

Software Development and Programming

  • Evolution of Languages:

    • 1st Gen: Machine Language (binary).
    • 2nd Gen: Assembly (mnemonics like ADD).
    • 3rd Gen: High-level (FORTRAN, C, Java, Python).
    • 4th Gen: Very high-level (SQL, scripts).
    • 5th Gen: AI/Logic (Prolog, Lisp).
  • Translators:

    • Assembler: Assembly to Machine Code.
    • Compiler: Translates entire source code into executable file.
    • Interpreter: Translates and executes line-by-line.
  • Program Development Cycle (PDC): Problem Definition β†’ Design β†’ Coding β†’ Testing β†’ Implementation β†’ Documentation β†’ Maintenance.

  • Algorithms:

    • Pseudocode: Human-readable instruction structure (using START, IF, WHILE).
    • Flowcharts: Visual diagrams (Oval=Start/End, Rectangle=Process, Parallelogram=Input/Output, Diamond=Decision).
  • Data Structures (Containers):

    • Lists: Ordered, mutable.
    • Tuples: Ordered, immutable.
    • Dictionaries: Key-value pairs.
    • Sets: Unordered, unique elements.
  • Sorting/Searching:

    • Searching: Sequential (linear) vs. Binary (on sorted data).
    • Sorting: Insertion Sort, Selection Sort, Bubble Sort, Quick Sort (divide-and-conquer).

Programming Syntax and Logic

  • Control Structures:

    • Sequential: Top-to-bottom.
    • Selection: Decisions (if, elif, else).
    • Iteration: Loops (for, while).
    • Flow control: break (exit loop), continue (skip iteration).
  • Operators:

    • Arithmetic: +, -, *, /, // (floor), % (mod), ** (exponent).
    • Relational: ==, !=, >, <.
    • Logical: and, or, not.
  • Functions:

    • Types: Built-in (e.g., print()) and User-defined.
    • Scope: Local (inside function) and Global (outside function).
    • Parameters: Formal (placeholders) and Actual (arguments passed).