Академический Документы
Профессиональный Документы
Культура Документы
★ Clicking in a box
★ Performing a simple sum
★ Identifying street signs in images
Physiological
★ Fingerprint
★ Hand
★ Iris / Retina
★ Face
★ DNA
Used to avoid code repetition, structure Breaking a larger problem apart in order
code properly and make code more to make it easier or more straightforward
readable. to solve.
Variables inside subroutines are local Can often reveal patterns which allow
(unless specified as global) and are only previous solutions to be applied to new
available to the subroutine. situations.
Procedures Functions
Used mainly to structure code and avoid Used to hide a mathematical or logical
reptition of code in a whole solution. operation behind a simple interface.
Arrays One dimensional array
Allow data to be collected, accessed and Behaves like a single list. Each item is
manipulated under one variable name. Each accessed using its index.
item in an array is accessed using its
index. 0 1 2 3 4
names Mark Fred Alice Leanne Tracy
Technically, arrays are fixed length data
structures which need to be declared
before they are used. For instance, to >>> names[2]
create a 7 element array, diggers ... 'Alice'
Python REPL
ARRAY diggers(7)
Pseudocode
Behaves like a table. Each value can be Enable operations on lists. Vary with
accessed using a combination of its row programming languages but in Python ...
index followed by its column index.
list.append(item)
scores 0 1 2 3 4 list.insert(position,item)
list.sort()
0 5 2 4 7 2 list.pop()
1 2 3 7 6 4 list.count(item)
list.reverse()
2 6 2 1 4 6 list.index(item)
separator.join(list)
3 8 4 9 2 4
Python
4 4 5 2 7 8
>>> scores[3][2]
9
Python
Dictionaries
cars = {"red":3,
"blue":5,
"yellow":2}
>>> cars["blue"]
5
Python
Character methods Characters
Extended ASCII
Unicode
A set of agreed standards designed to Every networkable device in the world has
make communication fast, reliable and a different MAC address used to uniquely
error free. identify the device. 48 bit binary code
written in hexadecimal (makes it easier
De Jure to read / recognise).
64.233.167.94
IP Addresses are like postcodes and give
the location of a computer / group of
computers.
The World Wide Web (WWW) Unform Resource Locator (URL)
Maps domain names (website addresses) to ★ Data is hosted in 'server farms' all
IP addresses so you don't have to over the world
remember the IP address of your favourite ★ Massive 'redundancy' makes data
website. secure
★ Must be connected to a network to
access data
★ Elastic storage
★ Monthly fees can be high
★ Data can be accessed from everywhere
in the world
★ Major benefit : offsite backup
Check digits Check digits
Parity bit
A digit added to the end of a sequence of
numbers or characters which is calculated Most significant (leftmost) bit in a
from numbers or characters in the binary string is toggled to enforce
sequence. Used to check for errors. either even or odd 1s in the number.
1 0 1 1 0 0 0
Original value - three 1s
1 1 0 1 1 0 0 0
Converted to EVEN p
arity
0 1 0 1 1 0 0 0
Converted to ODD parity
Simple text files which websites store on Parallel : data sent simultaneously
your computer when you visit them. Serial : data send individually
★ Personalisation options
★ Contents of your basket
★ Most recent browsed pages
★ Login information
What is a cookie?
Caeser Cipher
Key of 6
Comparison operators Boolean operators
Reorganises files on the surface of hard Safeguards data from accidental loss,
disk drives to make them 'contiguous' - corruption or theft.
in order. Provides faster file access.
Not used for SSD as extra write Full
operations shortens the lifespan of the
drive. Backup of every file is taken
Takes a long time to complete
Incremental
Uses special algorithms to reduce size of Scrambles sensitive data using a 'key'
files. (usually a password) to stop other people
/ computers reading the data.
Helps to save storage space and also
speed up data transfer.
HIGH level
Translates mnemonic based assembly code Translates the whole of the source code
into machine code all at once. into object code (machine code) which is
then executed by the processor.
Intelligent device with multiple NICs (32 Device responsible for transmitting (or
or 64) which transmit data between routing) data between networks based on
computers based on their Media Access their Internet Protocol (IP) address.
Control (MAC) addresses.
Transmits data in packets.
Coaxial
★ Single copper
★ Shielded to prevent interference
★ Short distance
Fibre Optic
★ Overlapping channels cause
★ Plastic / glass interference
★ Transmit data with light ★ Requires Wireless Access Point (WAP)
★ Long distance / Wireless switch
★ Does not suffer from interference ★ Implemented using security (WPA, WPA2
or TKIP)
Client-server network Peer-to-peer network
Network managed by a server which handles All machines are 'equal'. Users, files
logins, file sharing, permissions. All and permissions are managed at the
other devices are clients (wired or individual machines.
wireless).
★ Home networks
★ All machines equal
★ Mainly used in businesses ★ No centralised managment
★ Relience on server
★ Central managment
Network is physically laid out in a star Each device is connected directly to each
shape. All devices connected together other device. Mainly implemented using
using a single switch or hub. Wireless rather than cable.
★ Cheap
★ Reliable ★ New technology
★ Relience on switch ★ Fastest routes used
Virtual network Benefits of networking
A good network policy should advise ... White hat hackers employed to test for
vulnerabilities in a computer system and
★ Regular security testing report back to company.
★ Insistence on strong passwords
★ Regular password updates
★ User access levels
★ Antivirus / firewall software
★ No removable media
★ Encryption
★ Passive ★ Virus
★ Active ★ Worm
★ Insider ★ Trojan
★ Brute force
★ Denial-of-service Actions
Databases Databases
INSERT INTO UPDATE
Structured Query Language command used to Used to update records by searching for a
insert data into a table ... record using the value in one of its
field and specifying a new value for its
INSERT INTO employees VALUES fields.
(1,'John',15.01.75,'J2',19000)
(2,'Karen',27.07.70,'J5',27000) Update Karens pay
(3,'Bert',12.08.65,'Z1',26000)
UPDATE employees
SQL SET salary = 29000
WHERE id = 2
You can also insert individual fields SQL
(the other fields take a default or
automatic value) ...
Retrieve data from the database by Filter data from a database based on
searching for values in given fields. criteria / patterns
All details for all employees Employees with pay > 20000
SELECT * FROM employees ROM employees
SELECT name F
WHERE pay > 20000
SQL
SQL
Employees
Employees with pay > 20000 in dept J5
SELECT name FROM employees
SELECT name FROM employees
SQL WHERE pay > 20000
AND dept = 'J5'
Employees and their pay
SQL
SELECT name, pay FROM employees
SQL Employees with pay > 20000 or in departmentss
starting with the letter J
SELECT name FROM employees
WHERE pay > 20000
OR dept LIKE 'J%'
SQL
Databases
ORDER BY
Storing a value in the computers memory A value in the computers memory which can
and labelling it with a 'name' to allow change during program execution.
you to make reference to it later in your
code. Variables are given a name to allow you
to make reference to them during program
>>> name = 'Tarquin' operation.
>>> widgets = 12
>>> price = 9.62 There are rules to variable names :
>>> paid = False
Python REPL ★ Only letters, numbers and underscores
★ Can't start with a number
name ← 'Tarquin'
★ Cannot be a keyword from the
widgets ← 12 programming language
price ← 9.62 ★ Cannot contain spaces
paid ← False
Pseudocode
Constants Input
Values stored in the computers memory Asking the person using the computer to
which are not changed during program either type something in using the
execution. keyboard or select something using a
mouse or get a signal from a sensor.
Constants allow ...
>>> name = input('Enter your name : ')
★ Mathematical values (like π) to be Enter your name : Mark
represented in the code as a name >>> print(name)
rather than a value. Mark
★ Values to be referenced in the code Python
using a name rather than a value
allowing the value to be used many
times in the code.
>>> PI = 3.14159265
>>> PAYRATE = 16.52
Python
Programmer VS User
Programmer
User
0 + 0 = 0 (obvious)
0 + 1 = 1 (obvious)
1 + 0 = 1 (obvious)
1 + 1 = 10 (not so obvious)
28 0 0 0 1 1 1 0 0
NOT 1 1 1 0 0 0 1 1
-128 64 32 16 8 4 2 1
+1 1 1 1 0 0 1 0 0
★ Test reference
★ Scope of test
★ Type (BNE)
★ Input values
★ Expected result (Reference)
★ Actual result (Reference)
★ Corrective action (Reference)
Input devices Sensors
★ 2D / 3D scanners ★ Light
★ Barcode readers ★ Temperature
★ Quick Response (QR) code readers ★ Magnetic field
★ Digital cameras ★ Gas
★ Keyboards ★ Pressure
★ Mice ★ Moisture
★ Touch screen ★ Humidity
★ Interactive whiteboards ★ pH
★ Microphones ★ Motion
Output devices
★ Inkjet printer
★ Laser printer
★ 3D printer
★ 2D and 3D cutters
★ Speakers and headphones
★ Actuators
★ LCD display
★ LED display
Random Access Memory (RAM) Read Only Memory (ROM)
Volatile primary storage which holds the Non volatile - does not need power to
data and instructions / programs hold it's data.
currently executing and requires power to
retain it's data. Holds the boot up program used when the
computer first starts (boot strap) known
The 'random' in RAM means that the memory as the BIOS (basic input output system).
can be accessed directly rather then
sequentially (one after another). Can only be read from, not written to.
RAM can be read from or written to. Can be 'flashed' (reprogrammed) using
special software or hardware.
Instructions held in ROM which tell the An area on the hard disk used as memory.
computer how to boot up correctly. Used when RAM is too small to deal with
the amount of instructions. Effects the
Performs self checks of memory and check performance of the computer because the
which hardware is present loading certain access time on the hard disk drive is
device drivers. slow.
Iteration / Repetition Iteration / Repetition
FOR - NEXT WHILE
Counter controlled loop will work through Condition controlled loop which checks a
every value in an 'iterable' object condition at the start and only executes
(range, string, list) setting a loop it's body if the condition is TRUE .
variable to each value in the iterable in
turn. WHILE condition
while_body
FOR value IN iterable Pseudocode
for_body
Pseudocode
Condition controlled loop which checks a Condition controlled loop which checks a
condition at the end of the body and only condition at the end of the body and only
executes it's body again if the condition executes it's body again if the condition
is FALSE . is TRUE .
REPEAT DO
repeat_body do_body
UNTIL condition WHILE condition
Pseudocode Pseudocode
Types of storage Hard Disk Drive (HDD)
Internal secondary storage devices with Solid-state memory used as low cost
no moving parts. secondary storage in portable devices and
as removable memory, e.g.
★ Much faster than HDD
★ More robust ★ USB memory stick / flash drive
★ Expensive / MB ★ Secure Digital Card (SD)
★ Don't slow with fragmentation of ★ Micro SD Card
files
Optical disk Magnetic tape
Data is read and written using low power Single length (>250m) of plastic tape
laser. Technique varies between discs. covered in magnetic particles.
BOTH inputs need to be ON (1) for the At least one inputs need to be ON (1) for
output to be ON (1) output to be ON (1)
A B Q A B Q
0 0 0 0 0 0
0 1 0 0 1 0
1 0 0 1 0 0
1 1 1 1 1 1
The output is opposite to the input A table that contains all of the inputs
and output combinations for a logic gate
or a logic circuit.
A Q
0 1
1 0
Selection Selection
IF - THEN - ELSE SWITCH - CASE
+ Addition
- Subtraction
* Multiplication
** Exponentiation (powers)
/ Float division
Computers recognise different types of Converting one data type into another to
data. The data type determines what enable different processing to be
processing can be performed with the performed.
variable
int(value) Convert to integer
Integer Whole numbers
float(value) Convert to float / real
Float / Real Decimal
bool(value) Convert to boolean
Boolean Two values
str(value) Convert to string
Character Letter, number or symbol
What is information?
Hexadecimal Hexadecimal
Base 16 number system with symbols for 16 Only one symbol per value, so ...
digits. We only have symbols for 0 to 9
so we have to use A to F as well. Denary Binary Hex
0 0000 0
0123456789ABCDEF 1 0001 1
2 0010 2
Hexadecimal is used to represent binary 3 0011 3
because it's easier for humans. 4 0100 4
5 0101 5
1 0 1 1 0 1 0 1 6 0110 6
7 0111 7
B 5 8
9
1000
1001
8
9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
Operating system (OS) User interface
★ Made up from dots called pixels Number of pixels per given area. The
★ A pixel is the smallest part of the higher resolution images look sharper
image that can be identified than lower resolution images when
★ Colour of each pixel represented by displayed at the same size because the
an n-bit binary code pixels are smaller.
33 x 26 Bitmap Image
Resolution is measured in Dots Per Inch
(DPI) for printers and Pixels Per Inch
(PPI) for screens.
01 00 00 00 01
24 bit colour uses 8 bits (0-255) to Without metadata, the device would not be
represent the levels of red, green and able to display the image.
blue in the image.
Decimal prefixes Binary prefixes
bit b 0 or 1 bit b 0 or 1
Flowcharts Flowcharts
Symbols Sequencing
Flowcharts use different shaped symbols Doing one thing after another ...
for different actions ...
Flowcharts Flowcharts
Selection Repeat ... Until
Flowcharts
While / For
Compression Compression
Lossless Run Length Encoding (RLE)
Does not remove any detail from the file Replaces runs of similar data a single
so when it decompressed, it is the same data item and the number of times it
as the original. appears ...
E; 1
B; 010
R; 011
T; 000
_; 001
0 0 0 0 1 1 1 1 0 0 1 0 1 0 1 1
T R E E _ B E E
Search algorithm Search algorithms
Linear search Binary search
Compares adjacent items and swaps if Puts each item into the sorted portion of
necessary. Continues until no more swaps a list in the correct place.
or last one item left in unordered list.
Sound waves are analogue (continually The frequency (samples per second, units
varying). Computers can only store sounds Hz) at which the amplitude of the
digitally (using binary). analogue wave is measured.
Sound Sound
Sampling resolution Bit rate
Number of bits (n) used to store the size Number of bits used to represent one
of each sample. Maximum amplitude of second of sampled sound.
analogue wave is broken down into 2n
possible values. Given by ...
0 1 2 3 4 Python REPL
H E L L O
String methods
Analysis Design
Processes data and instructions. Rate at which the Central Processing Unit
can perform operations, e.g. 4GHz - this
Central processing units often have means the CPU can perform 4 billion
multiple cores e.g. Dual core (2) or Quad operations per second.
core (4). Multicore processors are more
efficient because the cores can be given ★ Clock speed has implications for
jobs to perform simultaneously. power usage
★ Clock speed has implications for heat
generation
Slower than registers but faster than RAM Programs and data are held in separate
and holds regularly used data. memories. Often used in embedded systems
(microcontrollers) where the program does
A bit like a handbag containing essential not change.
items.
Control unit Arithmetic and Logic Unit (ALU)
Coordinates the actions of the CPU. This is responsible for all the
arithmetic and logical operations in the
It sends out control signals to other CPU. E.g., Add, Subtract, divide,
parts of the CPU and controls data flow multiply, And, Or, Not, binary shifts.
inside the CPU.
The ALU contains the Accumulator.
The Control Unit decodes and executes
instructions following the Fetch - Decode
- eXecute (FDX) cycle.
Program Counter This holds the MEMORY This stores the results of any
address (location) of the next calculations performed by the Arithmetic
instruction to be executed. and Logic Unit (ALU).
Memory Data Register (MDR) Registers
Memory Buffer Register (MBR)
Registers are very fast memory locations
Acts as a buffer, a storage place for on the CPU which help it to keep track of
data that is "on its way" to somewhere what it's currently doing. Register store
else. It holds data which has been data and the instructions.
requested by the CPU from the memory or
data which the CPU has requested is The main registers are the ...
written to memory.
★ Memory Data Register (MDR)
★ Memory Address Register (MAR)
★ Program Counter (PC)
★ Accumulator (ACC)
The memory address register – This holds Each CPU core carried this process out
the address (location of) the place in billions of times per second!
memory that will be read during the FETCH
of the CPU.
TCP/IP is most important but there are Data passes through layers on it's way to
many, many others. and from clients and servers.
Verification
Environmental
The impact on the natural world.
Trolling
Legislation Legislation
Data Protection Act 1998 Freedom of Information Act 2000
S – keep data SECURELY This is a law that gives you the right to
L – keep data LAWFULLY access information held by public
E – Only within the EU authorities E.g. government, health
E – Not EXCESSIVE data service, schools, police, courts
P – Only for PURPOSE intended
Issues
★ Internet
★ Illegal file sharing
★ Copying for personal use