Computer Science · Quick Reference

Computer Science Reference Sheet

A compact revision guide covering essential concepts from programming, algorithms, data representation, databases, networking, operating systems, cybersecurity, and artificial intelligence.

Use the search box to find a topic or select Print to save a paper or PDF copy.

Showing all sections.

1. Computer Science Fundamentals

Hardware Physical components, such as the CPU, RAM, keyboard, and storage drive.
Software Programs and instructions that tell a computer what to do.
Input Data or commands supplied to a system.
Processing Operations performed on data.
Output Results produced by a system.
Storage Retaining data for later use.

Common units

UnitMeaning
bit (b)A binary digit: 0 or 1.
byte (B)8 bits.
kilobyte (kB)1,000 bytes.
megabyte (MB)1,000,000 bytes.
gigabyte (GB)1,000,000,000 bytes.
kibibyte (KiB)1,024 bytes.
mebibyte (MiB)1,024 KiB.
gibibyte (GiB)1,024 MiB.
Lowercase b usually means bits; uppercase B means bytes. Storage manufacturers commonly use decimal units, while some operating systems display binary quantities using familiar labels.

2. Number Systems and Data Representation

SystemBaseAllowed digits
Binary20, 1
Octal80–7
Decimal100–9
Hexadecimal160–9, A–F

Place-value rule

For a number written in base \(b\), each digit is multiplied by a power of \(b\) according to its position.

Example:
(1011)₂ = 1×2³ + 0×2² + 1×2¹ + 1×2⁰
        = 8 + 0 + 2 + 1
        = (11)₁₀

Useful conversions

DecimalBinaryOctalHexadecimal
10101012A
15111117F
16100002010
25110013119
321000004020

Binary addition rules

0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10  (write 0, carry 1)
1 + 1 + 1 = 11  (write 1, carry 1)

Two's complement

Two's complement is commonly used to represent signed integers in binary. For an \(n\)-bit value, its signed range is \(-2^{n-1}\) to \(2^{n-1}-1\).

For example, an 8-bit two's-complement integer ranges from −128 to 127.

3. Programming Fundamentals

ConceptPurpose
VariableNames a value that may change.
ConstantRepresents a value intended not to change.
Data typeDefines the kind of value and supported operations.
ConditionSelects a path according to a test.
LoopRepeats a block of instructions.
FunctionPackages reusable behaviour, optionally with inputs and a return value.
Array / listStores a collection of values.
DebuggingFinds and fixes problems in a program.

Common data types

Control structures

Sequence: instructions run in order.

Selection:
if condition:
    do one action
else:
    do another action

Iteration:
repeat an action while a condition is true.
Syntax differs between programming languages. The examples above describe concepts rather than a complete program in a specific language.

4. Algorithms and Complexity

An algorithm is a finite, well-defined sequence of steps for solving a problem or performing a computation.

Core properties

Common Big-O growth rates

ComplexityNameTypical example
O(1)ConstantArray access by index, under the usual model.
O(log n)LogarithmicBinary search on sorted data.
O(n)LinearScanning a list once.
O(n log n)LinearithmicCommon efficient comparison sorting algorithms.
O(n²)QuadraticTwo nested loops over the same input size.
O(2ⁿ)ExponentialSome exhaustive recursive search approaches.
Big-O describes how resource use grows with input size, typically expressing an upper bound while ignoring constant factors. Actual performance also depends on implementation and hardware.

Searching and sorting

5. Data Structures

StructureOrganisationCommon use
ArrayIndexed sequenceFast indexed access.
Linked listNodes linked by referencesInsertions and deletions when the relevant position is known.
StackLIFOUndo operations, function calls.
QueueFIFOTask scheduling, waiting lines.
TreeHierarchical nodesHierarchies and search structures.
GraphVertices and edgesRoads, networks, relationships.
Hash tableKeys mapped to buckets or slotsFast average-case lookup by key.

LIFO: Last In, First Out. FIFO: First In, First Out.

Typical operation costs

StructureTypical operationTypical cost
ArrayAccess by indexO(1)
ArraySearch unsorted valuesO(n)
StackPush / popO(1)
QueueEnqueue / dequeueO(1) with a suitable implementation
Hash tableLookupO(1) average case; O(n) worst case in common implementations
Balanced search treeSearch / insert / deleteO(log n)

These costs assume typical implementations and conditions; they are not guarantees for every implementation.

6. Databases and SQL

Common SQL commands

CommandPurpose
SELECTReads data.
INSERTAdds rows.
UPDATEChanges existing rows.
DELETERemoves rows.
CREATECreates database objects.
ALTERChanges an object's definition.
DROPRemoves a database object.

Example query

SELECT name, marks
FROM students
WHERE marks >= 80
ORDER BY marks DESC;

Useful aggregate functions

COUNT(), SUM(), AVG(), MIN(), and MAX().

ACID transactions

7. Computer Networks

Network types

Devices

DeviceMain role
RouterForwards packets between networks.
SwitchForwards frames within a local network using MAC addresses.
Access pointConnects wireless devices to a network.
ModemAdapts signals for a particular communication link or access technology.
FirewallAllows or blocks traffic according to security rules.

Common protocols

ProtocolPurpose
IPAddresses and routes packets between networks.
TCPProvides a reliable, ordered byte stream between endpoints.
UDPProvides datagrams without TCP's built-in delivery and ordering guarantees.
DNSResolves domain names to records such as IP addresses.
HTTP / HTTPSProtocols used for web communication; HTTPS protects HTTP with TLS.
DHCPAutomatically provides network configuration to clients.
SMTPUsed to send and relay email.
SSHProvides secure remote login and other secure communication features.

Performance terms

8. Operating Systems

Process states

New → Ready → Running → Terminated
             ^      |
             |      v
             └── Waiting

Scheduling algorithms

Deadlock conditions

  1. Mutual exclusion.
  2. Hold and wait.
  3. No preemption.
  4. Circular wait.

9. Cybersecurity and Digital Safety

The CIA triad

Essential terms

TermMeaning
PhishingDeceptive messages intended to manipulate recipients.
MalwareSoftware designed for malicious or unauthorized purposes.
EncryptionTransforms data so it can be read only with the appropriate decryption capability.
HashingMaps data to a fixed-size digest using a hash function.
MFAAuthentication using two or more different factor types.
FirewallFilters traffic according to configured rules.
BackupA separate copy of data used for recovery.

Good security habits

10. Artificial Intelligence Fundamentals

Key terms

Artificial intelligence The broad field of systems performing tasks associated with intelligent behaviour.
Machine learning Methods that learn patterns from data.
Deep learning Machine learning based on multilayer neural networks.
Dataset A collection of examples or observations.
Training Fitting a model using a learning procedure.
Inference Using a model to produce an output.
Generative AI AI that creates content such as text, images, audio, or code.
Overfitting Fitting training examples too closely and generalising poorly.

Learning approaches

Common evaluation metrics

AI outputs can be incorrect or biased. Evaluate models on suitable data, check important claims, protect private information, and use appropriate human oversight.

11. Quick Revision Checklist

Use this list to check which concepts you can already explain.