MATSEC SEC Computing cheat sheet
MATSEC SEC Computing · Keep the key ideas within reach.
Computer Systems
CPU fetch-decode-execute cycle: fetch instruction from memory at the address in the program counter, decode the opcode, execute, then write back the result; the PC increments unless a jump occurs.
Von Neumann architecture shares one memory for data and instructions; Harvard architecture uses separate instruction and data memories, allowing simultaneous fetch.
Registers: PC holds the next instruction address, MAR holds the memory address being accessed, MDR holds the data transferred, ACC holds arithmetic results, CIR holds the current instruction.
Memory hierarchy by speed and cost per bit: registers > cache > RAM > SSD/HDD > optical/tape; cache exploits locality of reference (temporal and spatial).
Two's complement: invert all bits and add 1 to negate a value; an n-bit signed range is -2^(n-1) to 2^(n-1)-1.
Binary to hex: group bits in fours from the right; hex to binary: expand each hex digit to four bits. 1 KiB = 1024 bytes, 1 MiB = 1024 KiB.
Logic gates: AND outputs 1 only if all inputs are 1; OR outputs 1 if any input is 1; XOR outputs 1 if inputs differ; NOT inverts. NAND and NOR are universal gates.
RISC uses a small fixed-length instruction set with many registers; CISC uses variable-length, complex instructions. Pipelining overlaps instruction stages to raise throughput, not clock speed.
Primary storage is volatile RAM/ROM directly addressable by the CPU; secondary storage (HDD, SSD, optical) is non-volatile and accessed via I/O controllers.
Computer Networks and the Internet
TCP is connection-oriented with handshaking, sequencing, acknowledgements and retransmission; UDP is connectionless with no delivery guarantee but lower overhead.
IPv4 addresses are 32 bits written as four dotted decimal octets; IPv6 addresses are 128 bits written in hexadecimal groups. A /24 subnet mask leaves 8 host bits, giving 254 usable hosts.
DNS resolves domain names to IP addresses; DHCP assigns IP configuration automatically; NAT translates private addresses to a public address; ARP maps an IP address to a MAC address on a LAN.
OSI layers (bottom-up): Physical, Data Link, Network, Transport, Session, Presentation, Application. TCP/IP model: Link, Internet, Transport, Application.
Private IPv4 ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16. Loopback is 127.0.0.1.
HTTP is a stateless request-response protocol; HTTPS adds TLS encryption. Common ports: HTTP 80, HTTPS 443, FTP 21, SMTP 25, DNS 53, SSH 22.
Star topology uses a central switch and fails only at that node; mesh offers redundant paths at higher cabling cost; bus shares one backbone and suffers collisions.
Bandwidth is capacity in bits per second; latency is delay in milliseconds. Throughput is limited by the slowest link in the path.
A firewall filters traffic by rules (address, port, protocol); a proxy intermediates client requests; encryption protects confidentiality in transit.
Algorithms
Linear search is O(n); binary search is O(log n) but requires a sorted array and random access.
Bubble, insertion and selection sort are O(n^2); merge sort and heap sort are O(n log n); quicksort averages O(n log n) but degrades to O(n^2) on poor pivots.
Big-O describes an upper bound on growth; O(1) < O(log n) < O(n) < O(n log n) < O(n^2) < O(2^n).
A stack is LIFO (push/pop); a queue is FIFO (enqueue/dequeue); a deque allows insertion and removal at both ends.
A binary search tree stores smaller keys left and larger keys right; search, insert and delete are O(log n) when balanced, O(n) when degenerate.
A hash table maps keys to buckets via a hash function; average lookup is O(1), degraded by collisions handled by chaining or open addressing.
Graph traversal: BFS uses a queue and finds shortest paths in unweighted graphs; DFS uses a stack or recursion and suits cycle detection and topological sorting.
Recursion needs a base case and a recursive case that moves toward it; each call consumes stack memory, so deep recursion risks stack overflow.
Dijkstra's algorithm finds shortest paths from a source in graphs with non-negative weights; a greedy algorithm makes the locally best choice at each step.
Programming and Software Development
Data types: integer, real/float, Boolean, character, string. Strong typing rejects implicit incompatible conversions; weak typing permits them.
Sequence, selection (if/else, switch) and iteration (for, while, do-while) are the three control structures; a do-while always executes the body at least once.
Scope rules: a local variable exists only within its block; a global variable is visible throughout the module. Parameters pass by value (copy) or by reference (address).
A function returns one value and should have a single clear purpose; a procedure performs an action without returning a value.
Compilers translate the whole source to machine code before execution; interpreters translate and execute line by line; both detect syntax errors, but only runtime testing finds logic errors.
Software development life cycle stages: requirements analysis, design, implementation, testing, deployment, maintenance. Waterfall is sequential; Agile is iterative and incremental.
Testing levels: unit (single module), integration (modules combined), system (whole system against requirements), acceptance (user validation). Black-box tests inputs/outputs; white-box tests code paths.
Validation checks input is sensible (range, type, presence, length); verification checks data matches the original source.
Pseudocode and flowcharts document algorithms before coding; flowchart symbols: oval for start/end, parallelogram for input/output, rectangle for process, diamond for decision.
Data, Databases and Emerging Technologies
A relational database stores data in tables (relations) of rows (records) and columns (fields); a primary key uniquely identifies a row and cannot be null.
A foreign key references a primary key in another table and enforces referential integrity; it may be null unless declared otherwise.
Normalisation: 1NF removes repeating groups; 2NF removes partial dependencies on part of a composite key; 3NF removes transitive dependencies on non-key attributes.
SQL clauses run in the order FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY; WHERE filters rows before grouping, HAVING filters groups after aggregation.
Aggregate functions: COUNT, SUM, AVG, MIN, MAX. DISTINCT removes duplicate rows; JOIN combines rows from related tables on a matching condition.
Data validation and verification protect integrity; a DBMS enforces constraints, controls concurrent access and provides backup and recovery.
Flat-file storage duplicates data and risks inconsistency; relational databases reduce redundancy through normalisation and relationships.
Emerging technologies: cloud computing (IaaS, PaaS, SaaS), IoT sensor networks, machine learning, blockchain as a distributed ledger, and quantum computing using qubits.
Artificial intelligence systems learn patterns from data; bias in training data produces biased outputs, so data quality and human oversight matter.
Computer Systems
CPU fetch-decode-execute cycle: fetch instruction from memory at the address in the program counter, decode the opcode, execute, then write back the result; the PC increments unless a jump occurs.
Von Neumann architecture shares one memory for data and instructions; Harvard architecture uses separate instruction and data memories, allowing simultaneous fetch.
Registers: PC holds the next instruction address, MAR holds the memory address being accessed, MDR holds the data transferred, ACC holds arithmetic results, CIR holds the current instruction.
Memory hierarchy by speed and cost per bit: registers > cache > RAM > SSD/HDD > optical/tape; cache exploits locality of reference (temporal and spatial).
Two's complement: invert all bits and add 1 to negate a value; an n-bit signed range is -2^(n-1) to 2^(n-1)-1.
Binary to hex: group bits in fours from the right; hex to binary: expand each hex digit to four bits. 1 KiB = 1024 bytes, 1 MiB = 1024 KiB.
Logic gates: AND outputs 1 only if all inputs are 1; OR outputs 1 if any input is 1; XOR outputs 1 if inputs differ; NOT inverts. NAND and NOR are universal gates.
RISC uses a small fixed-length instruction set with many registers; CISC uses variable-length, complex instructions. Pipelining overlaps instruction stages to raise throughput, not clock speed.
Primary storage is volatile RAM/ROM directly addressable by the CPU; secondary storage (HDD, SSD, optical) is non-volatile and accessed via I/O controllers.
Computer Networks and the Internet
TCP is connection-oriented with handshaking, sequencing, acknowledgements and retransmission; UDP is connectionless with no delivery guarantee but lower overhead.
IPv4 addresses are 32 bits written as four dotted decimal octets; IPv6 addresses are 128 bits written in hexadecimal groups. A /24 subnet mask leaves 8 host bits, giving 254 usable hosts.
DNS resolves domain names to IP addresses; DHCP assigns IP configuration automatically; NAT translates private addresses to a public address; ARP maps an IP address to a MAC address on a LAN.
OSI layers (bottom-up): Physical, Data Link, Network, Transport, Session, Presentation, Application. TCP/IP model: Link, Internet, Transport, Application.
Private IPv4 ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16. Loopback is 127.0.0.1.
HTTP is a stateless request-response protocol; HTTPS adds TLS encryption. Common ports: HTTP 80, HTTPS 443, FTP 21, SMTP 25, DNS 53, SSH 22.
Star topology uses a central switch and fails only at that node; mesh offers redundant paths at higher cabling cost; bus shares one backbone and suffers collisions.
Bandwidth is capacity in bits per second; latency is delay in milliseconds. Throughput is limited by the slowest link in the path.
A firewall filters traffic by rules (address, port, protocol); a proxy intermediates client requests; encryption protects confidentiality in transit.
Algorithms
Linear search is O(n); binary search is O(log n) but requires a sorted array and random access.
Bubble, insertion and selection sort are O(n^2); merge sort and heap sort are O(n log n); quicksort averages O(n log n) but degrades to O(n^2) on poor pivots.
Big-O describes an upper bound on growth; O(1) < O(log n) < O(n) < O(n log n) < O(n^2) < O(2^n).
A stack is LIFO (push/pop); a queue is FIFO (enqueue/dequeue); a deque allows insertion and removal at both ends.
A binary search tree stores smaller keys left and larger keys right; search, insert and delete are O(log n) when balanced, O(n) when degenerate.
A hash table maps keys to buckets via a hash function; average lookup is O(1), degraded by collisions handled by chaining or open addressing.
Graph traversal: BFS uses a queue and finds shortest paths in unweighted graphs; DFS uses a stack or recursion and suits cycle detection and topological sorting.
Recursion needs a base case and a recursive case that moves toward it; each call consumes stack memory, so deep recursion risks stack overflow.
Dijkstra's algorithm finds shortest paths from a source in graphs with non-negative weights; a greedy algorithm makes the locally best choice at each step.
Programming and Software Development
Data types: integer, real/float, Boolean, character, string. Strong typing rejects implicit incompatible conversions; weak typing permits them.
Sequence, selection (if/else, switch) and iteration (for, while, do-while) are the three control structures; a do-while always executes the body at least once.
Scope rules: a local variable exists only within its block; a global variable is visible throughout the module. Parameters pass by value (copy) or by reference (address).
A function returns one value and should have a single clear purpose; a procedure performs an action without returning a value.
Compilers translate the whole source to machine code before execution; interpreters translate and execute line by line; both detect syntax errors, but only runtime testing finds logic errors.
Software development life cycle stages: requirements analysis, design, implementation, testing, deployment, maintenance. Waterfall is sequential; Agile is iterative and incremental.
Testing levels: unit (single module), integration (modules combined), system (whole system against requirements), acceptance (user validation). Black-box tests inputs/outputs; white-box tests code paths.
Validation checks input is sensible (range, type, presence, length); verification checks data matches the original source.
Pseudocode and flowcharts document algorithms before coding; flowchart symbols: oval for start/end, parallelogram for input/output, rectangle for process, diamond for decision.
Data, Databases and Emerging Technologies
A relational database stores data in tables (relations) of rows (records) and columns (fields); a primary key uniquely identifies a row and cannot be null.
A foreign key references a primary key in another table and enforces referential integrity; it may be null unless declared otherwise.
Normalisation: 1NF removes repeating groups; 2NF removes partial dependencies on part of a composite key; 3NF removes transitive dependencies on non-key attributes.
SQL clauses run in the order FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY; WHERE filters rows before grouping, HAVING filters groups after aggregation.
Aggregate functions: COUNT, SUM, AVG, MIN, MAX. DISTINCT removes duplicate rows; JOIN combines rows from related tables on a matching condition.
Data validation and verification protect integrity; a DBMS enforces constraints, controls concurrent access and provides backup and recovery.
Flat-file storage duplicates data and risks inconsistency; relational databases reduce redundancy through normalisation and relationships.
Emerging technologies: cloud computing (IaaS, PaaS, SaaS), IoT sensor networks, machine learning, blockchain as a distributed ledger, and quantum computing using qubits.
Artificial intelligence systems learn patterns from data; bias in training data produces biased outputs, so data quality and human oversight matter.