0% found this document useful (0 votes)
13 views

Aqa A Level Computer Science Theory v1

Uploaded by

Feather Cloud
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Aqa A Level Computer Science Theory v1

Uploaded by

Feather Cloud
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

ZNOTES.

ORG

UPDATED TO 2015 SYLLABUS

AQA A LEVEL
COMPUTER
SCIENCE
SUMMARIZED NOTES ON THE THEORY SYLLABUS
AQA A LEVEL COMPUTER SCIENCE

Why: shorthand for binary, as 2 hex digits can


represent a byte. Requires less digits than binary,
1. Data Representation takes up less screen space, easier for humans to
understand than binary strings
Uses: HTML hex colour codes, MAC addresses,
1.1. Number Systems
memory dumps, error messages
Natural Numbers: base 10 numbers used for everyday Base 16: #₁₆
counting. Positive integers for 0 to ∞ Binary → Decimal using binary columns, add up all values
Uses: counter in processor, identify location of data in that have a 1 underneath.
a structure, score variables, counting Decimal → Binary using binary columns, see if value will
fit under most significant column, then repeat with
N = (0, 1, 2, 3, 4 …) remainder and next column. Or, start with the least
significant column and divide by 2 each time. If remainder
Integer Numbers: whole numbers (no fractional part) that is 0, then 0 is placed in the column.
can be positive or negative Decimal → Hex convert to binary, split into nibbles, then
turn each nibble into hex, and push values together.
Z = (… − 3, −2, −1, 0, 1, 2, 3, 4 …) Hex → Decimal take each hex value, turn it into binary,
Rational Numbers: can be expressed fractionally, (as then push the nibbles of binary together. Turn binary into
quotients). Quotients can equal 1 ( 5/5=1 ), so all integers decimal.
are rational.
Denominator cannot be 0 1.3. Units of Information
Q = (1/3, 1/2, 3/4 …) Bit: the fundamental unit of information, that is either 0
or 1
Irrational Numbers: values after decimal place do not
0 is off, and 1 is on
repeat. Cannot be represented as a ratio between two
Binary Digit
integers.
Byte: a group of 8 bits
Programmer needs to decide how many decimal
2n values represented with n bits: where n is the number
places to use
of bits used, 2n is the number of possible combinations
Eg. √2 or π
Eg. 2³ = 8, so with 3 bits, there are 8 combinations
Real Numbers: any positive or negative number, with or
Units: binary increments in 1024. Decimal units
without a fractional part. Fractional part can be any
increment in 1000
length, allowing any level of precision/accuracy
In the past, kilobyte has been used to mean kibibyte
R defines possible real-world quantities
(1024 bits)
Uses: measurements, CNC, time, robotics, data
control systems Binary (US definition) Decimal (EU definition)
Ordinal Numbers: number used to identify position
kibibyte Ki 2¹⁰ kilobyte k 10³
relative to other numbers
Cardinal Numbers: a number that defines the size of
mebibyte Mi 2²⁰ megabyte M 10⁶
something gibibyte Gi 2³⁰ gigabyte G 10⁹
Well Ordered Set: a group of related numbers with a tebibyte Ti 2⁴⁰ terabyte T 10¹²
defined order

1.4. Binary Number System


1.2. Number Bases
Unsigned Binary
‘Number base’ defines how many digits are used to represent
a number. Binary that only represents positive whole numbers
Minimum value (for n bits) = 0
Decimal: uses 10 digits (0 → 9) and increases by powers
Maximum value (for n bits) = 2n-1
of 10
eg. maximum number in 8 bits = (2⁸-1) = 255
Uses: humans for counting
Signed binary: binary that represents a positive or
Base 10: #₁₀
negative whole number
Binary: uses 2 digits (0 and 1)
Adding unsigned binary: add the two numbers together
Uses: computers, because electronic gates can only
in binary
be open or closed
Carrying a 1: where the answer of 1+1 = 10, or 1+1+1
Base 2: #₂
= 11
Hexadecimal: used 16 digits (0 → F)

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

00110010 00010100
10110101 + 11110011 +
11100111 ANSWER 00000111 ANSWER
11 carry 111 carry

Multiplying unsigned binary: multiply the binary by the The answer can be checked by converting the final
first digit of the second number. Repeat for the next digit, answer into denary
shifting the answer along by 1. Then add the resultant In this case there is an overflow bit. It is handled
numbers together for the answer. separately to the calculation
Calculate range: using 8 bits, 256 numbers can be
11011 represented (-128 to 127)
11 * Arbitrary number of bits: 2n numbers can be represented
11011 Unsigned binary: 2n-1 (as 0 is representable)
110110 + Two’s complement range
1010001 ANSWER Minimum representable value = (-2n-1)
Maximum representable value (2n-1-1)
1111 carry
Fractional Parts
Two’s Complement (Signed Binary)
Fixed point
A method that can be used to represent negative
integers, where the most significant bit is negative. Representing a fractional part using a fixed decimal point.
After the point, digits become fractions
Converting to denary Smallest representable number using 8-bit fixed point
is 0000.0001 = 1/16 = 0.0625. 256 combinations can
An 8-bit two’s complement number has -128 as the most be produced.
significant bit.
Write out denary equivalents (with sufficient columns 8 4 2 1 1/2 ¼ 1/8 1/16 ANS
(doubles each time) for the length of the binary string) 0 1 1 0 0 1 1 0 6.375 or   6 3/8
Enter binary string in (eg. 10011100)
Add up values (eg. = -100)
Negative numbers can be made by making the MSB
negative.
-128 64 32 16 8 4 2 1 ANS
eg. (-8) + 4 + 2 + ½ + ¼ = -1.25
1 0 0 1 1 1 0 0 -100
-8 4 2 1 1/2 1/4 1/8 1/16 ANS
Converting from denary 1 1 1 0 1 1 0 0 -1.25 or   -1¼

Flip the bits and add 1


Write out the positive binary equivalent
Floating point
eg. +102 = 01100110
Representation of number where the decimal/binary
Flip all bits
point moves. Uses two’s complement
Perform binary addition with 1 to get the answer
Mantissa: represents the significant digits (actual
value)
-128 64 32 16 8 4 2 1 ANS
Exponent: represents the power to which a number is
1 0 0 1 1 0 0 1 -103 raised to (how many places the point is to move)
Floating point to decimal: 00001100  0011
10011001 Work out the exponent. If it is negative, the point in
1 + the mantissa moves to the left. If positive, move to the
10011010 ANSWER = -102 right.
0011 = +3
1 carry
|0|●→|0→|0→|0|1|1|0|0|
Computers can only add binary, so to perform the |0|0|0|0|●|1|1|0|0|
calculation 20 - 13 = 20 + (-13) o Add column headings to the mantissa and work out the
20 = 00010100 value. Any columns after the point are fractional.
-13 = 11110011 -8 4 2 1 ● 0.5 0.25 0.125 0.0625
0 0 0 0 1 1 0 0

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

o0.5 + 0.25 = 0.75 -128 64 32 16 8 4 2 1 ANS


1 0 0 0 0 0 0 0
Decimal to floating point: -10.5
Write out positive fixed point representation
1.6. Floating Point vs. Fixed Point
-16 8 4 2 1 0.5 0.25 0.125
0 1 0 1 0 ● 1 0 0 Range
Floating point can represent a wider range of
o Flip the bits and add 1 to get number into two’s numbers with same number of bits as fixed point
complement Precision
-16 8 4 2 1 0.5 0.25 0.125 Fixed point’s absolute error does not change between
1 0 1 0 1 ● 1 0 0 numbers, so retains precision
Precision can vary with floating point, as the binary
point does not have a fixed position
o Normalise the number by moving the point so that it starts
Speed of calculation
in 10 (for a positive number; 01)
Fixed point quicker to process, as the binary point
|1|●|0|1|0|1|1|0|0|
does not need to be moved for each number
o Fill in mantissa and exponent (number of places the point
moved)
Normalisation of Floating Point
|1|0|1|0|1|1|0|0| |1|0|0|

Normalisation adjusts numbers onto a common scale


1.5. Binary Errors that represents them as accurately as possible relative to
the number of bits available
Rounding errors: it is not possible to represent every Ensures that there is only one way to represent a number
decimal number, because fractions are being used –the Positive normalised: must start with 0.1
representation of some numbers may be inaccurate. Negative normalised: must start with 1.0
eg. 0.95 = 19/20. The binary progression of fractions
allows us to get close, but never exact.
Some numbers (0.110) can never be accurately
1.7. Coding Systems
represented.
Absolute rounding errors: the difference between the
Character Form of Decimal
value intended to be stored, and the actual value that can
Each character has a character code, which is its
be stored.
representation in binary
Eg. 6.95 (target value) – 6.9375 (actual) = 0.0125
Decimal numbers can be represented either with a
Relative rounding errors: percentage difference between
character code or in pure binary
actual result and the expected result
Character Code: used just to represent a number, where
relative error=  (absolute value)/(number intended to
the actual value is not crucial, like in a phone number
be stored)
Pure Binary: used to represent a number when
Eg.   0.0125/6.95  ×100=0.18%
calculations need to be performed, and the decimal
number will equal the binary value
Underflow and Overflow

Will cause erroneous results or a program crash. Can be


ASCII and Unicode
dealt with using flags
ASCII: American Standard Code for Information
Underflow: when a number is too small to be
Interchange. Introduced as a standard binary coding
represented with the number of bits allocated
system for characters and numbers
Example: representing 1/32 is impossible using 8-bit
Standard: 7-bit code gives 128 permutations
fixed point numbers – smallest that can be
Extended: 8-bit code gives 256 permutations
represented is 1/16
Limitations: 256 characters not enough, no multi-
lingual support, web use requires universal coding
8 4 2 1 1/2 1/4 1/8 1/16 ANS
system, new programs need wider character range
0 0 0 0 0 0 0 1 1/16
Unicode: standard binary coding system that has
surpassed ASCII since it allows for more permutations
Overflow: when a number is too big to be represented and hence more characters/languages. ASCII was
with the number of bits allocated absorbed into Unicode, so all original codes remain the
Example: adding 00000001 (1) and 01111111 (127) same
would produce 10000000 (128), but in two’s UTF-16: 16-bit code allows characters for 20+
complement, the answer would be -128 countries, special characters and emojis

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

Vital in the age of international communication so Analogue: uses continuously values which produces a
that data does not arrive corrupted continuously changing waveform
Digital: discrete (discontinuous) values to represent
1.8. Error Checking and Correction values
ADC: an analogue to digital converter turns real world
Parity Bits: an additional bit added onto a binary string to continuously changing waveforms into a digital signals for
make total number of 1s/0s even or odd. In a byte, 7 bits computers
are sent + the additional parity bit Samples analogue signals at set time values and
Even Parity: parity bit added to make total number of records amplitude
1s an even number. Checked on receiving end Quantization rounds amplitude up or down so value
Odd Parity: parity bit added to make total number of fits in bit resolution
1s an odd number. Checked on receiving end Required so that computers can interpret the
Majority Voting: each bit in a binary code is sent a set analogue signals that sensors produce
number of times, and then checking if the binary digit is DAC: turns a digital signal into an analogue waveform
the same each time. that real world devices can use
10 sent as [4] = 11110000 Required to turn a digital audio signal into an
An invalid transmission of 10 as [4] could be: analogue signal for speakers
11010001
Checksums: is the result of a cryptographic hash function 1.10. Images
ran on a piece of data to return a value. If the value
returned is equal to the value provided by the source Bitmapped Graphics
data, then transmission was successful
Check Digits: digit is added on the end of binary data to Pixel: the smallest picture element of an image
check it is accurate. Modulo-11 is a common way to Pixel Grid: a bitmap image is made up of a grid of many
calculate a check digit pixels. Each pixel is assigned a binary value that controls
Eg. 23045 is sent as 230456, so check digit is added, its colour
and then ‘modded’ until the value reaches 0. If Resolution: an image’s size. Can be represented by
calculation performed on receiving end does not Pixels/Dots Per Inch, which is how many pixels/dots there
match, and error message is created are in each square inch

resolution = width × height(inpixels)


1.9. Encoding with Binary
pixelsnumber = width × height × dotsperinch
Bit Patterns
Colour Depth: depends on the number of bits/bytes
A bit pattern can represent: assigned to represent a pixel’s colour. Representing a
Binary digit/signed binary digit pixel with a byte (8 bits) gives 256 possible colours (2⁸ =
Character code 256)
Pixel of a picture Storage = resolution x colour depth
Note in a sound field Metadata: bitmap graphic contains file information in a
Length of a line header such as; width, height, colour depth, camera,
Volume of a note location, date and time…
A string of binary represents an electrical signal that is Storage requirement = colour depth x number of pixels
either high or low. The electrical signal first needs to be
turned into a digital signal, which can then be interpreted Vector Graphics
into the appropriate form of data
Representation: made up of objects and coordinates so
graphic is mathematically controlled
The properties for each object in the graphic are
stored in a list
Width of line
Start/end coordinate points
Colour
Allows the graphic to be recreated at any size and
editing of the file
Object Properties: objects such as shapes and lines have
x and y starting coordinates and a direction of path. Each
Analogue and Digital

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

path then has values for stroke colour, shape, curve, When to play/stop a note
thickness, fill colour… Note length/volume/velocity/pitch
Effects to apply to notes
Bitmap Vectors Timing notes to play with other sounds/notes or with
Common file types, other MIDI devices
Small file size,
allows any Advantages
Advantages complete scalability
complexity, suited for Smaller file size than a pure sound file – load faster
with no quality loss
popular IO devices Fully editable – each note/instrument can be changed
Memory intensive, Cannot reproduce Supports a huge range of instruments
Disadvantages when enlarged, continuous tone, may High quality and authentic sound/instrument
pixilation occurs need special software reproduction

Photographs, Logos, business


Use scanned images, cards, large print 1.12. Data Compression
exported vector files posters
Data compression reduces the number of bits required to
represent data, so the file takes up less space
1.11. Sound Images and video are often compressed as they take
up a lot of storage, but text files can also be
Digital Representation of Sound compressed
Lossless: data can be accurately and exactly reproduced.
Analogue sound waves must be sampled to turn them No data is lost
into digital waves. Since analogue signals vary Run Length Encoding: sequences of the same
continuously, readings must be taken at fixed intervals repeated data are stored as a single data value and a
Sample resolution: how many intervals of amplitude are count
recorded Works on binary, pixel and character levels
Sampling rate: number of samples taken per second Eg: BBBBAAC = B4 A2 C1
Dictionary Encoding: stores language patterns and
commonly used phrases in a dictionary, that are then
referenced
Tokens are assigned to common text snippets,
and then included in the compressed data
Needed for program code, text files, where data
loss is disastrous
Lossy: data degradation occurs. Produces smaller file
than lossless, but data is lost, quality normally OK
Sound: perceptual coding removes frequencies which
are less audible to humans, and less crucial
Nyquist’s Theorem: sampling rate should be at least Pictures: grouping of like colours together in blocks,
double the highest frequency desired so less colour data must be stored
Ensures complete coverage of peaks and troughs in Video: interframe compression keeps stationary pixels
the analogue signal – allowing faithful sound the same, just continues to show them, while only
reproduction refreshing pixels that have moved. Temporal/Spatial
Since the upper frequency for humans is 20,000Hz, redundancy keeps blocks of pixels that are the same
the analogue frequency must be sampled at 40,000Hz between/within a frame
Used on pictures, video and sound where data
f ilesize = f requency × bitdepth × duration
retention is not crucial. Cannot return to original
Frequency is the frequency of the sample rate
1.13. Encryption
MIDI
The process of turning plaintext into scrambled
Purpose: protocol for recording and playing back music, ciphertext that can only be understood if decrypted. It is
or controlling devices. Instead of direct sound vital to protect data, especially internet transactions
representation, it transmits data to control how sounds Cipher: a disguised way of writing
are produced Plaintext: text or data in a human-readable/
Event messages: control the properties of a sound in a understandable form
file – recorded in binary to communicate between a MIDI Ciphertext: encrypted scrambled data that cannot be
device and the processor understood without decrypting

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

Key: data used to encrypt/decrypt


2.1. Hardware and Software
Transposition Cipher: moves characters to create an
anagram
Relationship
Substitution Cipher: characters are substituted for others
Caesar Cipher: substitution cipher where one letter in an
Hardware and software work together to create a
alphabet is mapped directly onto another in an alphabet
computer system. Without either, they would be useless
that has been shifted Hardware: physical components of a computer system
Easily cracked with frequency analysis, which assumes Software: any executable program (set of instructions) on
that the most common cipher characters match with
a computer system
the most common letters in the origin language. One-
to-one character relationship makes it easy to crack, Classification of Software
different shifts can be tested. Further complexity is
added when it is polyalphabetic Application Software: programs to perform user specific
Transposition Cipher tasks that are not related to the computer’s operation
Rail fence: message is split across several rows of a Email, word processing, calculations etc…
grid, where each letter is on the next row down and System Software: programs to set up and run the
column. Encrypted message is formed by reading one computer. Many aspects are invisible to the user.
row at a time Supports the application software
Route: message fills a grid of set size, working down in
columns. Encrypted message is read off row-by-row. System Software
For added security, transpose then substitute
Vernam Cipher: uses a one-time pad (key that is Operating Systems: a collection of software that links
discarded after encrypting/decrypting). Key is chosen together the hardware and applications to hide the true
uniformly and randomly, so cipher text distributed complexity of a computer system from the user and other
uniformly software in a virtual machine
1. Random key of letters created that is the same
length as the message
2. Each character in the message and key’s Baudot
code are XORed together to produce another code
3. New Baudot code turned into character and
added to encrypted string
Secure, as without the key, letters could be anything,
and frequency analysis can’t be used, due to the
randomly generated key
Perfect security, as regardless of time, it can’t be
cracked. However perfect is unlikely due to: random
generation is imperfect, key exchange might be
intercepted, cannot authenticate sender/receiver
Vernam Cipher is the only mathematically proved,
completely secure method. All other ciphers rely on
computational security
Computational Security: concept of how secure data Utility Programs: maintain or enhance the computer’s
encryption is. Computational hardness is the degree of operation, computer can however run without them
difficulty in cracking a cipher. If an encryption method is eg: Anti-Virus, Defragmentation, Back-Up software
computationally secure, it may be crack able, just not in a Libraries: a collection of frequently used routines that can
be called by other programs. In Windows, DLL files are
useful timescale. Only one-time pad (Vernam) cipher is
used and loaded as required
completely secure. Given enough time and ciphertext,
any other can be broken Contain functions such as saving and displaying text
Cracking methods: Translators: convert programs into executable machine
assessing common techniques, code that the computer can understand
dictionary attacks, Assembler, Compiler and Interpreter
reverse engineering,
brute force. 2.2. Programming Languages
Low level languages
2. Fundamentals of Computer Machine Code
Lowest level of code, 0s and 1s. Written in binary,
Systems based on CPUs instruction set. Every language is

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

translated to Machine Code statement


Characteristics: high risk of input errors, hard to
find errors, not portable to different architectures, Advantages Disadvantages
long Sections can be run at a time, Source code must be
Uses: where fast execution or direct processor not whole program – since distributed· Inefficient - each
access is needed line-by-line line translated each time
Assembly Code: one-to-one relationship with machine Can only translate on a
code, uses abbreviated codes for instructions Portable since translated
computer with the same
Characteristics: not portable, one-to-one each time
interpreter
relationship, quick execution, compact due to
Used during development
optimisation, high level manipulation of processor
registers
Byte Code: an intermediate language between a high
Uses: real time applications (vital fast response),
level language and machine code
device drivers, embedded systems (direct
Requires a virtual machine to turn byte code into
hardware manipulation)
platform specific machine code
High level languages
Java example:
Procedural (Imperative): computer follows a list of
.java files can be written and compiled on any
instructions, every time
machine using the Java IDE
Characteristics: process focussed, subroutines,
Java IDE compiles bytecode .class file
open data sharing
Bytecode can be sent to any machine
Uses: first HLLs, CLIs, basic programs
As long as target machine has a Java Intermediate
Object-Orientated: instructions held in objects, runs
Virtual Machine installed, bytecode is converted
once object has been interacted with
into platform specific machine code.
Characteristics: encapsulates data, uses classes,
Overhead, but allows any  Java code to be run on any
bottom up design, functions
machine with the correct VM installed
Uses: all modern GUI programs
Event Driven: program flow is determined by events
(user input, sensors, messages…) 2.4. Logic Gates
Characteristics: time driven, event/trigger
functions, subroutines
Uses: GUIs, user-input based action
Declarative: describes what the program should
accomplish, rather than how
Characteristics: non-destructive assignment, non-
crucial order of execution, explicit data structures
Uses: logic programming, AI, fact-based results

2.3. Translators
Assembler: turns assembly code (source) into machine
code (object)
Compiler: converts entire source code into object code
before execution. Produces full error report once
compiled

Advantages Disadvantages
Takes a long time to debug,
No translator needed once
since whole program must be
compiled (.exe file)
translated
Object code only runs on the
Hard to reverse engineer
same platform
Portable
Fast to execute, object code
ran immediately

Interpreter: each statement is translated and immediately


executed. A line interpreter translates the entire

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

D-type flip-flop – positive edge triggered flip flop circuit.


Output is only changed (0 to 1, or 1 to 0), if the clock pulse
is rising (positive edge)
Can be used as a memory cell to store a single bit.
Joining multiple together can store more bits (16x = 16
bits/2 bytes)
System clock synchronises inputs.
Flip flop: stores one bit, and can flip it between 0 and
1
Inputs
Control input (D)
Clock signal
Edge triggered: on each pulse, flip-flop changes state.
On each pulse, input data is stored, and continue to
be outputted until next trigger pulse
Uses: register memory, static RAM

Boolean Algebra

Logic Gate Combinations

Half Adder – performs addition using only A and B,


produces S and a CB. A carry bit is needed when the
result requires another digit

2.5. Roles of an OS
The operating system acts as an interface between the
hardware and the software to manage the computer’s
operation. A virtual machine is created that hides the
complexity of the computer from the user and other
software.

Send signals to hard disk controller


Network management
Full Adder – two half adders chained together. A, B and Proper shut down of the computer
CB are input, produce S and a new CB Control start-up configuration
Load BIOS, bootstrap process

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

Interrupts into RAM. Accessed by the processor by referencing an


Inputs/Output address (a cell location on a chip)
Copes with errors (save errors, out of paper…) ROM: non-volatile method of storing data and
Memory Management instructions, that can’t be written to (unless
Memory is split into pages; only necessary pages of a reprogrammable). Stores BIOS instructions
program are loaded to avoid filling too quickly. Busses: microscopic wires connecting processor and
Less common pages not loaded. When full, pages not internal components
being used (or calculates the best one to remove) are Address bus: uni-directional to carry address of next
swapped for those that are needed. instruction or data item in memory so that data bus
Memory map lists what blocks have been allocated to can return it
each task. Data bus: bi-directional to transfer data between the
Virtual memory is used when program size > available processor and memory or I/O controllers. When large
memory. Section of secondary storage treated as data items are sent they have to be split up to fit into
RAM. Or, hold a central block of code in RAM and only the bus width. Greater the data bus width = more
load pages from storage when needed, allowing more data transferred per pulse of the clock. Data bus
space for other applications. May slow operation. width is normally = processor word length (the
AIMS: allocate so that multiple programs can run, number of bits that can be addressed, transferred or
protect processes from each other, enable sharing of manipulated as one unit) = memory word length
memory space, provide a satisfactory and optimised Control bus: bi-directional bus sending control signals
level of performance. to registers and data/address buses. Ensures that
File Management correct data is travelling to correct place at the correct
Hierarchical system to store files using folders or time – has to sync signals and access to other buses.
directories. May dictate data bus direction or reading/writing from
Input/Output Management an I/O port
Most I/O devices operate much slower than the CPU, I/O controllers: controls the flow of information between
so a queue is created (sequence or priority) to the processor and input/output devices. Needed because
complete requests/processes processor cannot directly communicate with devices
Control driver programs load with the OS to detect I/O Types: monitor controller, mouse controller, keyboard
devices, allow device to communicate with the OS controller and hard disk controller
An I/O buffer sits between the CPU and slower Features: translates signals into ones that can be
devices, so the processor does not need to wait for a understood by processor (allowing large range of
slow response. devices), usually ADC. Buffer data sent between
Processor Scheduling processor and device so processor doesn’t have to wait
Processing time divided up between tasks. Round- for relatively slower device to respond
robin giving equal time. If a task is inactive, time slice
might be passed to the next task. This allows for the 3.2. Stored Program Concept
illusion of multitasking. Multitasking also occurs with
multiple cores. If time slices are too small, data may Machine code instructions and data are stored together
not save – leading to corruption. and loaded from memory into the processor to be
Resource management is how an OS manages executed in sequential order
hardware/software to optimise performance. Instructions are Fetched, Decoded and Executed

3. Fundamentals of Computer 3.3. Structure and Role of the Processor


Organisation and Processor

Architecture ALU
Performs arithmetic calculations - add, subtract,
multiply etc.
3.1. Internal Components Logical decisions - Boolean decisions based on binary
patterns
Processor: a device that performs computation on data Control Unit: synchronises fetch-execute cycle and
by following instructions to produce an output ensures that data being processed is correctly routed
Main memory: used to store data and instructions that Clock: signal generator that synchronises the fetch-
the processor has fetched, ready to be used execute cycle and computer components.
RAM: random access memory that is extremely fast and General-Purpose registers: small but extremely fast piece
volatile. All, or part of a running program will be stored of on-chip memory that stores data or instructions during

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

fetch-execute cycle An 8-bit bus would allow for 256 data items (256
Are outside the IAS, therefore allow faster access to bytes). Adding another wire doubles capacity. 32-bit
the data they store now standard, allows 4GB of addressable memory
Registers
PC: stores memory location of next instruction 3.6. Fetch-Execute Cycle
needed by processor, so it can be placed in the CIR
CIR: stores the instruction currently being executed by Fetch
the processor PC contains address of next instruction to be fetched
MAR: stores memory location of where data or Next instruction address passed to the MAR
instruction in the MBR is about to be written to or Address bus transfers address to main memory
read from Contents transferred along the data bus
MBR (MDR): holds anything copied from memory PC incremented (ready for next fetch)
ready for processor. Stores data that has just been/is Contents of addressed memory location loaded into
about to be written to main memory MBR
SR: stores the result of comparisons for decisions Contents of MBR transferred to CIR.
later on; such as immediate arithmetic results or Decode
errors (overflow), and keeps track of various parts Instruction in CIR passes to the Control Unit
Accumulator: single general-purpose register in ALU. Control Unit splits instruction into the opcode and
Stores values when processed by arithmetic and operand
logical operations Opcode decoded using CISC (complex-) or RISC
Interrupt Register: stores any interrupts received from (reduced instruction set).
I/O controllers or other components attached to Execute
processor Data fetched if necessary
Index Register: used to modify operand addressed Opcode identifies what type of instruction it is
during program run if address is indirect. Constant Instruction is actually executed
from instruction added to Index Register contents to Will vary depending on instruction being passed
form address to operand/data through
Result stored in accumulator
3.4. Architecture Status register updated.
If instruction is a jump/branch instruction, address is
Harvard architecture: has physically separate memories loaded into PC and cycle restarted.
(and buses) for instructions and data
Advantages: instructions and data is handled much 3.7. Instruction Set
quicker. Faster and more efficient execution.
Optimised chips have lower power requirements Every processor has its own instruction set; a pattern of
Uses: embedded systems with a specific use. Digital 0s and 1s that represent particular commands and
signal processing compresses analogue data and for associated meanings
faster processing. Can either be RISC (reduced) or CISC (complex)
Von-Neuman architecture: data and instructions are Opcode: mnemonic that represents what the statement
stored in the same memory and accessed with the same does
busses Operand: a value, memory address or register
Uses: general-purpose computing systems Addressing mode: defines which addressing mode to use
Comments: may be included to make program clearer
Defined as: ‘comment’
Number of bits assigned to the opcode defines how many
opcodes are possible:
Eg. 24 = 16

3.5. Addressable Memory


Data and instructions can be stored in memory using
unique addresses. Blocks of addresses are assigned to
processes such as the OS and running applications

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

Perform logical bitwise XOR between register n and


operand and register x
MVN Rx, <operand>
Perform logical bitwise NOT between register n and
operand and register x
LSL Rx, Rn, <operand>
Logically shift left the value stored in register n by
number of bits specified by operand and store in
register x
LSR Rx, Rn, <operand>
Logically shift right the value stored in register n by
number of bits specified by operand and store in
register x
3.8. Addressing Modes HALT
Stops program execution
Direct Addressing: the instruction operand is the memory
address or register number. Data is copied from the
specified location 3.10. Interrupts
Eg. MOV R1, 100
Immediate Addressing: the operand is the datum, Signal sent by a device or program seeking the attention
therefore data is immediately loaded of the processor
Numbers are represented with a # Before each fetch-execute cycle, interrupt register is
Eg. MOV R1, #10 checked
If high priority, the volatile environment (running process)
is saved to memory, so that the control of the processor
3.9. Machine/Assembly Code can be passed to the ISR
Interrupt Service Routine
LDR Rx, <memory ref>
Completes current fetch-execute cycle
Load value stored in in memory reference into
Contents of all registers stored on the stack
register x
Interrupt source is identified
STR Rx, <memory ref>
If high priority, PC loaded with relevant ISR address
Store value in register x into memory reference
and ISR executed using the Vector mechanism
ADD Rx, Rn, <operand>
All registers apart from PC are restored
Add value in operand to value in register n and store
Interrupts re-enables
in register x
PC restores and fetch-execute cycle begins again.
SUB Rx, Rn, <operand>
Priorities
Subtract value in operand from value in register n and
store in register x 1. Hardware/Power failure
MOV Rx, <operand> 2. Reset interrupt
Copy value from operand into register x 3. Program error
CMP Rx, <operand> 4. Timer
Compare value stored in register x with value in 5. Input/Output
operand
B <label> Vectored Interrupt Mechanism: each interrupt has an
Branch to the instruction at the position defined by associated memory address (vector) that points to the
label starting address of the associated code. Processor uses it
B <condition> <label> to jump to the vector specified address and runs the
Branch to the instruction at the position defined by Interrupt Service Routine
label if last comparison meets criteria
EQ equal to, NE not equal to, GT greater than, LT less 3.11. Factors Affecting Performance
than
AND Rx, Rn, <operand> Multiple cores: several cores allow several operations to
Perform logical bitwise AND between register n and be ran simultaneously. This means multitasking can be
operand and register x come a real concept, or multithreading can be enabled
ORR Rx, Rn, <operand> for one program
Perform logical bitwise OR between register n and Core: a component that allows instructions to be
operand and register x fetched and executed
EOR Rx, Rn, <operand> Cache memory: high-speed memory store on the
processor itself. Allows for extremely fast access of

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

frequently used instructions and data in a program For colour each pixel has multiple cells, each with a
Clock speed: defines how fast each instruction will be filter to only allow R/G/B through. This forms a picture
executed. Increasing clock speed increases rate of for each colour, which are then combined
execution Note: RAW files are uncompressed, and contain all the
Word length: 32- or 64-bit means that 32/64 bits can be ‘raw’ light data. A Bayer filter has colour filters
handled in one pulse of the clock. 64-bit word length 2G1R1B, which is closer to how human see colour
needs 64-bit busses
Word: collection of bits that can be addressed and
manipulated as one unit
Address bus width: increasing will increase the amount of
memory that can be accessed and therefore the amount
that can be installed
Data bus width: increasing allows more bits to be passed
down it with each clock pulse, so more data can be
processed within a given time interval
CCD CMOS
High quality Susceptible to noise
4. External Devices Lower light sensitivity due to
Low noise
transistor density
4.1. Barcode Reader Consumes 100x more power
Consumes little power
than CMOS
Characteristics: handheld input device that uses light to Matured technology Rolling shutter
read dark portions of a barcode/QR code Global shutter
Purposes: to input a number into a computer system
quicker and more accurate than manual input. Used by
shop POSs to match stock to database 4.3. Laser Printer
Suitability: reduces RSIs, easy to use, reduced error
Operation Characteristics: output device that produces
IR LED passed over code, reflected light from white monochrome/colour prints using a laser and powdered
sections detected by CCD or photodiode toner
Analogue waveform converted to a digital signal using Purposes: produce whole page prints at once. Used in
ADC. Computer converts signal to binary to represent offices/schools due to clear text
the code Suitability: fast page production (20-200ppm vs 5ppm
Eg: 0 = black, 1 = white with inkjet). Not good photo reproduction, more reliable
Error detection applied (parity bits and check digits). than inkjet. No risk of bleed-through or ink spills, as toner
Reader will scan multiple times/second until is dry powder. Prints last a long time
computer confirms correct code Operation
Drum is made positively charged by coating with an
electric charge holding chemical
4.2. Digital Camera Laser beam is reflected by mirror to discharge certain
sections of drum – leaving an impression. The mirror
Characteristics: captures digital photographs by turning
moves instead of the laser to reduce complexity
analogue light data to a digital bitmap file, that can be
Toner roller dispenses negatively charged toner on
transferred to a computer to be manipulated or printed.
drum. Opposite charges attract, so toner coats
Lens focusses light onto sensor, shutter regulates light
positive
hitting sensor
Positively charged paper passes under the negatively
Purposes: capture digital video or photographs
charged toner, so toner transfers
Suitability: now small enough to be pocketable,
Fusers heat the toner to make it fuse to the paper
implemented in smartphones – produce lower resolution
Drum is discharged by corona wires
images (JPEG/TIFF), ideal for social media. Professional
Note: for CMYK, process is repeated for the colours
cameras have higher quality and more capabilities
with different rollers and coloured toners
Operation
Shutter opens allowing light through camera
Lens focusses light on CCD or CMOS sensor
Light hits cell, representing a pixel, converted to a
charge and value recorded
Recorded values put together to form an image,
stored on solid state storage as JPEG/PNG files

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

Suitability: high capacity (good aerial density), as


concentric tracks are close together. Capacity can be
increased by using Heat Assisted Magnetic Recording or
changing recording direction from horizontal to
perpendicular
Operation
Head moved to correct track and sector by actuator to
write/read data
To write, magnetic film is magnetised by an
electromagnet to represent a 0 or a 1
To read, head detects a change in the magnetic field,
producing analogue signal. ADC interprets 1 or 0

4.4. RFID (Radio Frequency


Identification)
Characteristics: can be used to pass data wirelessly, using
radio waves, between a tag and a reader. Contains small
chip with memory, and an antenna
Purposes: contactless card payments, hotel room card
keys, tracking individuals/shipments/high value items Solid-state Disk
leaving shops. Sharing small amounts of data (eg. a URL
or phone number) Characteristics: non-volatile storage made up of NAND
Suitability: simplifies processes such as physical keys and flash chip semiconductors. A controller manages blocks
chip/pin readers. Relevant data is quickly sent across a of data (set groups of bits and bytes of a fixed length)
small air gap. Secure due to close proximity Purposes: used as HDD replacements, HDD-hybrids and
Operation smaller applications such as phones, laptops and
Tag contains memory chip, modem (to memory cards for cameras/USB drives
modulate/demodulate radio waves) and an antenna Suitability: fast access times since data can be added and
Passive tag will induce enough power from reader to deleted to/from different blocks, so only small parts need
operate. Powered tag has its own power source writing or reading – unlike a HDD where whole disk must
Antenna picks up radio waves emitted by reader; tag spin up
responds by emitting its own signal which represents Operation
the data on the chip Controller allocates blocks and decides where data
Reader picks up the wave, decodes it and returns data should be written to
to a computer system Blocks contain many pages, but cannot be
overwritten, so pages must be erased before it can be
written to. Whole block must be erased to write
4.5. Secondary Storage Non-volatile since floating gate transistor can trap and
store a charge
Secondary storage is needed to store personal files,
Insulating oxide layers between control and floating
operating systems, programs and virtual memory.
gates traps charge even when power is off

Magnetic Hard Disk

Characteristics: stack of high-speed spinning magnetic


disks, coated in magnetic film with a recording head
moved by actuator arm. Hermetically sealed to prevent
damage from dust/debris. 3600-12500 rpm
Purposes: Storing OS and personal files. An OS will cluster
sectors together to make management easier, but this
may create redundant space

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

HDD SSD CD/DVD Blu-Ray


Reliability Good Very good Fair Fair

5. Consequences of Using
Computers
5.1. Development of Computing

Optical Disk Over the last 30 years, enormous growth in technology


means that hundreds of tech companies have huge
Characteristics: spiral track of pits and lands with a control over personal data
protective layer to help preserve data integrity. Laser
wavelengths = CD 1.6μm, DVD 1.1μm, Blu-Ray 0.5μm 5.2. Personal Issues
Purposes: backups, storing music and films
Suitability: cheap and easily portable. Blu-ray disks allow Personal data: any data stored about a person that is
more data to be stored due to narrower wavelength and unique to them
hence tighter spiral track Eg. Finances, family connections, date of birth...
Operation Personal privacy: individuals may not have consented to
Read: laser is shone on the surface; if reflected by a data collection
land, light hits a photo-electric cell. Reflection = 1, no Data security: how safe/protected personal data is from
reflection = 0. Binary is processed from analogue unauthorised users
signal Data misuse: data not used for its stated purpose
Write: laser burns into disk, or discolours dye material ‘Big brother’: government breaches human rights to
to represent binary data monitor individuals
Online profile: digital footprint left behind that may
‘haunt’ an individual
Profiling: organisations build up data to create personal
profiles that may have a harmful impact

5.3. Moral and Ethical Issues


Ethics are factors that define the set of moral values for
society.
Unauthorised access: access by people who are not
intended users (hackers and vulnerability exposers)
Unauthorised use of software: some think software is too
expensive and therefore downloading or copying
software is morally defensible
Inappropriate behaviour: bullying, trolling and abuse
online. May also spread to the real world
Inappropriate content: not illegal but may cause offence –
pornography, violence, religious hatrid
Freedom of speech: everyone can express an opinion,
even if it causes offence
Unemployment: jobs are lost as retail and banking can
replace workers
Access to the internet: 15% of the UK has no access, 35%
Speed and Capacity Comparison
of the world has access – disadvantaged?
BCS Code of Conduct: an organisation may use this to
HDD SSD CD/DVD Blu-Ray
inform dismissals, or for programmers when developing
Capacity 1TB 500GB 0.7-4.7GB 25GB computer systems
Cost Medium High Low Low Always operate in public interest
Speed Medium High Low Low Have a duty to the organisation they are associated
Latency High Low Very high High with

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

Have a duty to the profession Rectification


Maintain professional competence and integrity Erase or right to be forgotten
Restriction processing
5.4. Cultural Issues Be informed if data is passed on
Data portability
Cultural issues affect and influence (the beliefs, attitudes Object/seek compensation
and actions) a society, or a proportion of the population. Have decisions made by a human being
Influences range from politics, economics and religion
Data over-use: every organisation including the 5.7. FOI Act
government collects data. Analysis of this data can be
used to make policy decisions Freedom of Information Act 2000: addition to the Data
Invasive technologies: collection of data without consent Protection Act to extend the subject access rights.
Over-reliance on computers: data may be lost or there Overseen by the Information Commissioner
may be damage to life if computer systems fail Key principles
Over-reliance on tech companies: 2/3 of all internet Apply to all public authorities (councils, hospitals,
searches are done on Google, giving them huge power of police, schools etc…)
the information on the internet All requests must be dealt with appropriately, as
‘Big-brother’ culture: increasing use of CCTV and soon as possible (within 20 days to respond)
monitoring systems means people may feel obliged to act Gives individuals access to personal and non-
a certain way to meet expectations or feel constantly personal data held by public authorities
watched Refusal notice with 24 exemptions (endangering
Globalisation: many organisations try to use technology national security, personal data etc…). Public
to influence religious and political debates interest assessment must be made
Computer Misuse Act 1990: introduced to primarily to
5.5. Legal Issues prevent hacking, viruses, malware etc…
Key principles
Computer use does not exempt a user from all other Unauthorised access to computer programs/data.
laws. Theft over the internet will still be treated as theft Refers to entering a computer system without
Geographical limitations: local laws only apply for that permission (breaking through passwords),
country, therefore if someone breaks a UK law, but is decrypting files and identity theft
located elsewhere, it can be hard to prosecute Unauthorized access with further criminal intent.
There are no universal regulations Stealing data or carry out further criminal act such
Due to the global nature of the internet, it can be hard as fraud/copyright breach
to pinpoint the location of the crime Unauthorized modification of computer material.
Constant change: policies tend to be introduced as a Falsifying/modifying/deleting data, or introducing
result of current events. Rapid technological development malware
means these laws quickly become outdated
5.8. RIP Act
5.6. Laws
Regulation of Investigatory Powers
Key principles
GDPR Acquisition and disclosure of communications
data
General Data Protection Regulation 2016: Data Protection Surveillance and covert human intelligence
Act in 1984, now updated by EU commission sources
Groups of people Investigation of electronic data protected by
Data commissioner, controller, users, subjects
encryption
Key principles Scrutiny of investigatory powers and the functions
Obtain data through lawful, fair and transparent
of intelligence services
methods Rights
Purpose limitation (must be kept for a purpose) Police and law enforcement have the right to
Data minimisation (keep just enough for needs)
intercept data where there is suspicion of crime
Accuracy (keep accurate and up-to-date data) Gives them the right to decipher encrypted text
Storage limitation (keep no longer than needed)
(and make the suspect tell them how to)
Integrity and confidentiality (keep data secure) Gives employers and managers of organisations
Accountability the right to monitor computer activity of
Data storage principles – subject has the right to: employees
Access and see data stored about them

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

5.9. CDPA
Copyright, Design and Patents Act: creators of material
have a right to grant them control on how their material
is being used
Applies to: all creative works, regardless of format. Serial transmission: data is transmitted one bit at a time
Covers accessing, copying, adapting, selling and
down a single wire
renting Advantages: low cost (one wire), no skewing risk – can
Illegal to: produce copies of software or run more be used for long-distance communication
versions than have licences for. Downloading films or Disadvantages: slower data transfer as only one bit
audio without permission from copyright holder sent per clock pulse
Techniques
Digital Rights Management: uses access control
software to limit how users use, control, copy, edit
or print content
Licensing of Software: requires paper-
based/digital proof of legal purchase/license, and
installation within terms of licence Synchronous: data is transmitted where clock pulses are
in sync or both devices share a common clock
Asynchronous: data can be transmitted between two
5.10. Other Laws
devices that have a synced clock signal only for the time
of transmission
The Official Secrets Act: prevents disclosure of
Start/Stop bits: used to indicate the start and end of a
government data that relates to national security
The Defamation of Character Act: prevents people from unit of data in asynchronous data transmission
Start bit causes syncing of receiver clock
making/creating untrue statements about others that
could lead to reputation damage Devices agreed number of bits to follow, if/what
parity is used, number of stop bits
The Obscene Publications Act: prevents the dissemination
of pornographic/violent images Stop bit indicated data has arrived
Next data prefaced with start bit
The Protection of Children Act: schools and public access
computers should filter web content.  Indecent images of Data sent without waiting for clock pulse or
synchronisation message
children is a criminal offence
Health and Safety Regulations Act: provides regulation of
correct use of screens and is an addition to the Health
and Safety at Work Act, which contains more general
regulation for employee safety
Equality Act: makes discrimination against anyone based
on sexuality, gender, ethnicity, religion, disability or age
illegal. Includes dissemination of derogatory material Baud rate: number of times a signal in a communication
channel changes state
Differentiate: bit rate can be higher than baud rate if
6. Fundamentals of more than one bit is encoded in each signal change.
Bit rate and baud rate will only be equal if the bit rate
Communication and is 1bps
Bit rate = Baud rate x number of bits per signal
Networking Bit rate: the number of data bits transmitted per second –
measured in bits per second
Bandwidth: measure of a communication channel’s
6.1. Communication maximum capacity. Greater bandwidth means greater
volume of data can be transmitted. Speed is defined by
Parallel transmission: data is transmitted several bits at a
bit rate
time, along multiple wires
Bit rate relationship: bit rate is directly proportional to
Advantages: very fast transfer due to bits being sent
bandwidth
simultaneously – connects processor and memory
Latency: the time delay before a computer component
Disadvantages: more wires = more expensive,
responds to an instruction
degraded signal over distance (interference between
Protocol: a set of rules relating to communication
wires), skewing of bits occurs
between devices. Where the same protocol is used,
communication can happen

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

Outlines: transmission speed, method, error checking Networking Between Hosts


methods, format of data
Peer-to-Peer: network with no server – each device has
6.2. Networking equal status and can adapt to be a client or a server,
depending on the task
Devices share resources instead of using a server
Networking Topology
Common for file-sharing applications and home
Topology: a conceptual layout of devices networks
Physical: cable/device arrangement on a network Client-Server: network where one computer has majority
Logical: shows conceptual data transmission routes processing power and storage, and clients request
Physical Star: each client is connected to the central services such as:
server, with its own dedicated connection Printer access
Providing a secure internet connection
Email, file and application access

6.3. The Internet


The Internet and Operation

The World Wide Web is a service provided on the


Internet, which is a global network of interconnected
networks
Packet switching: messages are split up into packets that
are transmitted over the network via the quickest route.
Logical Bus: all clients are connected to one main cable,
Some will take different routes to their destination, so are
therefore that one cable, carries all data between server
reassembles based on sequence number
and clients
Packet components

A physically wired star network can behave as a logical


bus network if bus protocols and physical switching used

STAR TOPOLOGY BUS TOPOLOGY


More expensive – each device
Cheaper – less cables
needs own cable
More secure – direct server Less secure – data must pass
connection past multiple machines
Harder to install – each Easier to install – less cables·
device needs own cable Collisions reduce speed
Router: network device that forwards data packets
Collisions more likely as
Faster – no collisions between computer networks to the correct destination
number of clients increases
based on an address
Transmission speed shared Uses the Network Translation Table
No chance of collision
across all devices Gateway: a piece of hardware that can convert between
Each device gets full If a cable fails, potentially all two protocols when data is passed between networks
transmission speed client fail that use different protocols, by stripping off packet
Only one device affected if header data and replacing it with new header information
Less reliable than star
cable failure. for the new format
Server may get congested Harder to locate faults Routing: finds the optimum route between sender and
receiver, where there are many possible routes. Router is
New clients added without
used to send data to next network node – it knows where
affecting others
to send data from header info
Easier to locate faults

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

At each stage, data packets are sent to next router in


the path, with reference to routing table
Routing table: stores information on possible routes
the data packet may take to next node. Identifies next
step
Uniform Resource Locator: full address used to find files
on the Internet

6.4. TCP/IP
A suite of protocols for sending information around the
Internet or a network

Fully Qualified Domain Name: when the domain name


and host server indication are combined
www. + bbc.co.uk = www.bbc.co.uk
Domain name: identifies organisations or groups on the
internet. Eg. bbc.co.uk
bbc: organisation name
.co: indicated it is a company. .gov, .org are others
.uk: UK registered. .es is Spain, .nz is New Zealand
Organisation: hierarchical system. Root zone
managed by IANA, with oversight from ICANN. ICANN
manages registration and assignment of TLDs
Process
1. DNS root zone Application layer: interacts with user via browser
2. Top Level Domain Appropriate protocol is selected and puts data
3. Second Level Domain into the correct format for transmission
4. Third Level Domain Port number already allocated is tab open
Transport layer: establishes end-to-end
IP address: unique 32-bit number that identifies network
communication between client and server
devices
The application layer of destination/source is
Domain service: when a domain name is assigned, it is
identified by port numbers, that are used to route
mapped to an IP address. A Domain Name Server (DNS)
reassembled messages to correct receiver
stores the link
Splits and numbers messages into packets
User’s device requests IP address from DNS server,
Adds encryption, attaches header (D/S port
and it is returned. Then browser establishes
numbers, # of packets), deals with error control
connection with IP address
**__Network layer: __**adds IP addresses in another
Hundreds of DNS servers around the world are
header on top of the transport layer header. Contains:
connected, so that if one doesn’t have the mapping, it
IP version, source and destination IP addresses
routes the request to another that might have
At this stage data turns from a ‘message’ to a
Humans type in domain names because they are
‘packet’
easier to remember than IP addresses
Link layer: adds destination/source MAC addresses of
Internet registries: are organisations that manage and next network node (change from link to link)
allocate domain names and IP addresses. Internet
Packets moved between 2 internet hosts
Corporation for Assigned Names and Numbers has
Deals with physical connection and cabling
department called Internet Assigned Numbers Authority
Packets are then sent around a network –
who manage 5 Regional Internet Registries wirelessly or down a cable
Link layer: strips and checks if MAC address is its own
(if it is the intended recipient). If so, link header
removed, passed to network layer
Network layer: strips and checks IP addresses. If not
the recipient, new header added and passed back to
link layer. Else passed up to transport layer

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

Transport layer: checks port numbers and header. algorithm


Assembles messages in correct order (performs WPA+WPA2: uses both TKIP and AES to offer
request if not all received), and passes up to maximum compatibility, overall less secure than
application layer, based on port number. May WPA2
perform decryption WPA3: most modern. Uses cutting edge protocols,
Application layer: responsible for creating response to and new features for robust authentication. Increased
request. Response sent in same way, just with protection from password guessing attempts
destination/source IP addresses swapped – server WPS (WiFi Protected Setup): setup system where a
uses received source IP to know where to send button on each device must be pushed within 2 mins.
response Makes it as easy as possible to join secure network
Sockets: a software created endpoint of communication SSID changes: change SSID from the default value,
flow and/or hide it from transmission so that network is
Socket =  IP address + port number not visible. Clients must then manually enter it
Eg. 192.168.233.2:80 MAC whitelist: create a whitelist of all devices that are
MAC addresses: a unique code that identifies devices on a known to be trustworthy, so that no other devices can
network encoded on the network interface card communicate with network
6 groups of 2 hex digits: first 3 identify manufacturer, Carrier Sense Multiple Access with Collision Avoidance:
last 3 identify the device acts to prevent collisions
Any device connecting to a Wi-Fi network must have a CSMA/CA waits: if a channel busy, random amount of
unique MAC address time waited before re-attempting. Exponential back-
Well-known and client Ports off algorithm used
Port: 16-bit number attached to IP address to identify
a certain process or application on network
Servers will use one of the 250 well-known ports to
launch a process
Clients use port numbers from the dynamic range
when not launching specific protocols

6.5. Wireless Networking


Has no wires to make connections between devices with
a wireless network adapter (of which each has a unique
MAC address)
WiFi: is a Wireless Local Area Network based on
international standards (IEEE 802.11), so that all devices
are compliant and can receive/transmit RTS/CTS: overcomes problem of hidden nodes that
Wireless Local Area Network: reachable of distances CSMA/CA cannot find. If idle channel, ‘Request To Send’
around 100m indoors, and 300m outdoors. Signal message sent. If server idle, ‘Clear To Send’ message is
degrades over distance due to use and interference sent. If CTS not received, data not sent
Wireless Wide Area Network: typically comprised of [SSID: Service Set Identifier is a locally unique 32-
mobile phone networks, satellites and ground towers to character code that acts as a network identifier allowing a
transmit signals over long distances data frame to be transmitted. Included in the header of
Wireless network adapter: computer component that each data packet
enables computers to connect with each other, a server Is required for security, but doesn’t affect security
or other network devices. Can be built in, or external Standard method of ensuring right device connects to
antennas right network ](SSID: Service Set Identifier is a locally
Wireless Access Point: network component that unique 32-character code that acts as a network identifier
effectively creates its own wireless network, devices allowing a data frame to be transmitted. Included in the
connect, and traffic then forwarded onto the main header of each data packet
network. Used to extend range of a wireless network Is required for security, but doesn’t affect security
Security: wireless networks are potentially less secure Standard method of ensuring right device connects to
than wired, as data is transmitted by radio waves right network
WPA (WiFi Protected Access): uses stronger encryption
than WEP (40-bit encryption key) and Temporal Key
Integrity Protocol that dynamically changes the key
Outdated, and therefore vulnerable
WPA2: provides even stronger security. Uses
Advanced Encryption Standard (AES), a symmetric

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

If key is intercepted, it would be possible to decrypt


and then messages are no longer secure

Asymmetric encryption: uses two related keys per


session. Both a sender and a receiver have both keys.
Mathematically related keys, but near impossible to work
out private key from public key, due to 1024-bits used
6.6. Security Computer A has private and public key. Public key can
be seen by anyone
Firewalls Computer B also has both keys
System that operates on the network layer, designed A encrypts data using B’s public key
to create a safety barrier – preventing unauthorised Data sent to B
access to a private network B decrypts the data using B’s private key, that only B
Operation knows
Access control list: can allow/deny IP addresses,
domain names, protocols, programs, ports, and
keywords
Logs: keeps log of all transmissions, so traceable.
Can generate auto warnings if server is being
attacked
Host based: software installed on a computer to
protect only that computer
Network based: hardware and software
combination between public Internet and private
network. Built in/standalone software
Packet filtering: packet contents examined to ensure
Digital certificates: a way of proving encrypted message is
there is no unauthorised data. Packets are rejected if
from a trusted source. Used to authenticate a service is
the do not meet rules, contains malware, come from
genuine
unauthorised IP address, involve unknow processes
Important for sharing public keys in asymmetric
Stateful inspection: looks past header information to
encryption
examine packet contents and determine context.
Contain organisation name, domain name, server
Tracks communication channels, source, protocols.
name, and a Certification Authority serial number
Rejected if doesn’t form part of a recognised
Certification Authority: trusted organisation that
communication, such as an existing series of packets
issues digital certificates and signatures
Proxy server: retrieves data on behalf of the user, so
Digital signatures: uses mathematical functions and
there is no direct connection between Internet and
public/private key method to ensure sender authenticity
user. Allows anonymous surfing, activity logging and
Hash created from message by applying public
request evaluation to check they are legitimate/
hashing algorithm
allowable (restrict access). Caches web pages,
Hash encrypted using private key A
increasing speeds, and reducing bandwidth required
Hash added to message as ‘digital signature’
Advantages: keeps IP address private, but internal
B uses public key A to decrypt hash
IPs kept private anyways, as swapped for networks
Hash put through the same publicly known algorithm
public IP
and result is compared to original
Disadvantages: does not encrypt data, only faster
If two hashes are the same; authenticated. Else, it
access if page is cached, not everything/service
cannot be authenticated
implementation is secure
Symmetric encryption: sender encrypts data using key,
sends data and key separately, then receiver decrypts 6.7. Malware
data with key. Only one key in session

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

Trojans: program that may allow unauthorized access or Advantages: efficient for large data transfers, data
cause harm to a computer that is packaged into another recovery, resume/schedule transfers, allows different
file, or as useful software host configurations (PC/MAC)
Do not replicate, may go undetected for a while Disadvantages: not secure, no encryption, should be
Some are annoying; change background etc used on a limited basis or only on secure networks
Some are permanently damaging, create a backdoor HTTP: allows web-based applications to exchange images,
by offering remote access to a hacker – allowing text, videos, documents… It is stateless, meaning client
further crimes and server only know each other during the request.
Viruses: malware designed to cause damage to a system HTTP plain text message contains start line, headers and
or data body
Attaches itself to another program or file, enabling it Request-response cycle: physical connection à URL à
to spread from one computer to another HTTP message request à HTTP message response
Acts like a human virus – leaves infections as it travels, Port: 80
but must be ran on system to infect it. Advantages: adapted to allow most file types,
Low level severity: annoying pop-ups convenient and reliable
Severe virus: destroy whole networks and databases Disadvantages: vulnerable to interception – no
Worms: virus subclass that does not need a host file or encryption
human action to spread HTTPS: uses SSL/TLS to authenticate certificates, then
Replicates and is designed to spread itself, maybe by proceed with encryption
sending itself to all contacts, or spreading on a Port: 443
network POP3: method of retrieving email from an email
Normally consume all resources and bandwidth so server by downloading the inbox folder. Default: once
systems and servers stop responding stored locally, deleted from server; but most clients
Famous examples such as ‘Iloveyou’ and ‘Melissa’ offer option to keep on server
spread via email Ports: 110 or 995 (secure)
Protection Advantages: email viewable offline, as downloaded.
User precautions Saves space on email server. Fast to view since
Use anti-virus software and firewall already downloaded
Keep software up to date Disadvantages: backup needed in case emails lost
Use a whitelist from device, more vulnerable to viruses as emails are
Use strong passwords fully downloaded
Ensure encryption/HTTPS IMAP: method of retrieving email from an email server by
Do not open attachments unless trusted caching emails on a client’s device, and not deleting them
Programmer precautions from the server
Use a language with built in security Ports: 143 or 993 (secure)
Use encryption Advantages: allows multiple users and device access
Set admin rights Disadvantages: must trust and rely on provider for
Don’t load internet services into code security, servers need large quotas to deal with many
Test for exploits accounts, provider gives user small set space to store
Keep program up to date emails
Never trust the user SMTP: simple mail transfer protocol is a set of commands
System precautions that authenticates and directs the transfer of email.
Ensure requests are from authorised users Sends email to SMTP server, and is used to transfer email
Use firewalls and encryption to recipient’s email server. Message contains headers and
Keep anti-virus protection updated a body
Update software and network OS often Ports: 25 and 587
Advantages: guarantees delivery if address is correct,
6.8. Standard Application Protocols otherwise returns error message. Encryption can be
added with SSL/TLS.
FTP: used to transfer files over a network, and allow web Disadvantages: limited receive ability, both clients
designers to upload their files to web servers – with must be online
guaranteed file delivery Normal computers can be FTP SSH: set of rules for secure remote computer access, to
servers. FTP client software has a GUI. May require a execute commands and manage. Provides several
username/password options for strong authentication, protects
Ports: port 21 to establish connection and control communications security and integrity with strong
data. Port 20 to transfer data. Port 22 for SFTP encryption. Uses both symmetric and asymmetric
(encrypts with secure shell) encryption. Uses client server model
Port: 22

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

Advantages: very good encryption Dynamic Host Configuration Protocol: a set of rules that
Disadvantages: not available until system starts, issues unique IP addresses on a LAN, as devices connect
unable to log in if misconfigured, if private key to it
lost/deletes, unable to transmit. CLI hard to use Static: IP address remains the same
Other uses: used to make a TCP connection to a Dynamic: IP address is automatically allocated for the
remote port to send commands to it, using session (by a program upon logging on), but might be
application level protocols such as GET for HTTP reserved/reused for later use
Email server: stores, and manages the transfer of email Very efficient for busy networks as an admin doesn’t
files until they reach their destination have to manually assign IP addresses to each device
Web server: returns web pages in text form Dedicated server: manages a list of assignable IP
Web browser: retrieves web pages/resources and renders addresses and gives them to devices. A device may
them for the user using CSS files for styling receive the next item in the list, or their last used one

6.9. IP Addresses 6.10. Network Address Translation


A unique number, split into a network identifier and host
(NAT)
identifier, that identifies devices on a network
Matches up private IP addresses with public ones.
Domain name (IP proxy): transferred to a domain name
Allows duplicate IP addresses across Internet
server, which converts it to an IP address. If the DNS
Increases security, as private IP is not transmitted
cannot find the IP address, it is transferred to another
across Internet
server with the same top-level domain
Works by logging connections and mappings between
Subnet masking: splits the IP address into a subnet
private IPs and port numbers, and corresponding public
identifier and specific computer identifier. Performs an
IPs. Entries are added to a translation table, where look-
AND operation between IP and masks:
ups are performed
255.0.0.0                       (Class A)
Process
255.255.0.0                  (Class B)
Device on internal network sends request packet to
255.255.255.0             (Class C)
server with internal IP and port number
If the two computers are on the same subnet, then
Router replaces private IP with public IP and adds its
the result of the subnet mask should be equal
own port number (unique only for a certain amount
Remaining parts of the address define how many
of time)
devices can be on the network. In this case, 255
Router adds mapping data into translation table
01111000.10110000.10000110.00100000 Data sent back from server is received by router –
looks up port number in translation table to work out
11111111.11111111.11111111.00000000 AND
which device sent original request
01111000.10110000.10000110.00000000 If there is no match between port number and
translation table, packet is dropped as it may be a
IP standards: original v4 does not provide enough hacking attempt (or not a valid response)
permutations for each device on the Internet, so v6 was Public IP replaced by private IP and port numbers for
introduced with vastly more combinations and uses hex device who requested data
allowing for a greater range withing each group of Reply packet delivered to request device. Internal IP
numbers. All IP concepts apply to both and port numbers are never made public on the
IPv4: x.y.z.n – each letter is a number 0 to 255. 32-bit external network
address, 4 groups of 8 bits
IPv6: FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF. 128-bit
Port Forwarding
address, with 8 groups of 16 bits
Non-routable: only for internal use
Application of NAT that allows computers on the internet
10.x.x.x
to connect to a service within a private network (with a
172.16.x.x to 172.31.x.x
non-routable IP), by routing data through additional ports
192.168.x.x
Port: logical connection that uniquely identifies programs
Endings: .0 Network Identifiers Address, .255 Network
and services, used by them to exchange information
Broadcast Address, .1 Gateway
Process: client uses router’s public IP address to initiate.
Routable: all others are public
Router is programmed so requests and packets sent to
Must be unique and registered (at a cost)
specific ports are then forwarded to the device with the
Routers know the difference; non-routable addresses
correct IP address on the network
are directed internally
Applications: remote desktop connections

DHCP

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

6.11. Client-Server Model XML JSON


Slower to parse as data must Quicker to parse as data is
Client sends request message to server, and server be extracted from tags clearly defined
responds to request by replying with a response message More knowledge required as Easier to create due to
to client is similar to programming simpler syntax
WebSocket protocol: an API establishing full-duplex Complete freedom over data Limited range of data types,
‘socket’ connection between browser and server over
types – more flexible and may not be sufficient for all
TCP. Persistent connection that allows both parties to
extendable applications
send data at the same time
Routed through port 80
Sent in packets called messages, with very little
header data, so data transfer is fast
API: subroutines that allow one program to interface
with another
Enables accessing data from 3rd party
Hides system complexity from program
Extends functionality
Adds security by acting as a gate keeper
CRUD: acronym to describe the 4 main processes with
databases. Without these, a database will not be
complete. Have a one-to-one SQL relationship

CRUD SQL HTTP


Create INSERT POST
Retrieve SELECT GET
Update UPDATE PUT 6.12. Thin vs. Thick Client Computing
Delete DELETE DELETE
Thin: a powerful server with lots of resources is accessed
by a lower-performance computer. The server runs the
REST (Representational State Transfer): methodology for software and the machine acts as a terminal
implementing networked database, uses HTTP to carry Terminal: low-powered device with no hard-disk that
out CRUD functions. displays the software running on the server
Client requests from server
Thick: individual computers have more resources and
Service requested is the database defined in the URL,
performance, so software is ran from the client end. The
which contains the query
server doesn’t need to be as powerful, and performs
API run from server and accessed by bowser to roles such as: authentication, file storage, backups and
coordinate antivirus
HTML files used to ensure data is displayed in correct
format on client side THIN THICK
Requests and data are transferred using HTTP
Easy and cheap to add new
JSON or XML used to return query. Reduced server pressure
terminals
RESTful principles
Database connected to browser using REST relies on Clients have more control
HTTP request methods Server can adapt to allocate Less servers and bandwidth
REST allows JavaScript to talk to server through HTTP resources where needed required
REST API created and run on server, browser Updates occur on the server,
Suitable for low performance
JavaScript calls API so each terminal gets latest
portable devices
JSON or XML can be used to transmit data updates and applications
JavaScript references by HTML file Greater security due to
JSON vs XML Reduced security as clients
access rights, easier for
have more rights
network manager
XML JSON
Server dependent – if server Data more likely to be lost by
Harder to read, as data is
Easy to read, as it defines fails, all fail clients
contained within mark-up
objects and values High-spec servers are Harder to manage software
tags
expensive updates
More code required Less code required

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

THIN THICK No partial dependencies, where a non-key attribute


Higher bandwidth may be Harder to ensure data depends on part, but not all of the primary key
needed. May slow with integrity if clients work on No non-key dependencies where a non-key attribute
depends on another non-key attribute
congestion. local data/files.

7.4. Structured Query Language (SQL)


7. Fundamentals of
Data types in SQL
Databases
Character(n) String with fixed length (n)
Varchar(n) String with maximum length (n)
7.1. Conceptual Data Models
Boolean True or false
Entities in a database can have relationships: Int Integer value
One-to-one Decimal with digits before and after
Decimal(p,s)
One-to-many decimal point
Many-to-many (should be avoided) Real Number up to 7 decimal places
Date Day, Month, Year format
Time Hours, Minutes, Seconds format

SQL operators

= Equals to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
<> Not equal to
IS NULL Check for null values

7.2. Relational Databases Define a table

The concept of database creation that uses tables of CREATE DATBASE <database-name>

CREATE TABE <table-name>

related data with relationships between the data. Data in


different tables is linked together to express relationships (

that exist between data in tables

Entity: an object about which data will be stored        ColumnName DATATYPE NULL/NOT NULL,

Attribute: a piece of data or characteristic stored about

each instance of an entity )

Primary Key: an attribute that can be used to uniquely


Define keys
identify each record within the table
Composite Primary Key: combination of two attributes to PRIMARY KEY (field)

produce a primary key


Foreign Key: an attribute that links to the primary key in FOREIGN KEY (field) REFERENCES <table>(field)

another table, used to link tables together


Alter table

7.3. Database Design and Normalisation ALTER TABLE <table-name>

ADD <field-name> <data-type> <null-value>

Use of normalisation
Remove data duplication ALTER TABLE <table-name>

Eliminate data inconsistency DROP COLUMN <column-name>

1st Normal Form: atomic data test


ALTER TABLE <table-name1>

2nd Normal Form: no partial key dependencies RENAME TO <table-name2>

3rd Normal Form: no non-key dependencies RENAME <column1> TO <column2>

All data must be atomic: no repeating


groups/attributes Delete a table

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

DROP TABLE <table-name>


Database implementation where database is put onto a
server and various users can access it
Update data Issue: information can be shared by multiple users using
different software at the same time
UPDATE <table-name>

Maintain database integrity


SET <field-name> = <value>

WHERE <condition>
Atomicity: any change must be fully completed or
data returns to original state
Insert data Consistency: values in database should not change
between devices
INSERT INTO <table-name> (field1, field2...)
Isolation: each operation must occur in isolation, with
VALUES (value1, value2...)
no interruptions
Durability: any changes must be maintained, with no
Delete data
data loss
DELETE FROM <table-name>
DBMS responsibilities
WHERE <condition>
Controls where data is stored,
The database structure,
DELETE * FROM <table-name>
Access permissions,
Data integrity,
DELETE FROM <table-name>
What data programs can see.
Managing concurrent access: reading is OK, issues come
TRUNCATE TABLE <table-name>

from attempts to write at the same time


Retrieve data Record locks: if record is opened by a user with edit
access, other users will be told it is locked until that
SELECT <field-name>
record is closed – prevents simultaneous editing
FROM <table-name>
Serialisation: data sent one-after-another. DBMS
WHERE <condition>
tracks edits and updates data in order of edits to
ensure data integrity
SELECT *

Time stamp ordering: each transaction is


FROM <table-name>

timestamped, that is used to sequence them, and


WHERE <condition>

DBMS uses this info to decide whether to process the


Order query results transaction or not
Commitment ordering: looks at timestamp and also
SELECT <field-name>
the change itself to decide if transaction is higher
FROM <table-name>
priority. Depends on nature of command and its
ORDER BY <field-name> ASC/DESC
impact on the database
Transaction processing: each database update should
Group query results be a discrete operation, that should either succeed or
fail. Should occur in some sort of logical order
SELECT <field-name>

FROM <table-name>

GROUP BY <field-name>

8. Big Data
HAVING <condition>

A catch-all term to describe data that doesn’t fit in normal


Access multiple tables containers (eg. databases)
Description
SELECT <field-name1, field-name2>
Volume: too much data to fit into a single server
FROM <table-name1, table-name2>
Velocity: high rate of data throughput to and from
SELECT <field-name1, field-name2>
servers, with responses expected in milliseconds
FROM <table-name1>
Variety: not constrained into structured data types
INNER JOIN <table-name2> ON <condition>
Structured data: can be defined using traditional
databases (fields and records)
LEFT JOIN <table-name2> ON <condition>
Unstructured data: does not easily fit into a standard
database structure, but still has a ‘standard’ structure
RIGHT JOIN <table-name2> ON <condition>

CROSS JOIN <table-name2>


8.2. Challenges
Lack of structure: data analysis is significantly difficult and
7.5. Client Server Databases relational databases cannot be used (data will not fit into

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

fields/records)
Machine learning: required to decipher patterns in
qualitative data in order to extract any useful information
Pattern recognition: in a review system; looks for
positive/negative words to reach conclusion
Artificial intelligence: computer learns for itself given
large amounts of data – predictive analysis
Size: relative to all applications, impact is most significant
when multiple servers are required to store data (eg.
relational databases do not scale well across multiple
servers and are therefore not appropriate)
Constant data streaming and change: sensors, clicks,
keyboard inputs, personal data etc…
Power demands: intense processing and storage
Correlations: do not always mean a result is found

8.3. Distributive Processing 9. Functional Programming


Required when data size and processing demands are so Paradigm
big that they cannot be handled by a single server
Main computer(s) allocate tasks to others; could be 9.1. Function Type
client-server or peer-to-peer
Distributed program: specifically written to be used in Function: a rule that for each element in set A’s input, an
a distributed processing environment (deals with output value is assigned, chosen from set B; without
concurrent access and data integrity) necessarily using every member of B
Functional programming: a solution to distributed Domain: a set from which input values are chosen
processing Co-domain: a set from which the functions output values
Features make it easier to write: are chosen. Not all need to be outputs
Correct code Function type: variable or parameter to which a function
Distributed code has or can be assigned, or an argument or result type of a
Supports: higher-order function taking or returning a function
Immutable data structures: data isn’t deleted f: A → B
Statelessness: no knowledge of what came before, f = function type
or after A = argument type
Higher-order functions: takes a function as a B = result type
parameter, produces a function as an output, or
both First Class Object

8.4. Modelling Big Data A function is a first-class object


In many programming languages, they may be integers,
Fact based model: each fact represents a single piece of characters, strings etc
information FCO: can be an argument to another function, as well as
the result of a function call. May:
Appear in expressions
Be assigned to a variable
Be assigned as argument
Be returned as function calls

Function Application

Function applied to its single argument


square :: Int → Int
square x = x*x
Graph schema for dataset structure A single argument could be a pair
Nodes: data entities in the data structure add :: Int → Int
Edges: relationships between data entities add (3,4) = 3 + 4 = 7
Properties: facts about data entities
Partial Function Application

WWW.ZNOTES.ORG
AQA A LEVEL COMPUTER SCIENCE

Passing through less than the full number of arguments odd and even can be used in addition to numerical
to a function that takes multiple arguments conditions
The function takes one argument after another in order filter (>3) [1, 2, 3, 4, 5..]
to produce a result = [4, 5..]
Example: add takes two integers and produces an integer Fold (reduce): reduces a list of values to a single value by
result repeatedly applying a combining function to the values
‘Add 4’ produces a function Returns: a single value
This function is then applied to another integer (3) Operator: (operator)
So 4 is added to 3 to produce an integer result of 7 Start value: number between operator and list
add :: Int → Int → Int fold (+) 0 [1, 2, 3, 4, 5..]
add x, y = x + y = 15
add 4 = 4 + y
add (4 + y), 3 = 4 + 3 = 7 9.3. Lists in Functional Programming
Composition of Functions Lists are powerful data structures, where all the elements
are homogeneous
Combining multiple functions to produce a new one
A list is always written in square brackets; []
Composition of g and f  (g ○ f)
Identifier: the name of the list
g: B → C
myList = [1,2,3,4,5] or myList = [1..5]
f: A → B
Head: single first element in a list
g ○ f is a new function
Tail: remainder list once head has been removed
Domain: A
Head:tail: lists can be represented as a combination of
Co-domain: C
the list tail prepended onto the head
F is applied first, then g
1:[2, 3, 4, 5]
f(x) = x + 2
Empty list: a list can be empty, show by []
g(y) = y³
List operations
g ○ f = (x + 2)³
Return list head
head myList = 4
9.2. Writing Functional Programs Return list tail
tail myList = [2, 3, 4, 5]
Higher order function: takes a function as an argument, Test for an empty list
or returns a function as a result, or both null myList = false
Map: applies a given function to each element of a list Return length of list
Returns: a list length myList = 5
map (^2) [1, 2, 3, 4, 5..] Construct an empty list
= [1, 4, 9, 16, 25..] let myList2 = []
Filter: processes a list in an order to produce a list Prepend to list (must be element)
containing exactly the elements from the original list that 6:myList = [6, 1, 2, 3, 4, 5]
match given conditions Append to list (must be list)
Returns: a sublist myList ++ [6, 7, 8] = [1,2,3,4,5,6,7,8]

WWW.ZNOTES.ORG
AQA A LEVEL
Computer Science

Copyright 2022 by ZNotes


These notes have been created by Rueben Allan for the 2015 syllabus
This website and its content is copyright of ZNotes Foundation - © ZNotes Foundation 2022. All rights reserved.
The document contains images and excerpts of text from educational resources available on the internet and
printed books. If you are the owner of such media, test or visual, utilized in this document and do not accept its
usage then we urge you to contact us and we would immediately replace said media.
No part of this document may be copied or re-uploaded to another website without the express, written
permission of the copyright owner. Under no conditions may this document be distributed under the name of
false author(s) or sold for financial gain; the document is solely meant for educational purposes and it is to remain
a property available to all at no cost. It is current freely available from the website www.znotes.org
This work is licensed under a Creative Commons Attribution-NonCommerical-ShareAlike 4.0 International License.

You might also like