Computer science

N umber Systems

  • The Binary Architecture of Modern Computing:

    • Data in computer systems must be converted into binary format to be stored and processed.

    • The fundamental hardware unit is an electronic circuit composed of millions of microscopic transistors acting as physical switches.

    • A switch in the ON\text{ON} state conducts electrical current, represented logically by the binary digit 11.

    • A switch in the OFF\text{OFF} state prevents conduction, represented logically by the binary digit 00.

  • Positional Number Systems:

    • Denary (Base 10):

    • Uses ten distinct positional digits: 0,1,2,3,4,5,6,7,8,90, 1, 2, 3, 4, 5, 6, 7, 8, 9.

    • Column positional values correspond to successive integer powers of ten: 100=110^0 = 1, 101=1010^1 = 10, 102=10010^2 = 100, 103=100010^3 = 1000, 104=1000010^4 = 10000, etc.

    • Example evaluation: the denary number 2517725177 evaluates to:       (2×104)+(5×103)+(1×102)+(7×101)+(7×100)=20000+5000+100+70+7=25177(2 \times 10^4) + (5 \times 10^3) + (1 \times 10^2) + (7 \times 10^1) + (7 \times 10^0) = 20000 + 5000 + 100 + 70 + 7 = 25177

    • Binary (Base 2):

    • Uses two distinct positional digits: 00 and 11.

    • Column positional values correspond to successive integer powers of two: 20=12^0 = 1, 21=22^1 = 2, 22=42^2 = 4, 23=82^3 = 8, 24=162^4 = 16, 25=322^5 = 32, 26=642^6 = 64, 27=1282^7 = 128, etc.

    • Example evaluation: the 8-bit binary number 11101110211101110_2 evaluates in denary to:       (1×128)+(1×64)+(1×32)+(0×16)+(1×8)+(1×4)+(1×2)+(0×1)=128+64+32+8+4+2=23810(1 \times 128) + (1 \times 64) + (1 \times 32) + (0 \times 16) + (1 \times 8) + (1 \times 4) + (1 \times 2) + (0 \times 1) = 128 + 64 + 32 + 8 + 4 + 2 = 238_{10}

    • Hexadecimal (Base 16):

    • Uses sixteen distinct positional symbols: digits 00 through 99 represent numeric values 00 to 99, while letters A,B,C,D,E,FA, B, C, D, E, F represent values 10,11,12,13,14,1510, 11, 12, 13, 14, 15 respectively.

    • Positional column weightings correspond to powers of sixteen: 160=116^0 = 1, 161=1616^1 = 16, 162=25616^2 = 256, 163=409616^3 = 4096, 164=6553616^4 = 65536, etc.

    • Since 16=2416 = 2^4, a single hexadecimal digit corresponds precisely to a unique grouping of four binary digits (a nibble).

  • Conversion Methodologies:

    • Binary to Denary Conversion:

    • Multiply each binary bit by its respective column weight (2n2^n) and sum the products.

    • Example (12-bit): 0111100010112=1024+512+256+128+8+2+1=193110011110001011_2 = 1024 + 512 + 256 + 128 + 8 + 2 + 1 = 1931_{10}.

    • Example (16-bit): 00110001111001102=8192+4096+256+128+64+32+4+2=12774100011000111100110_2 = 8192 + 4096 + 256 + 128 + 64 + 32 + 4 + 2 = 12774_{10}.

    • Denary to Binary Conversion:

    • Method 1 (Subtraction of Highest Powers of 2):

      • Progressively subtract the largest possible power of two from the remaining value until zero is reached, setting bits to 11 for successful subtractions and 00 otherwise.

      • Example: Convert 14210142_{10}:

      • 142−128=14142 - 128 = 14 (bit 7 = 1)

      • 14<6414 < 64 (bit 6 = 0)

      • 14<3214 < 32 (bit 5 = 0)

      • 14<1614 < 16 (bit 4 = 0)

      • 14−8=614 - 8 = 6 (bit 3 = 1)

      • 6−4=26 - 4 = 2 (bit 2 = 1)

      • 2−2=02 - 2 = 0 (bit 1 = 1)

      • Remaining is 0 (bit 0 = 0)

      • Result: 10001110210001110_2.

    • Method 2 (Successive Division by 2):

      • Divide the denary integer successively by 22, recording each remainder (00 or 11).

      • Continue until the quotient becomes 00.

      • Read remainders from bottom to top (most recent remainder is the Most Significant Bit, MSB).

      • Example: Convert 591059_{10}:

      • 59÷2=29 remainder 159 \div 2 = 29\text{ remainder } 1

      • 29÷2=14 remainder 129 \div 2 = 14\text{ remainder } 1

      • 14÷2=7 remainder 014 \div 2 = 7\text{ remainder } 0

      • 7÷2=3 remainder 17 \div 2 = 3\text{ remainder } 1

      • 3÷2=1 remainder 13 \div 2 = 1\text{ remainder } 1

      • 1÷2=0 remainder 11 \div 2 = 0\text{ remainder } 1

      • Reversing remainders yields 1110112111011_2, padded to 8 bits: 00111011200111011_2.

    • Binary to Hexadecimal Conversion:

    • Divide the binary string into groups of four bits (nibbles) from right to left.

    • Pad the leftmost nibble with leading zeros if it contains fewer than four bits.

    • Map each 4-bit nibble to its hexadecimal equivalent.

    • Example: 1011111000012→1011 (B),1110 (E),0001 (1)=BE116101111100001_2 \rightarrow 1011\ (B), 1110\ (E), 0001\ (1) = \text{BE1}_{16}.

    • Example: 100001111111012→0010 (2),0001 (1),1111 (F),1101 (D)=21FD1610000111111101_2 \rightarrow 0010\ (2), 0001\ (1), 1111\ (F), 1101\ (D) = 21\text{FD}_{16}.

    • Hexadecimal to Binary Conversion:

    • Convert each individual hexadecimal digit directly into its 4-bit binary equivalent.

    • Example: 45A16=0100 0101 1010245\text{A}_{16} = 0100\ 0101\ 1010_2.

    • Example: {\text{BF08}}{16} = 1011\ 1111\ 0000\ 1000_2.\n * **Hexadecimal to Denary Conversion:**\n * Multiply each hexadecimal symbol by its positional weighting (16^n) and sum the values.\n * Example: 45\text{A}{16} = (4 \times 256) + (5 \times 16) + (10 \times 1) = 1024 + 80 + 10 = 1114_{10}.\n * Example: {\text{C8F}}_{16} = (12 \times 256) + (8 \times 16) + (15 \times 1) = 3072 + 128 + 15 = 3215_{10}.

    • Denary to Hexadecimal Conversion:

    • Divide the denary integer successively by 1616, logging remainders until quotient is 00.

    • Read remainders from bottom to top, converting remainders 10 to 1510\text{ to }15 to letters A to FA\text{ to }F.

    • Example: Convert 2004102004_{10}:

      • 2004÷16=125 remainder 42004 \div 16 = 125\text{ remainder } 4

      • 125÷16=7 remainder 13 (D)125 \div 16 = 7\text{ remainder } 13\ (D)

      • 7÷16=0 remainder 77 \div 16 = 0\text{ remainder } 7

      • Reading remainders bottom-to-top yields 7D4167\text{D}4_{16}.

  • Practical Applications of Hexadecimal in Computer Science:

    • Error Codes:

    • Hexadecimal represents memory addresses where software errors, hardware faults, or exceptions occur.

    • Automatically generated by operating systems to inform system developers of low-level memory states without handling unwieldy binary strings.

Hexadecimal Error Codes
  • Media Access Control (MAC) Addresses:

    • A unique 48-bit hardware identifier permanently assigned to a Network Interface Card (NIC).

    • Represented as six groups of two hexadecimal digits: NN-NN-NN-DD-DD-DD\text{NN-NN-NN-DD-DD-DD} or NN:NN:NN:DD:DD:DD\text{NN:NN:NN:DD:DD:DD}.

    • First three pairs (NN-NN-NN\text{NN-NN-NN}) represent the manufacturer identification code (e.g., 00-1C-B300\text{-}1\text{C-B}3 for Apple, 00-14-2200\text{-}14\text{-}22 for Dell, 00-40-9600\text{-}40\text{-}96 for Cisco, 00-A0-C900\text{-A}0\text{-C}9 for Intel).

    • Final three pairs (DD-DD-DD\text{DD-DD-DD}) represent the unique device serial number.

  • Internet Protocol (IP) Addresses (IPv6):

    • IPv6 addresses resolve address exhaustion in 32-bit IPv4 networks by utilizing 128-bit addresses structured into eight 16-bit blocks delimited by colons, each represented by four hexadecimal digits.

    • Example: a8fb:7a88:fff0:0fff:3d21:2085:66fb:f0fa\text{a8fb:7a88:fff0:0fff:3d21:2085:66fb:f0fa}.

  • HyperText Markup Language (HTML) Colour Codes:

    • Represents onscreen RGB (Red, Green, Blue) colour intensity.

    • Formatted as a leading hash sign followed by six hexadecimal digits: #RRGGBB\#\text{RRGGBB}.

    • Each component has an 8-bit range (0016 to FF1600_{16} \text{ to } \text{FF}_{16}, corresponding to 0 to 255100 \text{ to } 255_{10}), producing 256×256×256=16,777,216256 \times 256 \times 256 = 16,777,216 total possible chromatic combinations.

    • Examples: #FF0000\#\text{FF0000} (Pure Red), #00FF00\#\text{00FF00} (Pure Green), #0000FF\#\text{0000FF} (Pure Blue), #FF00FF\#\text{FF00FF} (Fuchsia), #FF8000\#\text{FF8000} (Orange), #B18904\#\text{B18904} (Tan), #FF9966\#\text{FF9966} (Salmon Pink).

HTML Hex Colour Selection
  • Binary Addition and Arithmetic Mechanics:

    • Rules of Binary Addition:

    • 0+0=0 (carry 0, sum 0)0 + 0 = 0\text{ (carry } 0, \text{ sum } 0)

    • 0+1=1 (carry 0, sum 1)0 + 1 = 1\text{ (carry } 0, \text{ sum } 1)

    • 1+0=1 (carry 0, sum 1)1 + 0 = 1\text{ (carry } 0, \text{ sum } 1)

    • 1+1=102 (carry 1, sum 0)1 + 1 = 10_2\text{ (carry } 1, \text{ sum } 0)

    • Three-bit additions (accounting for incoming carry):

      • 0+0+0=0 (carry 0, sum 0)0 + 0 + 0 = 0\text{ (carry } 0, \text{ sum } 0)

      • 0+0+1=1 (carry 0, sum 1)0 + 0 + 1 = 1\text{ (carry } 0, \text{ sum } 1)

      • 0+1+1=102 (carry 1, sum 0)0 + 1 + 1 = 10_2\text{ (carry } 1, \text{ sum } 0)

      • 1+1+1=112 (carry 1, sum 1)1 + 1 + 1 = 11_2\text{ (carry } 1, \text{ sum } 1)

    • Overflow Conditions:

    • Occurs when the mathematical sum of two binary numbers exceeds the maximum value representable by the allocated register width.

    • For an 8-bit unsigned register, the maximum capacity is 28−1=255102^8 - 1 = 255_{10}.

    • Example: Summing 011011102 (11010)+110111102 (22210)01101110_2\ (110_{10}) + 11011110_2\ (222_{10}) generates a 9th carry bit (1 0100110021\ 01001100_2). If confined to an 8-bit register, the resulting stored value is 010011002 (7610)01001100_2\ (76_{10}), causing an overflow error.

  • Logical Binary Shifts:

    • Logical Left Shift:

    • Moves every bit in a register to the left by nn positions, filling the vacant low-order positions on the right with zeros.

    • Shifting left by 11 position multiplies the value by 212^1; shifting left by nn positions multiplies the value by 2n2^n.

    • If a 11 is shifted out of the Most Significant Bit (MSB), an overflow/data loss error occurs.

    • Logical Right Shift:

    • Moves every bit in a register to the right by nn positions, filling vacant high-order positions on the left with zeros.

    • Shifting right by 11 position performs integer division by 212^1; shifting right by nn positions divides the value by 2n2^n.

    • If a 11 is shifted out of the Least Significant Bit (LSB), data loss occurs and precision is lost.

  • Two's Complement Notation:

    • Used to represent signed integers (both positive and negative) in binary.

    • For an 8-bit signed register, the MSB is assigned a negative weighting of −128-128 (−27-2^7), with remaining column weights retaining positive values (64,32,16,8,4,2,164, 32, 16, 8, 4, 2, 1).

    • Represents a numeric dynamic range of −128-128 to +127+127.

    • If the MSB is 00, the number is positive. If the MSB is 11, the number is negative.

    • Algorithm to Convert a Negative Denary Number to Two's Complement:

    • Write the positive absolute value in binary.

    • Invert all bits (perform bitwise NOT\text{NOT}, swapping 00s and 11s).

    • Add 11 to the least significant bit (ignoring any final carry-out).

    • Example: Convert −7910-79_{10}:

      • +7910=010011112+79_{10} = 01001111_2

      • Invert bits: 10110000210110000_2

      • Add 11: 10110001210110001_2

      • Check: −128+32+16+1=−7910-128 + 32 + 16 + 1 = -79_{10}.

Data Representation: Text, Sound, and Images

  • Character Sets: ASCII and Unicode:

    • A character set is a defined list of characters recognized by computer hardware and software, where each character maps to a unique binary integer.

    • Standard ASCII (American Standard Code for Information Interchange):

    • Established in 19631963 and revised in 19861986.

    • Uses a 7-bit encoding format (0 to 127100\text{ to }127_{10} or 0016 to 7F1600_{16}\text{ to }7\text{F}_{16}), accommodating standard keyboard letters, numbers, punctuation, and 3232 control codes (denary 0 to 310\text{ to }31).

    • Character codes are sequential (e.g., A=6510/4116A = 65_{10} / 41_{16}, B=6610B = 66_{10}; a=9710/6116a = 97_{10} / 61_{16}, b=9810b = 98_{10}).

    • Uppercase and lowercase alphabetic counterparts differ strictly at bit position 6 (denary 32): uppercase has bit 6 as 00, while lowercase has bit 6 as 11.

    • Extended ASCII:

    • Uses an 8-bit encoding format (0 to 255100\text{ to }255_{10} or 0016 to FF1600_{16}\text{ to }\text{FF}_{16}), providing an additional 128128 characters for accented letters, graphical box-drawing elements, and non-English symbols.

Extended ASCII Code Table
  • Unicode:

    • Developed by the Unicode Consortium in 19911991 (Version 1.0) to overcome ASCII's limitation of being unable to represent non-Western scripts (such as Chinese, Japanese, Russian, Romanian, and Arabic).

    • Five Core Design Goals:

      • Create a universal standard covering all written global languages.

      • Produce a more efficient coding architecture than fragmented legacy systems.

      • Adopt uniform encoding where each character is encoded as a 16-bit or 32-bit value.

      • Create unambiguous encoding where each code point maps uniquely to an exact character.

      • Reserve dedicated private-use spaces for specialized user-defined symbols and custom scripts.

    • Up to 4 bytes per character can be utilized, maintaining backwards compatibility with standard ASCII across its first 128128 characters.

Sample Unicode Characters
  • Digital Representation of Sound:

    • Sound waves are continuous physical analogue vibrations characterized by frequency, wavelength, and amplitude (loudness).

    • Computers cannot process analogue waves directly; continuous waves must be captured via an Analogue-to-Digital Converter (ADC) using discrete regular sampling.

    • Sampling Rate:

    • The number of discrete audio samples recorded per second, measured in Hertz (Hz\text{Hz}).

    • Standard audio Compact Discs (CDs) record at 44,100 Hz44,100\text{ Hz} (44.1 kHz44.1\text{ kHz}), collecting 44,10044,100 discrete amplitude snapshots every second.

    • Sampling Resolution (Bit Depth):

    • The number of bits allocated to encode the measured amplitude value of each sample.

    • Higher sampling resolutions increase the dynamic range and fidelity of the recording while reducing quantization distortion.

    • Trade-off: Higher sampling rates and sampling resolutions increase file size, download latency, and hardware processing demands.

  • Digital Representation of Bitmap Images:

    • A bitmap image is constructed from a two-dimensional grid of individual picture elements known as pixels.

    • Each pixel stores a digital value that dictates its chromatic and luminance properties.

    • Colour Depth:

    • The number of bits allocated to represent the colour of each individual pixel.

    • 1 bit per pixel yields 21=22^1 = 2 colours (monochrome: black and white).

    • 2 bits per pixel yield 22=42^2 = 4 colours.

    • 8 bits per pixel yield 28=2562^8 = 256 colours.

    • 24 bits per pixel (True Colour) assign 8 bits to each Red, Green, and Blue component, yielding over 16.7 million16.7\text{ million} (224=16,777,2162^{24} = 16,777,216) colours.

    • Image Resolution:

    • The total number of pixels across the horizontal and vertical dimensions of an image (e.g., 4096×3072=12,582,912 pixels4096 \times 3072 = 12,582,912\text{ pixels}).

    • Reducing image resolution reduces the pixel count, leading to pixelation where individual rectangular pixels become visible to the naked eye.

Effects of Image Resolution and Pixelation

Data Storage and Compression

  • Data Storage Units and Measurement Standards:

    • Bit: The fundamental binary element (00 or 11).

    • Nibble: A grouping of 4 bits4\text{ bits}.

    • Byte: A grouping of 8 bits8\text{ bits}.

    • Metric Units (Base 10, SI Standard):

    • 1 Kilobyte (KB)=103 bytes=1,000 bytes1\text{ Kilobyte (KB)} = 10^3\text{ bytes} = 1,000\text{ bytes}

    • 1 Megabyte (MB)=106 bytes=1,000,000 bytes1\text{ Megabyte (MB)} = 10^6\text{ bytes} = 1,000,000\text{ bytes}

    • 1 Gigabyte (GB)=109 bytes=1,000,000,000 bytes1\text{ Gigabyte (GB)} = 10^9\text{ bytes} = 1,000,000,000\text{ bytes}

    • 1 Terabyte (TB)=1012 bytes=1,000,000,000,000 bytes1\text{ Terabyte (TB)} = 10^{12}\text{ bytes} = 1,000,000,000,000\text{ bytes}

    • 1 Petabyte (PB)=1015 bytes1\text{ Petabyte (PB)} = 10^{15}\text{ bytes}

    • 1 Exabyte (EB)=1018 bytes1\text{ Exabyte (EB)} = 10^{18}\text{ bytes}

    • Binary Units (Base 2, IEC Standard):

    • Established by the International Electrotechnical Commission for accurate internal memory measurement:

    • 1 Kibibyte (KiB)=210 bytes=1,024 bytes1\text{ Kibibyte (KiB)} = 2^{10}\text{ bytes} = 1,024\text{ bytes}

    • 1 Mebibyte (MiB)=220 bytes=1,048,576 bytes1\text{ Mebibyte (MiB)} = 2^{20}\text{ bytes} = 1,048,576\text{ bytes}

    • 1 Gibibyte (GiB)=230 bytes=1,073,741,824 bytes1\text{ Gibibyte (GiB)} = 2^{30}\text{ bytes} = 1,073,741,824\text{ bytes}

    • 1 Tebibyte (TiB)=240 bytes=1,099,511,627,776 bytes1\text{ Tebibyte (TiB)} = 2^{40}\text{ bytes} = 1,099,511,627,776\text{ bytes}

    • 1 Pebibyte (PiB)=250 bytes=1,125,899,906,842,624 bytes1\text{ Pebibyte (PiB)} = 2^{50}\text{ bytes} = 1,125,899,906,842,624\text{ bytes}

    • 1 Exbibyte (EiB)=260 bytes=1,152,921,504,606,846,976 bytes1\text{ Exbibyte (EiB)} = 2^{60}\text{ bytes} = 1,152,921,504,606,846,976\text{ bytes}

  • File Size Calculations:

    • Bitmap Image File Size:     Size (bits)=Image Resolution (Horizontal Pixels×Vertical Pixels)×Colour Depth (bits)\text{Size (bits)} = \text{Image Resolution (Horizontal Pixels} \times \text{Vertical Pixels)} \times \text{Colour Depth (bits)}

    • Conversion to bytes requires dividing bits by 88.

    • Conversion to mebibytes (MiB\text{MiB}) requires dividing bytes by 1,048,5761,048,576 (1024×10241024 \times 1024).

    • Example: An image with resolution 2048×20482048 \times 2048 and a colour depth of 16 bits16\text{ bits}:       Total Pixels=2048×2048=4,194,304 pixels\text{Total Pixels} = 2048 \times 2048 = 4,194,304\text{ pixels}       Size in bits=4,194,304×16=67,108,864 bits\text{Size in bits} = 4,194,304 \times 16 = 67,108,864\text{ bits}       Size in bytes=67,108,8648=8,388,608 bytes\text{Size in bytes} = \frac{67,108,864}{8} = 8,388,608\text{ bytes}       Size in MiB=8,388,6081,048,576=8 MiB\text{Size in MiB} = \frac{8,388,608}{1,048,576} = 8\text{ MiB}

    • Audio File Size:     Size (bits)=Sample Rate (Hz)×Sample Resolution (bits)×Length (seconds)×Channels\text{Size (bits)} = \text{Sample Rate (Hz)} \times \text{Sample Resolution (bits)} \times \text{Length (seconds)} \times \text{Channels}

    • For stereo tracks, multiply by 22.

    • Example: A 60-minute stereo audio file sampled at 44,100 Hz44,100\text{ Hz} at a resolution of 16 bits16\text{ bits}:       Total Time=60×60=3600 seconds\text{Total Time} = 60 \times 60 = 3600\text{ seconds}       Bits (mono)=44,100×16×3600=2,540,160,000 bits\text{Bits (mono)} = 44,100 \times 16 \times 3600 = 2,540,160,000\text{ bits}       Bits (stereo)=2,540,160,000×2=5,080,320,000 bits\text{Bits (stereo)} = 2,540,160,000 \times 2 = 5,080,320,000\text{ bits}       Bytes=5,080,320,0008=635,040,000 bytes\text{Bytes} = \frac{5,080,320,000}{8} = 635,040,000\text{ bytes}       Size in MiB=635,040,0001,048,576≈605.6 MiB\text{Size in MiB} = \frac{635,040,000}{1,048,576} \approx 605.6\text{ MiB}

  • Data Compression Fundamentals:

    • Purpose of Compression:

    • Conserves primary storage and non-volatile secondary storage capacity.

    • Decreases transmission, upload, and download durations across public and private networks.

    • Conserves network bandwidth (measured in bits per second).

    • Decreases operational financial costs for cloud storage and ISP metered bandwidth limits.

    • Lossy Compression:

    • Permanently removes redundant, non-critical, or less noticeable data using irreversible algorithms.

    • The original file cannot be reconstructed from the compressed file.

    • MPEG-3 (MP3): Compresses audio by approximately 90%90\% using perceptual music shaping, discarding frequencies beyond the normal human auditory threshold (20 Hz to 20 kHz20\text{ Hz to } 20\text{ kHz}) and eliminating softer sounds played simultaneously with louder sounds.

    • MPEG-4 (MP4): Compresses multimedia content (video, audio, text, graphics) for streaming without substantial loss of perceived quality.

    • JPEG: Compresses bitmap images by separating brightness (luminance) from colour (chrominance). Exploits human ocular limitations, which are far more sensitive to changes in brightness than subtle shifts in colour hues, dividing images into 8×88 \times 8 pixel matrices and discarding high-frequency chromatic variations.

    • Lossless Compression:

    • Reconstructs the compressed data back into the exact original bit-for-bit file without loss of information.

    • Crucial for mission-critical data files, spreadsheets, software binaries, and text documents.

    • Run-Length Encoding (RLE):

      • Replaces consecutive identical runs of repeating data items with a frequency count and the item value.

      • Text Example: The uncompressed 16-character string aaaaabbbbccddddd (16 bytes16\text{ bytes} in ASCII) is encoded as: 05 97 04 98 02 99 05 100 (8 bytes8\text{ bytes}, a 50%50\% reduction).

      • Flag Mechanism: When strings have diverse non-repeating data (e.g., cdcdcd), applying RLE increases file size. A dedicated control flag (e.g., 255255) is introduced to precede runs of identical characters, while non-repeating bytes are read as plain single values.

      • Monochrome Image Example: An 8×88 \times 8 pixel grid storing an image (64 bytes64\text{ bytes}) can be encoded by pixel colour (11 for white, 00 for black). A run such as 9W 6B 2W 1B is encoded as 91 60 21 10, cutting required memory from 64 bytes64\text{ bytes} down to 30 bytes30\text{ bytes}.

Data Transmission: Packets, Modes, and Architecture

  • Data Packet Structure:

    • Long data transmissions are divided into manageable chunks called data packets (datagrams), typically 64 KiB64\text{ KiB} in payload capacity.

    • Packet Header:

    • Contains the sender's IP address (source).

    • Contains the receiver's IP address (destination).

    • Packet sequence number (enables correct physical reassembly).

    • Total packet size (in bytes).

    • Total number of packets comprising the complete message.

    • Payload:

    • The actual user data payload being transported (≈64 KiB\approx 64\text{ KiB}).

    • Packet Trailer:

    • End-of-packet marker (designates boundary between successive packets).

    • Cyclic Redundancy Check (CRC) error-checking code: The sender computes a mathematical checksum of all 11-bits in the payload and appends it to the trailer. The receiver recalculates this sum upon arrival; any mismatch triggers an error and request for re-transmission.

  • Packet Switching Architecture:

    • Packets are routed independently across interconnected network nodes (routers).

    • Dynamic routing paths are selected based on localized node traffic, physical link failures, and congestion.

    • Packets may arrive out of order and must be reordered at the destination device using sequence numbers.

    • Hop Limits: A hop counter is added to the packet header, decrementing by 11 each time the packet crosses a router. If the hop count reaches zero before delivery, the packet is dropped to prevent zombie packets from clogging network bandwidth.

    • Benefits vs Drawbacks:

    • Benefits: Maximizes bandwidth usage by avoiding dedicated lines; dynamically bypasses failed routers; supports high data transfer rates.

    • Drawbacks: Packets can be dropped or lost; real-time video/audio streaming may stutter; destination requires processor overhead to reorder and assemble packets.

  • Transmission Directions and Synchronization:

    • Directional Modes:

    • Simplex: Data moves in a single, unidirectional path only (e.g., computer sending print jobs to a standard printer).

    • Half-Duplex: Data moves in both directions, but across a shared pathway where transmission cannot occur simultaneously in both directions (e.g., walkie-talkie communication).

    • Full-Duplex: Data moves simultaneously in both directions along the same channel (e.g., broadband internet connection).

    • Transmission Methods:

    • Serial Data Transmission:

      • Data is transmitted sequentially, one bit at a time, along a single wire/channel.

      • Advantages: Low interference; no risk of data skewing over long physical distances; cheaper hardware implementations.

      • Disadvantage: Slower overall transmission rate compared to parallel cables.

    • Parallel Data Transmission:

      • Multiple bits (typically one byte) are transmitted simultaneously across multiple parallel physical wires/channels.

      • Advantages: High-speed data transfer across very short distances (e.g., internal CPU buses).

      • Disadvantages: Bits travel at slightly different speeds across parallel wires over distances exceeding a few metres, arriving out of synchronization (known as data skewing); prone to electromagnetic crosstalk.

  • Universal Serial Bus (USB):

    • An asynchronous serial transmission standard utilized to connect peripheral devices to computers.

    • Standard USB cables contain four shielded internal wires: two for power (+5V+5\text{V} red power wire and black ground wire) and two for differential data transmission (white and green wires).

    • When a USB device is plugged in, the host computer detects a change in voltage on the data signal wires, queries the device for its configuration descriptor (Vendor ID, Product ID, and serial number), and loads the appropriate software device driver.

    • USB-C Specifications:

    • Features a 24-pin reversible, symmetrical connector.

    • Delivers up to 100 W100\text{ W} (20 V20\text{ V}) of power, capable of charging high-draw computing hardware.

    • Supports high-speed data transfers up to 10 Gbps10\text{ Gbps}, allowing real-time 4K4\text{K} video streaming.

    • Fully backward compatible with USB 2.0 and USB 3.0 via adapters.

    • Benefits and Limitations of USB:

    • Benefits: Auto-detection of devices; prevents incorrect physical insertion; industry-wide standardisation; eliminates external power bricks; built-in error checking protocol triggers automatic re-transmission.

    • Drawbacks: Maximum standard cable run is limited to 5 metres5\text{ metres} without active signal repeaters/hubs; older USB 1.1 hardware may lack modern OS support; slower transfer speed compared to native Ethernet.

Methods of Error Detection and Correction

  • Transmission Errors:

    • Electrical interference, signal attenuation, cable damage, and parallel data skewing can cause bits to flip (0→10 \rightarrow 1 or 1→01 \rightarrow 0) or drop completely.

  • Parity Checking:

    • Uses a dedicated parity bit (often the MSB) to ensure the total count of 11-bits in an 8-bit byte matches an agreed protocol.

    • Even Parity: The parity bit is set to 00 or 11 so that the total number of 11-bits in the byte is an even number.

    • Odd Parity: The parity bit is set to 00 or 11 so that the total number of 11-bits in the byte is an odd number.

    • Limitation: If two bits flip simultaneously within the same byte during transmission, the overall parity count remains unchanged, and the error goes undetected.

    • Parity Blocks:

    • A matrix checking technique where an entire block of bytes is transmitted with both horizontal parity bits for each byte and a concluding vertical parity byte for each column.

    • Pinpoints the exact coordinate (row and column intersection) of an inverted bit, enabling automatic bit correction without requiring re-transmission.

  • Checksum Verification:

    • The sender applies a predefined mathematical algorithm to the data block prior to transmission, deriving a numerical checksum appended to the transmission.

    • The recipient applies the identical algorithm to the received block.

    • If the newly generated checksum matches the transmitted checksum, the transmission is verified; otherwise, the block is flagged as corrupted and a re-transmission request is sent.

  • Echo Check:

    • The receiving computer immediately transmits a duplicate copy of the received data back to the sender.

    • The sender's computer compares the echoed data against the local original.

    • Flaw: If an error is detected, the sender cannot determine whether the corruption occurred during the initial forward transmission or during the return echo.

  • Check Digits:

    • A calculated validation digit appended as the final character of an identification code to detect manual data entry errors (e.g., barcode scans, ISBNs, VINs).

    • Detects single-digit typing mistakes, transposition errors (swapped adjacent digits), missing or extra characters, and phonetic entry errors.

    • ISBN 13 Check Digit Calculation:

    • Algorithm: Multiply all odd-positioned digits by 11 and sum them; multiply all even-positioned digits by 33 and sum them; sum both totals; divide by 1010; if remainder is 00, the check digit is 00, otherwise subtract the remainder from 1010.

    • Example: Compute check digit for 978034098382:       Odd Sum=9+8+3+0+8+8=36\text{Odd Sum} = 9 + 8 + 3 + 0 + 8 + 8 = 36       Even Sum=3×(7+0+4+9+3+2)=3×25=75\text{Even Sum} = 3 \times (7 + 0 + 4 + 9 + 3 + 2) = 3 \times 25 = 75       Total=36+75=111\text{Total} = 36 + 75 = 111       111÷10=11 remainder 1111 \div 10 = 11\text{ remainder } 1       Check Digit=10−1=9\text{Check Digit} = 10 - 1 = 9       Full ISBN 13=9780340983829\text{Full ISBN 13} = 9780340983829

    • Modulo-11 Check Digit:

    • Digits are multiplied by descending weightings (e.g., 8,7,6,5,4,3,28, 7, 6, 5, 4, 3, 2), summed, and divided by 1111.

    • The remainder is subtracted from 1111. If the result is 1010, the character X is used.

  • Automatic Repeat Requests (ARQ):

    • An automated protocol that utilizes positive acknowledgements, negative acknowledgements, and timeouts to ensure reliable data transmission.

    • The recipient uses an error-detection code (such as a CRC) to evaluate incoming packets.

    • If the packet is verified, a positive acknowledgement is returned to the sender.

    • If errors are found, a negative acknowledgement is sent, prompting immediate packet re-transmission.

    • The sender runs a timer (timeout); if no acknowledgement arrives within the designated duration, the packet is automatically re-sent until acknowledged or until a maximum re-transmission limit is reached.

Cryptography and Data Encryption

  • The Objective of Encryption:

    • Encodes plaintext into unreadable ciphertext to protect sensitive information from unauthorized eavesdroppers.

    • Encryption does not prevent interception; it ensures that intercepted data cannot be deciphered without the corresponding cryptographic key.

  • Symmetric Encryption:

    • Utilizes a single identical secret key for both encryption and decryption.

    • Vulnerability: The key distribution problem. The secret key must be shared between sender and recipient; if intercepted during exchange, the security of the communication is compromised.

    • Modern implementations utilize 256-bit symmetric keys, yielding 2256≈1.2×10772^{256} \approx 1.2 \times 10^{77} unique combinations to resist brute-force attacks.

  • Asymmetric Encryption:

    • Employs a mathematically linked pair of asymmetric keys: a public key (openly distributed) and a private key (kept secret by the owner).

    • Operational Workflow:

    • The recipient generates a public/private key pair.

    • The recipient shares their public key with the sender.

    • The sender encrypts the plaintext using the recipient's public key, generating ciphertext.

    • The recipient decrypts the ciphertext using their matching private key.

    • The private key cannot be derived from the public key, eliminating the key distribution vulnerability.

Computer Architecture: CPU and Von Neumann Architecture

  • The Central Processing Unit (CPU):

    • The core electronic component responsible for executing and processing all instructions and data.

    • Consists of the Control Unit (CU), Arithmetic & Logic Unit (ALU), internal registers, and the system clock.

  • Von Neumann Architecture Principles:

    • Conceptualized by John von Neumann in the mid-1940s as the "stored-program computer".

    • Core architectural features:

    • A unified Central Processing Unit.

    • Direct CPU access to primary memory.

    • Storage of both programming instructions and data within the same shared physical memory space.

    • Sequential execution of instructions.

  • Internal CPU Components:

    • Arithmetic & Logic Unit (ALU): Performs mathematical calculations (+,−,×,÷+, -, \times, \div) and Boolean logic operations (AND,OR,NOT\text{AND}, \text{OR}, \text{NOT}). Multiplication and division are executed through repeated additions, subtractions, and logical bit shifts.

    • Control Unit (CU): Directs and manages the flow of data and instruction processing throughout the system. Emits synchronization timing pulses via the control bus to coordinate internal hardware operations.

    • System Clock: A vibrating crystal generating regular electrical pulses at high frequencies (typically 3.5 GHz3.5\text{ GHz}, representing 3.5 billion3.5\text{ billion} cycles per second) to synchronize all internal CPU activities.

    • Immediate Access Store (IAS): Primary memory (RAM) directly accessible by the CPU, temporarily holding active programs and data retrieved from backing storage.

  • Special-Purpose CPU Registers:

    • Program Counter (PC): Holds the memory address of the next instruction waiting to be fetched.

    • Memory Address Register (MAR): Holds the active memory address currently being accessed for a read or write operation.

    • Memory Data Register (MDR): Holds the data value read from memory or waiting to be written to memory.

    • Current Instruction Register (CIR): Holds the instruction currently undergoing decoding and execution.

    • Accumulator (ACC): Temporarily stores the intermediate mathematical and logical results produced by the ALU.

  • System Buses:

    • Parallel physical pathways connecting the CPU, memory, and I/O devices:

    • Address Bus:

    • Unidirectional (transmits memory addresses strictly away from the CPU toward memory).

    • Bus width determines the maximum addressable memory space (n bits=2n locationsn\text{ bits} = 2^n\text{ locations}; a 32-bit address bus can access 232=4,294,967,296 memory locations2^{32} = 4,294,967,296\text{ memory locations}).

    • Data Bus:

    • Bidirectional (transports data, addresses, and instructions between the CPU, memory, and peripheral controllers).

    • Bus width determines the computer word length (16,32, or 64 bits16, 32, \text{ or } 64\text{ bits}), impacting overall system processing performance.

    • Control Bus:

    • Bidirectional (carries coordination, synchronization, and control signals across all components).

    • Typically 8 bits wide (carrying commands such as Read, Write, Bus Request, and Interrupts).

  • The Fetch–Decode–Execute Cycle:

    • Fetch Phase:

    • The memory address stored in the Program Counter (PC) is copied onto the Memory Address Register (MAR) via the address bus.

    • A read signal is emitted across the control bus to memory.

    • The data instruction stored at the specified MAR location is transferred into the Memory Data Register (MDR) via the data bus.

    • The instruction in the MDR is copied into the Current Instruction Register (CIR).

    • The Program Counter (PC) increments by 11 to point to the next instruction in memory.

    • Decode Phase:

    • The instruction in the CIR is decoded by the Control Unit into its constituent opcode and operand.

    • Execute Phase:

    • The Control Unit emits the necessary control signals to internal and external hardware to perform the action designated by the decoded opcode.

Processor Performance, Instruction Sets, and Embedded Systems

  • Factors Influencing CPU Performance:

    • System Clock Frequency: Higher clock speeds increase the number of cycles executed per second. However, extreme clock speeds can lead to CPU overheating and unsynchronized execution errors (overclocking risks).

    • Bus Width: Wider address and data buses expand the addressable memory capacity and increase the volume of data transferred per bus cycle.

    • Cache Memory: High-speed Static RAM (SRAM) integrated directly on the CPU die. Stores frequently accessed instructions and data to minimize latency caused by accessing slower off-chip Dynamic RAM (DRAM).

    • Core Count:

    • A core consists of an independent ALU, CU, and register set.

    • Dual-core and quad-core CPUs allow simultaneous parallel instruction execution.

    • Performance scaling is non-linear due to communication overhead and resource contention between cores.

  • Instruction Set Architecture:

    • The complete library of low-level machine code commands understood by a specific CPU architecture.

    • Opcode: Specifies the operation to execute (e.g., ADD, LDA, JMP).

    • Operand: Specifies the target data or register address to be manipulated.

  • Embedded Systems:

    • A dedicated integration of hardware and software designed to execute a specific, pre-programmed set of functions, often operating within a larger mechanical or electrical system.

    • Microcontroller: Integrates a CPU, RAM, ROM, and I/O peripherals onto a single integrated circuit chip.

    • Microprocessor: Contains only the CPU on the chip; requires external RAM, ROM, and supporting peripheral controllers.

    • System on Chip (SoC): Integrates an entire computer system (CPU, memory, storage, interface controllers, and auxiliary processors) on a single substrate.

    • Characteristics: Real-time operation; feedback-oriented; low power consumption; compact form factor; low manufacturing cost; limited user interface; non-general-purpose.

    • Applications:

    • Automotive systems: Airbag deployment, Anti-lock Braking Systems (ABS), engine management, electronic fuel injection.

    • Consumer electronics: Set-top television decoders, vending machines, washing machines, microwave ovens, and automated security alarms.

Input Devices, Technologies, and Applications

  • Barcode Scanners:

    • Scan alternating dark and light parallel lines using a red laser or LED.

    • Dark bars absorb light; white spaces reflect light back into photoelectric sensors.

    • The reflected optical pattern is converted into digital signals.

    • Left-side digits start with light spaces and have an odd number of dark elements; right-side digits start with dark bars and have an even number of dark elements, allowing bidirectional scanning.

    • Automatically queries stock databases to adjust inventory levels and manage re-ordering.

  • Quick Response (QR) Codes:

    • A two-dimensional matrix of dark square modules on a light background, capable of storing up to 42964296 alphanumeric characters or 70897089 numeric digits.

    • Features three large outer corner squares for orientation and alignment, and a smaller fourth internal square for scale and angle normalization.

    • Incorporates built-in Reed-Solomon error correction to remain readable even if partially damaged.

    • Can store URLs, boarding passes, and contact details, and can be read by smartphone cameras.

    • Security risk: Attagging, where malicious actors embed harmful scripts or fake URLs into QR codes to redirect users to phishing sites or download malware.

  • Digital Cameras:

    • Light enters through a lens assembly onto a Charge-Coupled Device (CCD) sensor matrix composed of millions of light-sensitive photodiodes (pixels).

    • Photodiodes convert photons into proportional electrical charges.

    • An internal ADC digitizes the analog charges into discrete brightness levels (e.g., an 8-bit ADC provides 256256 discrete levels).

    • Chromatic filters measure Red, Green, and Blue intensities to produce a 24-bit True Colour digital image array.

Digital Camera Architecture
  • Keyboards:

    • Contain a flexible membrane or mechanical switch matrix beneath the keycaps.

    • Pressing a key closes an electrical circuit at a specific coordinate, allowing the microprocessor to identify the key press.

    • The processor references an internal lookup table to locate the corresponding ASCII/Unicode value.

    • Ergonomic designs split and angle the key clusters to reduce the risk of Repetitive Strain Injury (RSI).

Ergonomic Keyboard
  • Microphones:

    • Convert sound waves into analog electrical signals.

    • Sound waves cause a flexible diaphragm to vibrate, moving an attached wire coil across a permanent magnetic field.

    • This movement induces an analog electrical current, which is digitized by an ADC/sound card for storage and processing.

  • Optical Mice:

    • A red LED illuminates the surface beneath the mouse.

    • A Complementary Metal Oxide Semiconductor (CMOS) sensor captures thousands of surface images per second.

    • An integrated Digital Signal Processor (DSP) analyzes geometric changes between successive image frames to calculate positional (X,Y)(X, Y) coordinates, which are sent to the host OS to update the screen cursor.

  • 2D and 3D Optical Scanners:

    • 2D Scanners: A bright xenon/LED lamp illuminates a paper document. An optical scan head directs reflected light through mirrors and lenses onto a CCD array, converting the visual data into an electronic bitmap. Optical Character Recognition (OCR) software can process the bitmap to extract editable text.

    • 3D Scanners: Scan solid physical objects across (X,Y,Z)(X, Y, Z) axes using lasers, structured white light, or Computed Tomography (CT), generating digital coordinate point clouds for use in Computer-Aided Design (CAD) and 3D printing.

  • Touch Screen Technologies:

    • Capacitive Touch Screens:

    • Built from a protective top glass layer, a transparent conductive electrode layer, and a glass substrate.

    • Bare human fingers act as electrical conductors; touching the glass alters the local electrostatic field.

    • A microcontroller measures the capacitance change to compute the contact coordinates.

    • Surface capacitive screens measure current draw at the four corners, while projective capacitive screens use an internal (X,Y)(X, Y) matrix to support multi-touch gestures (e.g., pinch-to-zoom).

    • Infrared Touch Screens:

    • Use an array of LED infrared transmitters along two edges and matching phototransistor sensors along the opposite edges, creating an invisible optical grid.

    • Touching the screen blocks specific infrared beams, allowing the controller to calculate the touch coordinates.

    • Highly durable; unaffected by cracked glass, but susceptible to moisture and dust buildup.

    • Resistive Touch Screens:

    • Consist of a flexible polyester top layer and a rigid glass bottom layer, both coated with thin resistive material (indium tin oxide) and separated by tiny insulating spacer dots.

    • Physical pressure causes the flexible top layer to make contact with the bottom layer, completing an electrical circuit.

    • The resulting voltage drop is measured to determine the touch location.

    • Operates with bare fingers, gloved hands, or styluses, but lacks multi-touch support and is prone to surface scratching.

Output Devices, Technologies, and Applications

  • Actuators:

    • Electromechanical output transducers that convert digital electrical signals into physical motion.

    • Solenoids utilize an electromagnetic coil to drive an internal metallic plunger in linear or rotational motion, opening and closing physical valves and mechanical linkages.

  • Light Projectors:

    • Digital Light Projectors (DLP):

    • White light from a xenon lamp passes through a spinning RGB colour wheel onto a Digital Micromirror Device (DMD) chip.

    • The DMD chip contains millions of microscopic aluminum mirrors that tilt thousands of times per second towards the light source (ON) or away (OFF), creating a greyscale image combined with the colour wheel to project full-colour images.

    • Liquid Crystal Display (LCD) Projectors:

    • A high-intensity lamp directs white light onto dichroic mirrors, splitting it into separate Red, Green, and Blue wavelengths.

    • Each monochromatic light beam passes through a dedicated LCD panel, and the three resulting images are recombined using a prism and projected through the lens.

  • Inkjet and Laser Printers:

    • Inkjet Printers:

    • Form images by spraying microscopic liquid ink droplets through print head nozzles.

    • Thermal Bubble: Microscopic resistors create localized heat, vaporizing ink into an expanding bubble that ejects a droplet before collapsing to draw fresh ink.

    • Piezoelectric: Piezoelectric crystals vibrate when charged, altering reservoir volume to eject droplets.

Inkjet Printer
  • Laser Printers:

    • Print entire pages in a single continuous process using powdered ink (toner) and static electricity.

    • Print stages: Drum is positively charged; a laser sweeps across it to create a negatively charged electrostatic latent image; positively charged toner adheres to the negatively charged areas; paper receives a strong negative charge, pulling toner off the drum; paper passes through heated fuser rollers that melt the plastic toner into the paper fibres; a discharge lamp cleans residual charge from the drum.

Laser Printer
  • 3D Printers:

    • Construct physical objects additively layer by layer based on digital CAD files.

    • Direct 3D Printing: Utilizes inkjet-style print heads that move in three dimensions (X,Y,ZX, Y, Z) to extrude layers of melted polymers.

    • Binder 3D Printing: Alternates between spreading thin layers of dry powder (resin, metal, ceramic) and spraying a liquid adhesive binder.

3D Printer
  • Display Technologies: LED, LCD, and OLED:

    • Liquid Crystal Display (LCD): Composed of liquid crystals arranged into a pixel matrix that modulates light. Does not emit light naturally; requires backlighting via Cold Cathode Fluorescent Lamps (CCFL) or Light Emitting Diodes (LEDs).

    • LED-Backlit LCD: Uses blue-white LEDs behind the LCD layer, providing instant maximum brightness, vivid colour saturation, thinner profile, and lower power consumption compared to older CCFLs.

    • Organic Light Emitting Diode (OLED): Uses carbon-based organic semiconductor films sandwiched between metallic cathodes and glass anodes. Emits light directly when an electric current passes through, eliminating the need for backlighting. Enables flexible, curved displays with ultra-thin profiles, wide viewing angles (≈170∘\approx 170^\circ), and high energy efficiency.

OLED Curved Display
  • Loudspeakers:

    • Digital audio streams are converted into variable analog electrical currents by a Digital-to-Analogue Converter (DAC).

    • An amplifier boosts the signal and feeds it to an internal electromagnetic coil wound around an iron core.

    • The fluctuating electromagnetic field interacts with a stationary permanent magnet, causing the attached paper or synthetic cone to vibrate and produce audible sound waves.

Sensors and Automated Control/Monitoring Systems

  • Sensor Characteristics and Operations:

    • Sensors are input transducers that measure continuous, physical analogue properties from their surrounding environment.

    • Because microprocessors process digital data, incoming analogue sensor signals must pass through an ADC.

  • Sensor Taxonomy and Specific Applications:

    • Temperature: Measures thermal conditions using resistance changes (e.g., climate control, chemical plant monitoring, greenhouse automation).

    • Moisture: Measures water presence in soil or building materials via electrical resistance (e.g., automated agricultural irrigation).

    • Humidity: Measures water vapour in the air using electrical conductivity (e.g., cleanrooms, silicon wafer manufacturing).

    • Light: Uses photoelectric cells to convert ambient luminosity into variable electric currents (e.g., automatic street lamps, vehicle headlights).

    • Infrared (Active): Emits an infrared beam toward a detector; an interrupted beam signals an event (e.g., burglar tripwires, rain-sensing wipers).

    • Infrared (Passive - PIR): Detects heat radiation emitted by warm bodies (e.g., security motion sensors, industrial cold-storage monitoring).

    • Pressure: Generates proportional electrical currents under physical loads (e.g., weighbridges, industrial gas flow systems).

    • Acoustic/Sound: Microphone-based transducers that convert sound waves into electrical pulses (e.g., intruder footsteps, leak detection).

    • Gas: Detects specific gas concentrations (O2,CO2\text{O}_2, \text{CO}_2) via electrochemical cells (e.g., pollution monitoring, exhaust sensors).

    • pH: Measures acidity and alkalinity via electrical potential differences (e.g., chemical reactors, hydroponic reservoirs).

    • Magnetic Field: Measures changes in magnetic flux (e.g., vehicle ABS wheel speed sensors, electronic compasses).

    • Accelerometer: Piezoelectric sensors measuring changes in dynamic velocity (e.g., airbag deployment, smartphone display orientation).

    • Proximity: Detects nearby physical objects without contact (e.g., smartphone ear detection to disable the screen during calls).

    • Flow Rate: Measures the movement speed of liquids or gases (e.g., medical ventilators, natural gas pipelines).

    • Level: Uses ultrasonic echo reflections or electrical capacitance to measure fluid depths (e.g., fuel tanks, reservoir monitoring).

  • Monitoring versus Control Systems:

    • Monitoring Systems: The computer receives sensor inputs, converts them via ADC, compares them against stored parameters, and outputs alerts (e.g., sounding an alarm, updating graphs). The computer cannot physically alter the environment being measured.

    • Control Systems: The computer receives sensor inputs, processes the data, and sends control signals to actuators (via a DAC if necessary) to manipulate external hardware (e.g., opening valves, turning on heaters). This action directly alters future sensor readings, creating a continuous closed feedback loop.

Primary, Secondary, Virtual, and Cloud Storage Technologies

  • Primary Memory Architecture:

    • Random Access Memory (RAM):

    • Volatile primary storage directly accessible by the CPU, holding the operating system, running applications, and current data.

    • Dynamic RAM (DRAM): Each bit is stored as an electrical charge in a capacitor controlled by a transistor. Capacitors leak charge and must be dynamically refreshed every few milliseconds, making DRAM slower than SRAM, though cheaper and denser.

    • Static RAM (SRAM): Uses cross-coupled flip-flop circuits to hold bits. Does not require refreshing, providing faster access times (≈25 ns\approx 25\text{ ns} vs ≈60 ns\approx 60\text{ ns} for DRAM). Used primarily for high-speed CPU cache memory.


DRAM ModuleSRAM Integrated Circuit
  • Read-Only Memory (ROM):

    • Non-volatile primary storage that cannot be modified during normal operation.

    • Stores the factory boot-up bootstrap program and the Basic Input/Output System (BIOS).

    • Secondary and Non-Volatile Storage Devices:

  • Magnetic Storage (Hard Disk Drives - HDD):

    • Stores data magnetically across circular platters spinning at high speeds (typically 7200 rpm7200\text{ rpm}).

    • Read/write electromagnetic heads move radially across platters divided into concentric tracks and sectors.

    • Vulnerable to latency (rotational delay while the sector moves beneath the head) and physical head crashes.

    • File fragmentation occurs over time as files are stored in non-contiguous sectors, slowing access speeds and requiring defragmentation software.

Hard Disk Drive Internal Construction
  • Solid State Storage (Solid State Drives - SSD):

    • Non-volatile electronic storage with no moving parts, eliminating physical latency.

    • Uses floating-gate and control-gate transistors arranged in NAND flash memory arrays.

    • Electrons are forced through a dielectric oxide insulation layer into the floating gate via an applied voltage, where they remain trapped to represent stored bit values.

    • Benefits: Higher durability, faster read/write speeds, lower power consumption, silent operation, and compact form factor.

    • Drawbacks: Finite write endurance limits the number of program/erase cycles before the flash memory degrades.

  • Optical Storage Media:

    • Stores binary data along a continuous spiral track using microscopic indentations (pits) and flat areas (lands).

    • A laser reads the surface: pits scatter the light, while lands reflect it cleanly into an optical sensor.

    • CDs: Use a red laser with a wavelength of 780 nm780\text{ nm}; track pitch is 1.60 μm1.60\text{ }\mu\text{m}.

    • DVDs: Use a red laser with a shorter wavelength of 650 nm650\text{ nm}; track pitch is 0.74 μm0.74\text{ }\mu\text{m}. Dual-layering allows two reflective layers on the same side, focusing the laser at different depths to expand capacity to 4.7 GB4.7\text{ GB}.

    • Blu-ray Discs: Use a blue-violet laser with a short wavelength of 405 nm405\text{ nm}; track pitch is 0.30 μm0.30\text{ }\mu\text{m}. The narrower beam allows smaller pits and lands, providing 27 GB27\text{ GB} of storage per layer.

Optical Disc Medium
  • Virtual Memory Architecture:

    • Uses secondary storage (HDD or SSD swap space) to supplement physical RAM when capacity is exhausted.

    • Operating systems divide programs into fixed-size data blocks called pages.

    • Inactive memory pages are swapped out of RAM into secondary storage swap files, freeing physical RAM for active pages.

    • Disk Thrashing: Occurs when physical RAM is critically depleted and the OS spends more time swapping pages between RAM and disk than executing instructions. This causes performance to collapse, reaching the "thrash point".

  • Cloud Storage:

    • Stores data on remote server farms accessible over the internet, managed by hosting providers that maintain data redundancy across multiple locations.

    • Architectures: Public Cloud (multi-tenant infrastructure), Private Cloud (dedicated corporate infrastructure behind a firewall), and Hybrid Cloud (combines private storage for sensitive data with public cloud resources for general tasks).

    • Trade-offs:

    • Advantages: Worldwide accessibility, automated remote backups, scalable capacity, and built-in disaster recovery.

    • Disadvantages: Requires reliable internet connectivity; ongoing subscription costs; risks of third-party security breaches and loss of direct data control.

Network Hardware and Network Architectures

  • Network Hardware Components:

    • Network Interface Card (NIC): A hardware component that provides a device with a physical network connection and holds its factory-burned 48-bit MAC address.

    • Wireless NIC (WNIC): Enables wireless network connectivity by using an internal antenna to transmit and receive radio frequency signals.

    • Routers: Inspect data packet destination IP addresses to forward traffic between disparate networks (e.g., connecting a local LAN to the internet WAN). Converts packet protocols between different network standards.


USB Cable ConstructionHDMI CableFibre Optic Cable Internal Structure
  • MAC versus IP Addressing:

    • Media Access Control (MAC) Addresses:

    • A 48-bit physical hardware identifier permanently assigned to the NIC at manufacture.

    • Format: Six hexadecimal octets (NN-NN-NN-DD-DD-DD\text{NN-NN-NN-DD-DD-DD}).

    • Generally static (Universally Administered, UAA), but can be reassigned via software (Locally Administered, LAA) to match specific network filtering rules.

    • Internet Protocol (IP) Addresses:

    • A logical network address assigned to identify a device's location on a network.

    • IPv4: 32-bit address represented as four denary octets (0 to 2550\text{ to }255) separated by periods (e.g., 192.168.1.1).

    • IPv6: 128-bit address represented as eight blocks of four hexadecimal digits separated by colons (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334).

    • Static versus Dynamic IP Addressing:

    • Static IP: Permanently assigned; does not change between sessions. Essential for web servers, FTP servers, and online databases.

    • Dynamic IP: Temporarily leased to a device by a Dynamic Host Configuration Protocol (DHCP) server when connecting to a network. Conserves address pools and provides greater privacy for client devices.

Software Classification, Operating Systems, and Interrupt Management

  • Software Classification:

    • System Software: Programs designed to run, manage, and maintain computer hardware and provide a platform for application software. Includes operating systems, utility software, device drivers, compilers, linkers, and assemblers.

    • Application Software: Programs that enable users to execute specific productivity, creative, or utility tasks. Includes word processors, spreadsheets, databases, graphics editors, and web browsers.

  • Operating System Core Functions:

    • Human-Computer Interface (HCI):

    • Command Line Interface (CLI): Requires users to type explicit text commands. Consumes minimal memory and offers direct hardware control for advanced developers, but has a steep learning curve and high typing error potential.

    • Graphical User Interface (GUI): Features Windows, Icons, Menus, and Pointers (WIMP). Accessible and intuitive for non-technical users, but requires significant memory and processing resources.

    • Memory Management: Allocates physical RAM blocks to active applications, prevents competing processes from overwriting each other's memory, and manages page swapping to virtual memory.

    • Multitasking: Preemptively allocates CPU time slices to concurrent processes based on scheduling priorities, switching contexts rapidly to give the illusion of simultaneous execution.

    • Device Driver Management: Communicates with hardware peripherals using specialized drivers that convert generic OS instructions into hardware-specific control signals.

    • File Management: Organizes physical storage media into logical directories and files, manages read/write permissions, handles naming conventions, and tracks file locations.

    • Security Management: Controls user account authentication, enforces file access privileges, logs security events, and manages user passwords.

  • Utility Programs:

    • Virus Checkers: Continuously scans files in the background against a signature database of known malware, applies heuristic analysis to catch emerging threats, and quarantines suspicious files.

    • Defragmentation Software: Scans hard disk drives to consolidate fragmented, non-contiguous file clusters into contiguous sectors, reducing physical read-head travel and restoring drive read/write performance.

    • Backup Utilities: Automates scheduled copies of critical local files to external or cloud storage, supporting differential backups and full system restore points.

Time Machine System Restore Dialog
  • Interrupts and Buffer Management:

    • Interrupts: An electrical signal sent by hardware or software to the CPU, requesting immediate processor attention.

    • Hardware interrupts: Printer out of paper, keypress, disk drive read error.

    • Software interrupts: Division by zero, missing file, array out-of-bounds error.

    • Interrupt Servicing Workflow:

    • The CPU completes its current Fetch–Decode–Execute cycle.

    • The status of the current running process (Program Counter and register contents) is saved to a system stack.

    • The CPU invokes the matching Interrupt Service Routine (ISR) by loading its start address into the Program Counter.

    • Once the ISR finishes executing, the saved register values and Program Counter are restored from the stack, allowing the original program to resume execution.

    • Buffers: Temporary memory holding areas used to compensate for speed disparities between fast processors and slower peripherals (e.g., sending print jobs to a printer buffer, buffering video streams from the internet).

Programming Languages, Language Translators, and Integrated Development Environments (IDEs)

  • Programming Language Hierarchy:

    • High-Level Languages (HLL):

    • Problem-oriented languages using English-like syntax (e.g., Python, Visual Basic, Java).

    • Portable across different CPU architectures; easier to read, write, debug, and maintain.

    • Must be translated into machine code before execution, resulting in larger binaries and slower runtime performance.

    • Low-Level Languages (LLL):

    • Hardware-dependent languages tied directly to specific processor instruction sets.

    • Assembly Language: Uses mnemonic opcodes (e.g., LDA, ADD, STO) to represent machine instructions. Allows direct manipulation of CPU registers and memory, producing compact, fast-executing programs.

    • Machine Code: The native binary (00s and 11s) or hexadecimal instructions executed directly by the CPU without translation.

  • Language Translators:

    • Compilers:

    • Translates the entire high-level source code into standalone executable machine code (object code) in a single pass.

    • Produces a comprehensive error diagnostic report if syntax errors are found.

    • Executable files run independently without requiring the compiler software; runs faster than interpreted code.

    • Interpreters:

    • Translates and executes high-level source code line-by-line.

    • Halts execution immediately upon encountering an error, pinpointing the exact line for rapid debugging during development.

    • Does not produce a standalone executable; requires the interpreter to be present every time the program runs.

    • Assemblers:

    • Translates low-level assembly language mnemonics directly into machine code.

    • Typically maps one assembly statement to one native machine code instruction.

  • Integrated Development Environment (IDE) Core Features:

    • Code Editor: Dedicated editor offering syntax highlighting, line numbering, and prettyprinting.

    • Runtime Environment: Executes code directly within the IDE framework.

    • Debugger: Allows stepping through code line-by-line (single-stepping), setting breakpoints, and monitoring variable states in real time.

    • Error Diagnostics: Highlights syntax errors in real time and offers automated code corrections.

    • Auto-Completion: Context-aware prompts that suggest variable names and language keywords.

The Internet, World Wide Web, and Web Technologies

  • The Internet versus the World Wide Web:

    • The Internet: The global physical network of interconnected computer networks, communicating via TCP/IP protocols.

    • The World Wide Web (WWW): A collection of multimedia websites, web pages, and digital resources hosted on web servers, accessed across the internet using HTTP/HTTPS protocols.

  • Uniform Resource Locators (URLs):

    • Standardized text addresses used to locate web resources.

    • Structure: protocol://website address/path/file name

    • Protocol: http or https.

    • Website Address: Composed of domain host (www), domain name, and domain category (.com, .org, .gov, .edu) or country code (.uk, .de).

    • Path: Directory path on the server.

    • File Name: Target web page or asset.

  • Domain Name System (DNS) Resolution:

    • Translates human-readable domain names into numerical IP addresses.

    • Step 1: User enters a URL into their browser.

    • Step 2: The browser queries a local DNS cache or primary DNS server for the matching IP address.

    • Step 3: If not cached, the DNS server queries higher-level DNS servers to resolve the domain to an IP address.

    • Step 4: The resolved IP address is returned to the user's browser.

    • Step 5: The browser uses the IP address to establish an HTTP/HTTPS connection with the destination web server, retrieving the HTML files for rendering.

  • HTTP and HTTPS Protocols:

    • HTTP (Hypertext Transfer Protocol): The standard protocol for transmitting hypertext documents across the web; transmitted in unencrypted plaintext.

    • HTTPS (Hypertext Transfer Protocol Secure): Encrypts web traffic using SSL/TLS protocols to protect data from interception.

  • Cookies:

    • Small data packets sent by a web server and stored locally by the user's browser.

    • Session Cookies: Stored in temporary RAM; deleted automatically when the browser is closed. Used to manage shopping cart items during an active browsing session.

    • Persistent Cookies: Stored on the user's secondary storage until an expiration date is reached. Used to remember login credentials, store user preferences, and track browsing habits for targeted advertising.

Digital Currencies and Blockchain Architecture

  • Digital Currency versus Fiat Currency:

    • Fiat Currency: Legal tender issued and regulated by central banks and governments (e.g., \$ , \pounds, \euro).

    • Digital Currency: Money that exists solely in electronic form. Centralized digital currencies are managed through traditional banking networks (e.g., PayPal, online banking).

  • Cryptocurrency:

    • A decentralized digital currency that uses cryptographic protocols to secure financial transactions, operating without central bank or government control.

    • Publicly records transactions across a decentralized network of peer computers.

  • Blockchain Architecture:

    • An immutable, distributed ledger technology where transactions are permanently recorded in cryptographically linked blocks.

    • Block Anatomy:

    • Transaction data: Details of sender, recipient, and transfer amount.

    • Hash value: A unique cryptographic identifier (typically SHA-256) calculated from the block's contents and timestamp.

    • Previous hash: The hash of the preceding block, linking the blocks in a continuous chain.

    • Security and Tamper-Resistance:

    • The first block is the "genesis block" (its previous hash is zero).

    • Modifying data inside any block recalculates its hash, breaking the link to all subsequent blocks in the chain.

    • Proof-of-Work: Requires computers (miners) to solve computationally intensive mathematical problems before a new block can be added (taking ≈10 minutes\approx 10\text{ minutes} per block), making it practically impossible for attackers to recalculate the chain faster than the rest of the network.

Cyber Security Threats, Vulnerabilities, and Defensive Measures

  • Threat Analysis:

    • Brute-Force Attacks: Automated trial-and-error attacks testing every possible character combination to guess user passwords.

    • Data Interception: Intercepting data as it travels across wired or wireless networks, using packet sniffers or wardriving.

    • Distributed Denial of Service (DDoS): Flooding a target server with massive volumes of fake traffic originating from a botnet of infected computers, overwhelming its bandwidth and server resources to take it offline.

    • Hacking: Gaining unauthorized access to a computer system, often to steal, modify, or delete sensitive data.

    • Malware Taxonomy:

    • Viruses: Malicious code that attaches to a host program or file; requires human action to execute and replicate.

    • Worms: Standalone malware that self-replicates across networks without requiring a host file or user interaction.

    • Trojan Horses: Malicious programs disguised as legitimate software to trick users into installing them.

    • Spyware: Software that secretly monitors user activity, logs keystrokes, and sends sensitive data (passwords, banking details) back to an attacker.

    • Adware: Software that floods the user's screen with unwanted advertisements and redirects browser searches to promotional sites.

    • Ransomware: Encrypts user files on storage drives and demands a financial ransom in exchange for the decryption key.

    • Social Engineering:

    • Manipulating people into breaking normal security protocols through psychological manipulation.

    • Exploits human emotions: fear (fake antivirus alerts), curiosity (malware-infected USB sticks left in public), and trust/empathy (impersonating IT support personnel).

    • Phishing: Sending deceptive emails masquerading as trusted institutions to trick users into clicking malicious links or revealing sensitive credentials.

    • Pharming: Installing malicious code on a local machine or poisoning a DNS server's cache to secretly redirect users from legitimate URLs to identical-looking fraudulent websites.

  • Defensive Countermeasures:

    • User Access Levels: Implementing role-based access control policies within operating systems and databases to restrict file access to authorized personnel.

    • Multi-Factor Authentication (MFA) and Biometrics:

    • Requires two or more authentication factors: something you know (password/PIN), something you have (smartphone token), and something you are (biometrics: fingerprints, retina scans, facial recognition).

    • Fingerprint scanners match ridge and valley patterns (≈1 in 5000\approx 1\text{ in } 5000 error rate).

    • Retina scans map unique blood vessel patterns at the back of the eye using infrared light (≈1 in 10,000,000\approx 1\text{ in } 10,000,000 error rate).


User Authentication InterfaceRetina Scan Image
  • Firewalls: Hardware or software solutions positioned between private networks and the internet to filter incoming and outgoing packets based on predefined security rules.

  • Proxy Servers: Intermediary servers that handle requests between client computers and external web servers. Hides internal IP addresses, caches frequently accessed web pages to improve access speeds, and filters unauthorized outbound traffic.

  • Secure Sockets Layer (SSL) and Transport Layer Security (TLS):

    • Cryptographic protocols that establish encrypted connections between web browsers and servers.

    • When connecting via HTTPS, the web server provides an authentic digital SSL/TLS certificate signed by a trusted Certificate Authority.

    • The browser validates the certificate, generates a symmetric session key encrypted with the server's public key, and transmits it to the server.

    • Both parties decrypt and use the shared session key to encrypt all subsequent communication.

Automated Systems Across Industry, Transport, and Science

  • Industrial Automated Systems:

    • Nuclear Power Station Safety:

    • Uses a Distributed Control System (DCS) to monitor operational parameters using temperature, pressure, flow rate, gas leakage, and radiation sensors.

    • The system processes incoming sensor data; if parameters exceed safety limits, it signals actuators to open emergency coolant valves, engage water pumps, or insert control rods for an emergency shutdown.

    • Benefits: Faster response times than human operators; removes personnel from hazardous radiation zones; maintains optimal operating conditions.

    • Limitations: Expensive initial development; potential vulnerabilities to cyberattacks; software may struggle with untested, edge-case conditions.

    • Pharmaceutical Manufacturing:

    • Automates chemical synthesis and tablet production using temperature, pressure, level, and pH sensors.

    • Actuators control chemical dosing valves, motor-driven stirrers, and tablet compression presses.

    • Benefits: High product consistency; eliminates contamination from human handling; operates continuously 24/724/7.

  • Automated Transport Systems:

    • Adaptive Cruise Control:

    • Uses forward-facing radar and laser sensors to measure the distance to the preceding vehicle.

    • The on-board computer calculates stopping distances based on real-time vehicle speed.

    • If the preceding car slows down, actuators reduce the throttle and apply the brakes. When the lane clears, actuators accelerate back to the set cruising speed.

    • Self-Parking Systems:

    • Ultrasonic bumper sensors and optical cameras scan for valid parking spaces.

    • The computer computes steering and reversing trajectories, controlling actuators connected to the steering rack, transmission, and brakes to park automatically.

  • Agricultural and Environmental Automation:

    • Crop Irrigation Systems:

    • Automated weather stations record temperature, humidity, and rainfall data.

    • Ultrasonic level and soil moisture sensors measure moisture levels in fields.

    • The controller analyzes soil and weather data, activating water pumps via actuators when conditions fall below target thresholds.

    • Benefits: Conserves scarce water supplies; provides tailored watering for different crop types; reduces labor costs over vast farming areas.

    • Automated Weather Stations:

    • Gathers meteorological data in remote areas using thermometers, anemometers (wind speed), hygrometers (humidity), barometers (pressure), and tipping-bucket rain gauges.

    • A microprocessor logs the data, computes running averages, and transmits updates to central databases via wireless transmitters.

  • Science and Laboratory Automation:

    • Automates precise chemical titration using level sensors, computer-controlled burette actuators, and optical colorimeters that monitor solution colour shifts to stop reactions at the exact neutralization point.

Robotics: Architecture, Mechanics, and Real-World Implementation

  • Defining Characteristics of a Robot:

    • Environmental Sensing: Must possess sensors (light, pressure, ultrasonic, temperature) to perceive its surrounding environment.

    • Physical Movement: Must possess mechanical articulation (wheels, joints, gears, cogs, linkages) and an end-effector (gripper, welding torch, paint nozzle, surgical blade) to manipulate physical objects.

    • Programmability: Must contain a programmable controller (microprocessor) to process sensor inputs and execute specific operational tasks.


Industrial Robotic Arm WeldingAutonomous Carpet SweeperAerial Drone
  • Classification:

    • Independent (Autonomous) Robots: Operate without human intervention, navigating and responding to environmental conditions using on-board sensors and programmed routines (e.g., automated vacuum cleaners, Mars rovers).

    • Dependent Robots: Require continuous human control or supervision, assisting or augmenting human actions (e.g., tele-operated surgical robots, bomb-disposal units).

  • Robotics Across Application Domains:

    • Manufacturing:

    • Performs high-precision, repetitive tasks: spray painting, structural spot welding, and circuit board assembly.

    • Programming methods: Direct instruction coding, manual teach-in where an operator guides the arm through the motion, or strapping sensors to an operator to record movement trajectories.

    • Advantages: Operates 24/724/7 in hazardous environments (toxic paint fumes, extreme heat); delivers high output consistency; lowers long-term operational costs.

    • Disadvantages: High capital purchase costs; causes worker displacement and deskilling; lacks the flexibility to adapt to unexpected production defects.

    • Transport:

    • Autonomous Trains: Uses LiDaR (Light Detection and Ranging), proximity sensors, and trackside transponders to navigate urban railways, eliminating human driver error and improving scheduling frequency.

    • Autonomous Airplanes: Extends traditional auto-pilot systems by managing full flight profiles, navigation, engine throttling, and stabilization via advanced sensor arrays.

Autonomous Rail Transit System
  • Medicine:

    • Robotic surgical systems translate fine surgeon hand movements into micro-movements of miniature surgical instruments, reducing incision size and patient recovery time.

    • Prosthetics: Advanced bionic limbs use myoelectric sensors to detect electrical signals from remaining muscle tissue, driving motor actuators to recreate human grip articulation.

  • Domestic and Consumer:

    • Autonomous vacuum cleaners and lawnmowers use bump sensors, optical cameras, and infrared cliff sensors to navigate rooms and avoid obstacles.

    • Entertainment and companion robots (e.g., Vector) use microphones for voice recognition, HD cameras for facial tracking, and internet connections for voice-driven interaction.

Vector Companion Robot

Artificial Intelligence, Expert Systems, and Machine Learning

  • Artificial Intelligence (AI):

    • The simulation of human cognitive functions (learning, reasoning, adapting) by computer systems.

    • Categories of AI:

    • Narrow AI: Designed to excel at a single, specific task (e.g., chess engines, facial recognition, search engine algorithms).

    • General AI: Matches human intellectual capabilities across diverse operational domains.

    • Strong AI: Surpasses human intelligence and reasoning across virtually all intellectual and creative tasks.

Smart Home Virtual Assistant Device
  • Expert Systems:

    • AI systems designed to mimic the decision-making capabilities of human experts in specific fields (e.g., medical diagnosis, mineral prospecting, engine troubleshooting).

    • System Components:

    • User Interface: The screen through which the user interacts with the system, answering diagnostic questions.

    • Inference Engine: The reasoning component that applies logical rules to the user's inputs, searching the knowledge base for matching patterns.

    • Knowledge Base: A structured repository of specialized facts, objects, and relationships.

    • Rules Base: A collection of conditional inference rules (typically structured as IF... THEN... statements) that govern the reasoning process.

    • Explanation System: Explains the reasoning behind the system's conclusions and provides the statistical probability of its diagnosis.

  • Machine Learning:

    • A subset of AI where systems learn from historical training data to detect patterns and make predictions without being explicitly programmed.

    • Comparison: Artificial Intelligence is the broad concept of machines simulating human intelligence, whereas Machine Learning is a specific methodology that trains algorithms on large datasets to make data-driven decisions.

    • Applications:

    • Email Spam Filtering: Algorithms analyze email text, headers, and metadata, learning from user-flagged spam to improve filtering accuracy.

    • Retail Recommendation Systems: Uses collaborative filtering to analyze customer purchasing histories and recommend products based on similar user profiles.

    • Financial Fraud Detection: Flags suspicious credit card transactions that deviate from a customer's typical spending patterns.

  • Deep Learning (Extension):

    • An advanced subset of machine learning inspired by the human brain's neural architecture, organizing algorithms into Artificial Neural Networks (ANNs).

    • Network Structure:

    • Input Layer: Receives raw data (e.g., pixel matrices, audio waveforms).

    • Hidden Layers: Intermediate node layers that extract features (e.g., edges, textures, shapes).

    • Output Layer: Produces final classifications or decisions.

    • Excels at complex non-linear tasks such as facial recognition, autonomous vehicle vision, and natural language processing, but requires massive datasets and high computing power.

Deep Learning Neural Network Model

Algorithm Design, Problem Solving, and Decomposition

  • The Program Development Life Cycle:

    • Analysis: The problem is investigated to establish a detailed requirements specification.

    • Abstraction: Retaining essential details required for the solution while stripping away irrelevant data.

    • Decomposition: Breaking a complex problem down into smaller, self-contained sub-problems that can be solved independently.

    • Design: Defining the structure of the solution using formal modeling tools (structure diagrams, flowcharts, pseudocode).

    • Coding: Writing the program code in a chosen high-level programming language.

    • Testing: Executing the code with diverse test datasets to ensure it produces correct outputs under all conditions.

  • Top-Down Design and Structure Diagrams:

    • Deconstructs a computer system into hierarchical sub-systems through a process of stepwise refinement.

    • Visualized using hierarchical tree structures displaying module relationships.

  • Flowcharts:

    • Graphical representations of program logic using standardized flowchart shapes:

    • Terminator (Oval): Marks the start (START) or end (STOP) of an algorithm.

    • Process (Rectangle): Represents data processing (e.g., calculations, variable assignments).

    • Input/Output (Parallelogram): Represents user input or screen/printer output.

    • Decision (Diamond): Evaluates a condition to branch execution along alternative paths (Yes/No or True/False).

    • Sub-routine (Predefined Process Rectangle): References a named function or procedure defined elsewhere.

    • Flow Line (Arrow): Indicates the sequential direction of execution.

  • Pseudocode Standards:

    • Uses a non-proportional font with keywords capitalized (INPUT, OUTPUT, IF, THEN, ELSE, FOR, WHILE).

    • Variable identifiers start with capital letters.

    • Indentation is maintained (typically two spaces) inside loops and conditional statements.

    • Assignment Operator: ← assigns the value of an expression on the right to the variable on the left (e.g., Cost ← 10).

Validation, Verification, and Test Data Strategies

  • Validation Techniques:

    • Automated checks conducted by the computer to ensure that input data is reasonable and sensible before accepting it.

    • Range Check: Confirms that numeric values fall within defined lower and upper limits (e.g., Mark >= 0 AND Mark <= 100).

    • Length Check: Confirms that an input string has an exact character count or falls within an acceptable minimum and maximum length (e.g., passwords must be between 88 and 1212 characters).

    • Type Check: Confirms that input data matches the expected data type (e.g., ensuring an age field contains an integer, not a string).

    • Presence Check: Ensures that mandatory input fields are not left blank.

    • Format Check: Confirms that characters follow a predefined pattern (e.g., an identification code matching CUB9999).

    • Check Digit: A calculated validation digit appended to a code to detect typing errors.

  • Verification Techniques:

    • Methods to ensure that data has been entered accurately without alteration during transfer.

    • Double Entry: Data is entered twice (often by two different operators); the system compares both entries and flags any discrepancies.

    • Visual Check: The entered data is displayed back on the screen, prompting the user to manually verify it against the source document before confirming.

  • Test Data Classification:

    • Normal Data: Typical, valid values within acceptable boundaries that should process without errors.

    • Abnormal (Erroneous) Data: Invalid values that should be rejected by validation checks (e.g., entering letters into a numeric field).

    • Extreme Data: The boundary values that define the outer limits of acceptable normal data (e.g., for an accepted range of 0 to 1000\text{ to }100, the extreme values are 00 and 100100).

    • Boundary Data: The values on the boundary between valid and invalid inputs: one value is accepted (an extreme value), and the adjacent value outside the boundary is rejected (e.g., for a range of 0 to 1000\text{ to }100, boundary pairs are −1,0-1, 0 and 100,101100, 101).

Standard Algorithms and Solution Methods

  • Linear Search:

    • Examines each element in an array sequentially from start to finish until a target value is found or the end of the array is reached.

    • Works on unsorted and sorted datasets.

OUTPUT "Please enter name to find"
INPUT Name
Found ← FALSE
Counter ← 1
REPEAT
  IF Name = StudentName[Counter]
    THEN
      Found ← TRUE
    ELSE
      Counter ← Counter + 1
  ENDIF
UNTIL Found OR Counter > ClassSize
IF Found
  THEN
    OUTPUT Name, " found at position ", Counter
  ELSE
    OUTPUT Name, " not found"
ENDIF
  • Bubble Sort:

    • Iterates through an array, comparing adjacent elements and swapping them if they are out of order.

    • With each full pass, the largest unsorted value "bubbles" to its correct position at the end of the array.

    • Uses a Boolean flag (Swap) to detect when a pass completes with zero swaps, terminating the sort early.

First ← 1
Last ← 10
REPEAT
  Swap ← FALSE
  FOR Index ← First TO Last - 1
    IF Temperature[Index] > Temperature[Index + 1]
      THEN
        Temp ← Temperature[Index]
        Temperature[Index] ← Temperature[Index + 1]
        Temperature[Index + 1] ← Temp
        Swap ← TRUE
    ENDIF
  NEXT Index
  Last ← Last - 1
UNTIL (NOT Swap) OR Last = 1
  • Totalling, Counting, and Extremes:

    • Totalling: Initializes an accumulator variable to zero and adds values to it inside a loop.

    • Counting: Initializes a counter variable to zero and increments it by 11 each time a condition is met.

    • Maximum and Minimum: Initializes Max to the lowest possible value and Min to the highest possible value, or initializes both to the first element in the dataset, updating them whenever a higher or lower value is encountered.

Programming Concepts, Subroutines, and Data Structures

  • Data Types and Declarations:

    • Integer: Whole numbers without fractions (e.g., 25, -10).

    • Real: Numbers with fractional parts (e.g., 25.5, 3.142).

    • Char: A single character (e.g., 'F', '*').

    • String: A sequence of characters of variable length (e.g., "Computer Science").

    • Boolean: Represents truth values (TRUE or FALSE).

  • Variables and Constants:

    • Variables: Named memory locations whose values can change during program execution.

    • Constants: Named memory locations whose values remain fixed throughout program execution (e.g., CONSTANT PI ← 3.142).

  • Iteration Constructs:

    • Count-Controlled (FOR...TO...NEXT): Executes a fixed number of times using an automatically incrementing counter variable.

    • Pre-Condition (WHILE...DO...ENDWHILE): Evaluates a condition at the start of the loop; if the condition is false initially, the loop body does not execute.

    • Post-Condition (REPEAT...UNTIL): Evaluates a condition at the end of the loop; the loop body always executes at least once.

  • Subroutines: Procedures and Functions:

    • Procedures: Named blocks of code that execute a specific task without returning a value; invoked as standalone statements (e.g., CALL Stars(7)).

    • Functions: Named blocks of code that execute a task and return a calculated value to the calling statement; invoked within expressions (e.g., Temp ← Celsius(98.6)).

    • Parameters and Arguments: Parameters are variable placeholders defined in the subroutine header; arguments are the actual values passed into the parameters during the call.

    • Variable Scope:

    • Global Variables: Declared in the main program and accessible from anywhere within the code.

    • Local Variables: Declared within a specific subroutine and accessible only within that subroutine, protecting data from unintended changes.

  • One-Dimensional and Two-Dimensional Arrays:

    • One-Dimensional Arrays (Lists): A collection of elements of the same data type indexed along a single dimension (e.g., DECLARE MyList : ARRAY[0:9] OF INTEGER).

    • Two-Dimensional Arrays (Tables): A grid of elements of the same data type indexed by row and column coordinates (e.g., DECLARE MyTable : ARRAY[0:9, 0:2] OF INTEGER).

  • File Handling:

    • Provides non-volatile data storage across program sessions.

    • Open file modes: READ or WRITE.

    • Pseudocode syntax: OPENFILE <Filename> FOR WRITE, WRITEFILE <Filename>, <Data>, READFILE <Filename>, <Variable>, and CLOSEFILE <Filename>.

Database Systems and Structured Query Language (SQL)

  • Single-Table Databases:

    • A database stores structured data to enable efficient retrieval and prevent data duplication.

    • Table: A collection of related data records.

    • Record: A row in a database table containing data about a single item, person, or event.

    • Field: A column in a database table storing a specific attribute of each record.

    • Primary Key: A unique field chosen to uniquely identify each record in the table.

Database Validation Interface
  • Structured Query Language (SQL) Commands:

    • SELECT: Specifies the fields (columns) to retrieve. An asterisk (*) selects all fields.

    • FROM: Specifies the database table to query.

    • WHERE: Filters the records (rows) based on conditional criteria.

    • ORDER BY: Sorts results by a specified field in ascending (default) or descending (DESC) order.

    • SUM: Calculates the total of numeric values in a specified field.

    • COUNT: Counts the total number of records that match the query condition.

  • SQL Examples:

SELECT HospitalNumber, FirstName, FamilyName
FROM PATIENT
WHERE Consultant = 'Mr Smith'
ORDER BY FamilyName;
SELECT COUNT(HospitalNumber)
FROM PATIENT
WHERE WardNumber = 7;

Boolean Logic, Logic Gates, and Circuit Design

  • Standard Logic Gates:

    • NOT Gate: Inverts the single input. Output X=1X = 1 if input A=0A = 0.

    • Logic notation: X=NOT AX = \text{NOT } A

    • Boolean notation: X=A‾X = \overline{A}

    • AND Gate: Output X=1X = 1 only if both input A=1A = 1 and input B=1B = 1.

    • Logic notation: X=A AND BX = A \text{ AND } B

    • Boolean notation: X=A⋅BX = A \cdot B

    • OR Gate: Output X=1X = 1 if input A=1A = 1, input B=1B = 1, or both are 11.

    • Logic notation: X=A OR BX = A \text{ OR } B

    • Boolean notation: X=A+BX = A + B

    • NAND Gate: Inverts the AND result. Output X=1X = 1 if both inputs are NOT 11.

    • Logic notation: X=A NAND BX = A \text{ NAND } B

    • Boolean notation: X=A⋅B‾X = \overline{A \cdot B}

    • NOR Gate: Inverts the OR result. Output X=1X = 1 only if neither input AA nor input BB is 11.

    • Logic notation: X=A NOR BX = A \text{ NOR } B

    • Boolean notation: X=A+B‾X = \overline{A + B}

    • XOR Gate (Exclusive OR): Output X=1X = 1 if either input is 11, but not both.

    • Logic notation: X=A XOR BX = A \text{ XOR } B

    • Boolean notation: X=(A⋅B‾)+(A‾⋅B)X = (A \cdot \overline{B}) + (\overline{A} \cdot B)

  • Standard Truth Tables:

Input A

Input B

NOT A

A AND B

A OR B

A NAND B

A NOR B

A XOR B

0

0

1

0

0

1

1

0

0

1

1

0

1

1

0

1

1

0

0

0

1

1

0

1

1

1

0

1

1

0

0

0

  • Truth Table and Logic Circuit Synthesis:

    • When deriving a logic expression from a truth table, construct an AND condition for every row where the output is 11, then combine those conditions using OR operators (Sum of Products).

    • To create a logic circuit from a problem statement:

    • Identify the boolean conditions for each input parameter.

    • Combine the conditions using appropriate AND, OR, and NOT gates.

    • Connect the intermediate gate outputs to a final gate that drives the required system output.