Revision Notes - All Subjects
Revision Notes - All Subjects
COMPUTER SCIENCE
Topic list:
➔Topic 1:Theory
◆ 1-1:Systems Architecture
◆ 1-2:Memory & Storage
◆ 1-3:Networks
◆ 1-4:Network Security
◆ 1-5:Systems Software
◆ 1-6:Impacts
➔Topic 2:Programming
◆ 2-1:Algorithms
◆ 2-2:Programming Fundamentals
◆ 2-3:Producing Robust Programs
◆ 2-4:Boolean Logic
◆ 2-5:Languages & IDEs
1-1: Systems Architecture
Topic Contents:
1 .1a -The CPU
1.1b -Registers & The FDE Cycle
1.2 -CPU Performance
1.3 -Embedded Systems
CPU Components
The CPU has 4 major components:
- TheControl Unit(CU)
- TheControl Unit(CU) sends control signals to direct the operation of the CPU.Controlsignals
andtiming signalsare sent to theALU and other componentssuch as RAM. It also decodes
instructions as part of theFDE cycle.
- TheArithmetic Logic Unit(ALU)
- ALU stands for'Arithmetic and Logic Unit'. It performssimple calculationsandlogical
operations.
- TheRegisters
- A register is atemporary storage spaceforone instruction or address. Different registers are
used during theFDE cycle.
- TheCache
- Cache memoryis used to temporarily store data that isfrequently accessed. Cache memory is
split intodifferent levels. Cache isslower to access than the registersbutmuch faster than
RAM.
Computer Architecture
he way acomputer is designed and structuredis known as itsarchitecture. The most common type of
T
computer architecture is theVon Neumann Architecture.
his architecture is named afterJohn Von Neumannwho developed the concept of a stored program
T
computer in the 1940s. Before being able to store programs in memory, instructions had to be manually input
by a human. A computer with Von Neumann architecture stores both program instructions and data in the
same memory (RAM).Other architectureslike Harvard have two separate memories -one for program
instructions and another for data. Data is transferredbetween componentsonpathwayscalledbuses.
Von Neumann Architecture
Important Registers
register is asmall storage spacefortemporary datain the CPU. Each register has aspecific role. There
A
areFour essential registersused in the FDE cycle:
- TheProgram Counter(PC)
- A register that tracks theRAM addressof thenext instructionto befetched.
- TheMemory Address Register(MAR)
- A register thattracks the RAM addressof the instruction that is to befetched.
- TheMemory Data Register(MDR)
- The MDR stores theinstructionthat has beentransferred from RAM to the CPU.
- TheAccumulator(ACC)
- The ACC stores theresult of mathematical or logical calculations.
- The Current Instruction Register (CIR)
- A register that stores the instruction that has been fetched from RAM, and is about to be
decoded or executed
FDE Cycle
he essential idea of the F-E cycle is that instructions are fetched from RAM, to be decoded (understood) and
T
executed (processed) by the CPU. The Cycle is as follows:
1. T heProgram Counter(PC) register displays the address in RAM of thenext instructionto be
processed. This value is copied into theMemory Address Register(MAR)
2. The PC register is increasedby 1. This prepares the CPU for the next instruction to befetched
3. The CPUchecks the addressin RAM whichmatchesthe address held in the MAR
4. The instruction inRAMistransferredto the Memory Data Register (MDR)
5. The instruction in theMDRiscopiedinto the Current Instruction Register (CIR)
6. The instruction in theCIRisdecoded(understood) andexecuted(processed). Any result of an execution
is stored in theAccumulator(ACC) register
7. The cyclerepeatsbyreturning to the first stepandcheckingthe program counter for the address of
thenext instruction
Cache Memory
What is cache memory?
- Cache memory is temporary storage for frequently accessed data.
How does cache memory improve performance?
- Cache memory is closer to the CPU than RAM, meaning that it can provide data and instructions to the
CPU at a faster rate. A computer with more cache memory (e.g. 8GB instead of 4GB) should have a
higher performance because repeatedly used instructions can be stored and accessed faster.
What is the limitation of cache memory?
- Cache memory is costly, so most computers only have a small amount.
Clock Speed
What is clock speed?
- Clock speed is the measure of how quickly a CPU can process instructions. Clock speed is measured in
Gigahertz (GHz). A typical desktop computer might have a clock speed of 3.5 GHz. This means it can
perform 3.5 billion cycles a second.
Core Count
What is a core?
- A core is a complete set of CPU components (control unit, ALU and registers). Each core is able to
perform its own FDE cycle. A multi-core CPU has more than one set of components within the same
CPU.
How does the number of cores improve performance?
- In theory, a single-core processor can execute one instruction at a time, a dual-core processor can
execute two instructions, and a quad-core can execute four instructions simultaneously. Therefore, a
computer with more cores will have a higher performance because it can process more instructions at
once.
What are the limitations of having more cores?
- If one core is waiting for another core to finish processing, performance may not increase at all. Some
software is also not written to make use of multiple cores, so it will not run any quicker on a multi-core
computer.
n embedded system is a computer system built into a larger machine to provide a means of control.
A
Embedded systems perform a specific pre-programmed task which is stored in ROM. An embedded system
uses a combination of hardware and software. They perform only specific tasks and often have a small
amount of storage and low processing power.
rogram instructions and data must becopiedfrom the hard drive into RAM to be processed by the CPU
P
becauseprimary storageaccess speeds are muchfasterthan secondary storage devices like the hard drive.
Virtual Memory
rograms must bestored in RAMto beprocessedby the CPU. Even if there is insufficient space in RAM for all
P
programs the computer can use thehard disk drive(HDD) as anextension of RAM- this is calledvirtual
memory. If new data is needed to be stored in RAM thenunused datain RAM is moved to thehard driveso the
new data can be transferred into RAM. If the original data is required again, it can bemoved backfrom
virtual memory into RAM. Using virtual memory is beneficial because it allowsmore programsto be run at the
same time withless system slow down.
econdary storage isnon-volatilestorage used tosave and storedata that can beaccessed repeatedly.
S
Secondary storage isnot directly embeddedon the motherboard (and possibly even external) and therefore
further away from the CPU so it isslower to accessthe primary storage.
Magnetic Storage
magnetic hard disk drive (HDD) is themost common form of secondary storagewithin desktop computers.
A
Aread/writehead movesnanometresabove the disk platter and uses the magnetic field of the platter toread
or editdata. Anobsolete(no longer used) type of magnetic storage is a floppy disk but these have been
replacedbysolid state devicessuch as USB sticks which are much faster and have a much higher capacity.
Another type of magnetic storage that is still used ismagnetic tape. Magnetic tape has ahigh storage
capacitybut data has to be accessed inorder(serial access) so it is generally only used bycompaniesto back
up or archivelarge amounts of data.
Optical Storage
ptical storage uses a laser to project beams of light onto a spinning disc, allowing it to read data from a CD,
O
DVD or Blu-Ray. This makes optical storage the slowest of the four types of secondary storage. Disc drives are
traditionally internal but external disc drives can be bought for devices like laptops.
2.3 - Units
ll computer systemscommunicate,process, andstoredata using binary. Binary is anumber system
A
consisting entirely of0sand1s. Computers use binary as they consist ofbillionsof tinytransistorswhich are
switches that only havetwo values-on(1) oroff(0). Therefore all datamust be representedin this way.
Everything a computer needs to process must be converted into a binary format including text, images, videos,
and audio.
Hexadecimal
exadecimal is abase 16(sixteenpossible values per character -0 to 16) number system. It is used as a
H
shorthandfor binary because it usesfewer charactersto write thesame value. This makes hexadecimal less
prone toerrorswhen reading or writing it, compared to binary.
Hexadecimalonlyusessingle-charactervalues. Double digit numbers are converted into numbers (Ato F
instead of10 to 15).
Binary to Hexadecimal [OCR]
Hexadecimal to Binary [OCR]
To convert fromHexadecimaltoDenary(or inverse) you need to convert either one toBinaryfirst.
Ascii
SCII (American Standard Code for Information Interchange) is a common character set which does not take
A
up much memory space. It is important to understand that the number of characters that can be stored is
limited by the bits available -ASCII uses 1 byte (8 bits)which only gives 256 possible characters. This is enough
for the English language but it can’t be used for other languages or all punctuation symbols.
Unicode
nicode is a more popular character set because it uses2 bytes (16 bits) that allow for 65,536 possible
U
characters.The extra byte allows many different languages to be represented, as well as thousands of
symbols and emojis. HoweverUnicode requires more memoryto store each character than ASCII as it uses an
extra byte.
—--
Character sets are logically ordered. For example, the binary code forA is 01000001, B is 01000010 and C is
01000011as the code increases by 1 with each character.
The file size of a text file is calculated with the equation: bits percharacter x number of characters
2.4c - Image Storage
Bitmap Images
itmap images are made of pixels -single-colour squares- arranged on a grid. Each pixel is assigned a
B
binary value which represents the colour of that pixel. The quality of a bitmap image depends on the total
amount of pixels, this is known as theimage resolution.Because it is made up of pixels, scaling up a bitmap
image will result in a visible loss of quality. Most images on computers are bitmaps, such as photos and
screenshots.
Vector Images
ector images are drawn by the computer following precise mathematical instructions to create lines and
V
objects. Vectors are usuallysmaller in file size compared to bitmapsbecause each pixel in a bitmap isstored
as an individual binary value. Vectors can be scaled up without any loss of quality and are typically used for
logos and animations.
Sample Rate
he sample rate (sampling frequency) is the number of times per second the amplitude of the sound wave is
T
measured. It is measured in kilohertz (kHz), for example CD quality is 44.1kHz (44,100 samples per second).
The higher the sampling rate is, the better the quality is, but also the larger the file size is.
Bit depth
he bit depth is the number of bits available to represent each sample. For example, a sample with a bit depth
T
of 4 could be 0101 or 0110. A sample with a bit depth of 8 could be 01010111 or 11010100. A common bit depth is
16 bits.
The higher the bit depth, the more bits are available to be used for each sample. Therefore the quality is often
higher as the wave more closely resembles an analog wave.
The file size will also be larger if the bit depth is higher, as each sample stores additional bits.
2.5 - Compression
What is compression
To compress a file is to make the file size smaller. There are many benefits to compression, such as:
- Files are smaller (naturally)
- Files can be transferred easier
- Files can be read from or written to quicker
There are 2 methods of compression; Lossy and Lossless compression.
Lossy Compression
ossy compression uses an algorithm to analyse a file and remove data that cannot be heard or seen by
L
humans. For example, a lossy algorithm would analyse the sound waves of an audio file and remove any
frequencies that humans cannot hear. This process reduces the size of the file.
Further lossy compression will remove data that humans can see/hear. Lossy compression removes the data
permanently, so the file can never return to its original form. It is often used with images, audio, and video to
reduce the file size, for example to send over the internet.
Lossless Compression
ossless compression reduces the file size without removing any data. Because of this, the file is returned to its
L
original form when decompressed, so no quality is lost. A file that is compressed with a lossless algorithm is
sually larger than a file compressed with a lossy algorithm because no data has been permanently removed.
u
Lossless compression is used with files that would not work if data was removed, for example .exe files or word
documents.
1-3: Networks
Topic Contents:
.1a- Network Types & Performance
3
3.1b- Network Hardware & Internet
3.2a- Wired & Wireless networks
3.2b- Protocols & Layers
ther network types do exist, such as aMetropolitanArea Network (MAN)for computer systems connected
O
across a town or city, or aPersonal Area Network(PAN)for devices connected and used by anindividual.
Client-Server Network
lients make requests to a server, the server manages that request, and then responds. For example, if the
C
user (client) makes a request to access docs.google.com to a web server.
Large services like Amazon and Google will need very powerful servers to handle millions of requests a second.
The client is completely dependent on the server to provide and manage the information. The server controls
network security, backups and can be upgraded to manage higher demand.
Advantages: Disadvantages:
- T he network can becontrolled centrally - L arge amounts of traffic congestion will cause
from the server toeasily backup dataand the network toslow down.
update software. - If a fault occurs with the server then thewhole
- Hardware, software and resources can be network will fail
shared across the network, such as - IT Technicians may be required tomanageand
printers, applications and data files. maintain the network
- The network allows forimproved - Malware, such as viruses, canspread quickly
scalability, meaning more clients can be across the network.
easily addedto the central server.
Data Packets
hen sending data across a network, files are broken down into smaller parts called
W
data packets. Whole files are too large to transfer as one unit so data packets allow
data to be transferred across a network quickly. Each packet of data is redirected
by routers across networks until it arrives at its destination. Data packets may split
up and use alternative routes to reach the destination address. When all the packets
have arrived at the destination address the data is reassembled back into the
original file.
Network Topologies
etwork topology refers to layout of computer systems on a local network. Devices
N
in a network topology diagram are often called 'nodes'. Two types of typology are
star and mesh.
Star Topology
ach computer system is connected to a central device, usually a hub or switch.
E
How it works:
- Each computer system is connected to the central hub or switch and transfers its
data packets there.
- The hub or switch looks at the destination address and transfers the packets
directly to the intended computer.
Advantages: Disadvantages:
• A star topology has improved security because • Extra hardware (the hub or switch) is required to be
data packets are sent directly to and from the hub / purchased, installed and maintained.
switch in the centre and not necessarily all devices • If the central system (the hub or switch) fails then
like in a bus or ring topology. the whole network will be unusable until the error is
• New systems can be attached directly to the central fixed.
system so the network doesn't need to be shut down.
System failures of attached computers won't usually
cause complete network failure.
• Transfer speeds are generally fast in a star
topology as there are minimal network collisions.
Mesh Topology
I n afull mesh network, each computer system is connectedto every other computer
system. There is also apartialmesh network whereonlysome nodes(e.g. a printer)
are connected to every other node.
How it works:
- Data packets are transferred to the destination address along the quickest
path, travelling from node to node
- If a pathway is broken, there are many alternative paths that the packets can take
Advantages: Disadvantages:
• If one cable or system fails thendata packetscan • Because of thepossibly largeamount of cables
take analternative routeand still reach the required (esp in afull meshtopology) this network
destination address. layout can beexpensivetoinstall and maintain
• Because of the large possible number of systems •Redundant cablingshould be avoided - which is
and connections, a mesh topology can usually where cables are connected between systems that
withstand large amounts of data traffic won'teverneed to communicate
•New systemscan beaddedto the networkwithout
disrupting the entire topology
Performance
There are several factors that can affect the performance of a network, such as:
1. Bandwidth- Max amount of data that can be sent acrossa network at any point
2. Number of users at the same time- The number of usersaccessing the network
3. Number of data collisions- 2+ data packets tryingto occupy the same channel at the same time
4. Interference- Obstacles that may block signal slightly(eg, thick walls)
5. Transmission Media- The method of data transmissionacross the network
6. Distance to travel- How far the data has to travelto reach its destination
7. Signal strength- How well the signal is transmittedacross a network
8. Amount of data to transfer- How much data is beingtransferred across the network
9. Applications being used- The amount of applicationsasking for data across the network
10.Server CPU performance- The performance capabilityof the CPU in the server router
11. Network Latency- The time that data takes to transferacross the network
outer
R
Routersare used totransfer data packets betweennetworks.Routersreceive data packetsand use theIP
Address in thepacket headerto determine thebestrouteto transmit the data. Data is transferred from
router to routeracross the internet towards thedestination.A router stores the IP address of each computer
connected to iton the network and uses a list calledarouting tableto calculate the quickest and shortest
route to transfer data.
witch
S
Aswitchis used toconnect devices togetheron aLAN.
Itreceives data packetsfrom a connected node,readsthe destination address in the packet headerand
forwards the data directlyto its destination.
A switch willgenerate a list of the MAC addressesof all devices connectedto itwhen it receives data,and
musescan for a matching destination addressbeforesending.
An alternative to a switch is ahubbut ahub is slowerand less secureas itforwards a copy of receiveddata
to all connected nodes.
ransmission Media
T
Although not technically a device thecommunicationchannelalong which data is transferred willaffect
performance. Three common types of transmission mediainclude:
● Ethernet cables- used typically on aLANtotransferdatabetween nodes and hardware such as
switches
● Fibre Optic cables-very fastbutmore expensiveandfragilecables typically used tosend data
quickly along a WAN. Data is sent aspulses of light.
● Coaxial cables-older, slower, coppercables thatare not used as much in modern times as they can be
affected by electromagnetic interference.
The Internet
hat is it?
W
The internet is aglobal networkofinterconnectednetworks, Theworld wide web(W WW) is not the sameas
the internet. It is a way ofaccessing information,using protocols such asHTTPStoview webpages(suchas
the tab ofYoutubeopen in the background).
Serversprovideservices on the internet, such asaweb serverwhichresponds to the web browser(client)
requesttodisplay a web page. The web serverprocessesthe client requestto prepare the web page and
return it so the web browser candisplay it to theuser.
Awebsite must be hosted(stored) on a web serverso that it can be accessed by others using the internet.
Aunique domain name(eg. google.com) must be registeredwith adomain registrar- this is a company that
checks if the name is valid andnot already taken
DNS Servers
he Cloud
T
Thecloudrefers tonetworks of servers accessed onthe internet. Cloud computing is an example ofremote
service provision. Cloud servers can have differentpurposes such asrunning applications,remote processing
andstoring data.
When you store data in ‘the cloud’, using services such as Google Drive or Dropbox, your data is stored on
large serversowned by thehosting company. The hostingcompany (such as Google) is responsible for
keeping the servers running and making your dataaccessibleon the internet.
Cloud storage isvery convenientas it allows peopleto work on a file at thesame timeand it can beaccessed
fromdifferent devices. However, if the internetconnectionfails, or the servers areattackedthen the data
could be inaccessible.
ebsite Creation
W
To create a website, you need to:
- Create the webpage
- Purchase ahosting agreement
- Register adomain name
- Adomain nameis the unique website name that peopletypein the browserURL barto visit your
website. The domain name is associated with theIPaddress of the host computeror webs
server when it is registered
Client Server
Central Backupserver backs up all file servers,where security is controlled by a central server. All users are
A
reliant on the central server. Using servers enables businesses to grow hundreds or thousands of computers
and users
Peer-to-Peer
ach computer needs to be backed up, and security is controlled by each individual machine. There is no
E
central server. If one computer goes down then only its services are lost. Peer-to-Peer networks are difficult to
maintain beyond a few computers
Advantages: Advantages:
- E asier to manage security files - ery easy to maintain
V
- Easier to take backups - Specialist staff are not required
- Easier to install software updates to all - No dependency on a single computer
computers - Cheaper to set up
Disadvantages: - No expensive hardware required
- an be expensive to set up
C Disadvantages:
- Requires IT specialists to maintain - T he network is less secure
- The server is a single point of failure - Users will need to manage their own backups
- Users will lose access if the server fails - Can be difficult to maintain a well ordered file
Wireless Networks
ireless Networks, such as WiFi or Bluetooth, use no cables but require a Wireless Network Interface Card
W
(WNIC).
The most common type of wireless connection used in LANs is WiFi. Devices communicate using a Wireless
Access Point
Wireless connections generally have a slower speed and can be affected by the computer’s distance from the
router as well as obstacles like walls and bad weather
1. Slower Speed
2. Less Secure
3. Free Movement
4. Requires WNIC
TCP / IP
(Transmission Control Protocol / Internet Protocol)
- T CPis a protocol thatallows packetsto be sent andreceived between computer systems. Itbreaks the
datainto packetsandreorders them back into theoriginal dataat the destination.
- IPis a protocol in charge ofrouting and addressingdata packets. Thisensures data packets are sent
across networks to thecorrect destination. It isalso anaddressing system- every device on a network
is given aunique IP addressso data packets can besent to thecorrect computersystem.
HTTP
(Hypertext Transfer Protocol)
TTP is used to transfer web pages over the Internet so that users can view them in a web browser. All URLs
H
start with either HTTP or HTTPS
(e.g.https://docs.google.com)
TTPS is a more secure version of HTTP that works with another protocol called SSL (Secure Sockets Layer) to
H
transfer encrypted data. You should see apadlocksymbolin theURL barif your connection to that websiteis
secure.
Transfer Protocols
TP(File Transfer Protocol) is used to transfer filesacross a network. It is commonly used to upload or
F
download files to/from a web server.
MTP(Simple Mail Transfer Protocol) is a protocolused to send emails to a mail server and between mail
S
servers.
OP(Post Office Protocol) andIMAP(Internet MessageAccess Protocol) are both protocols for receiving and
P
storing emails from a mail server:
- POPwill delete an email from the email server onceit has been downloaded to a device.
- IMAPsyncs the message with an email server so itcan be accessed by different devices.
Networking Standards
etworking standardsarerulesthatallow computersystems to communicate across networks. Standards
N
have been created toensure devices can exchange dataand work together byinterpreting signals in the
same way, regardless of the manufacturer.
Why are protocol layers used?
1. Layers are self-contained, so they allow different developers to concentrate on one aspect of the
network at a time. A layer can be taken out and edited without affecting other layers.
2. Protocol layers are used to visualise the different parts of a network, as each of the four layers of
TCP/IP has a specific role and is associated with different protocols.
3. Protocols are broken down into well-defined, specific layers to simplify design, making it easier to
identify errors (known as troubleshooting).
4. Each layer uses specific protocols, so layering ensures these protocols are applied in a specific order.
This process uses abstraction and layers only communicate with adjacent layers for easy compatibility.
Worm
- A worm can replicate itself and spread from system to system by finding weaknesses in software.
- A worm does not need an infected file or human interaction to spread.
- A worm can spread very quickly across a network once it has infiltrated it.
Trojan
- A trojan is a harmful program that looks like legitimate software so users are tricked into installing it.
- A trojan secretly gives the attacker backdoor access to the system.
- Trojans do not self replicate or infect other files.
Spyware
- Spyware secretly records the activities of a user on a computer.
- The main aim of spyware is to record usernames, passwords and credit card information.
- All recorded information is secretly passed back to the attacker to use.
Keylogger
- A keylogger secretly records the key presses of a user on a computer. Data is sent back to the attacker.
- The main aim of a keylogger is to record usernames, passwords and credit card information.
- Keyloggers can be downloaded or plugged into the USB port.
Ransomware
- Ransomware locks files on a computer system using encryption so that a user can no longer access
them.
- The attacker demands money from the victim to decrypt (unlock) the data.
- Attackers usually use digital currencies like bitcoin which makes it hard to trace them.
SQL Injection
QL (Structured Query Language) is a programming language used for manipulating data in databases. A
S
SQL injection is when a malicious SQL query (command) is entered into a data input box on a website. If the
website is insecure then the SQL query can trick the website into giving unauthorised access to the website’s
database. An SQL injection can be used to view and edit the contents of a database or even gain
administrator privileges.
DDos Attack
DoS (Denial of Service) attack is when a computer repeatedly sends requests to a server to overload the
A
system. A server overload will slow the system and may take websites offline temporarily.
A DDoS (Distributed Denial of Service) attack is a coordinated attack using a botnet of infected systems to
overload a server with requests. A botnet is a large group of devices controlled and used maliciously by an
attacker.
Social Engineering
ocial engineering means to trick others into revealing their personal data by posing as a trusted source. For
S
example, impersonating an IT technician of a school via email and asking for a student's username and
password.
Data Interception
his is when data packets on a network are intercepted by a third party (e.g. a hacker) and copied to a
T
different location than the intended destination. Software called packet sniffers are used to intercept and
analyse data packets.
4.2 - Preventing Vulnerabilities
Penetration Tests
enetration tests are carried out as part of ethical hacking.
P
The purpose of a penetration test is to review the system's security to find any risks or weaknesses and to fix
them, and there are four main types of penetration tests:
- Internal tests are to see how much damage could be done by somebody within the company with a
registered account.
- External tests are for white hat hackers to try and infiltrate a system from outside the company.
- Blind tests are done with no inside information, to simulate what a real attacker would have to do to
infiltrate the system.
- Targeted tests are conducted by the company's IT department and the penetration team cooperating
together to find faults in the system
Anti-Malware Software
nti-malware software is used to locate and delete malware, like viruses, on a computer system. The software
A
scans each file on the computer and compares it against a database of known malware. Files with similar
features to malware in the database are identified and deleted.
There are thousands of known malware, but new forms are created each day by attackers, so anti-malware
software must be regularly updated to keep systems secure.
Other roles of anti-malware software:
- Checking all incoming and outgoing emails and their attachments.
- Checking files as they are downloaded.
- Scanning the hard drive for viruses and deleting them.
Firewall
firewall manages incoming and outgoing network traffic.
A
Each data packet is processed to check whether it should be given access to the network by examining the
source and destination address.Unexpected data packets will be filtered out and not accepted to the network.
Other roles of a firewall include:
● Blocking access to insecure/ maliciousweb sites.
● Blockingcertainprogramsfromaccessing the internet.
● Blockingunexpected /unauthorised downloads.
● Preventingspecificuserson a networkaccessing certainfiles
Secure Passwords
sernames must be matched with a secure password to minimise the chances of unauthorised users accessing
U
a system.Passwords should contain a mix of uppercase and lowercase letters, punctuation and numbers.
Passwords should be of a substantial length (at least 8 characters) and should be regularly changed.
User Access Levels
Access levels are used to only allow certain users to access and edit particular files.
'Read-Only' access is when a user can only view a file and is not allowed to change any data. For example, a
teacher might set homework instructions as read-only for students to view.
'Read and Write' access allows a user to read and edit the data in a file. For example, a teacher might set an
online workbook as read and write access for students to fill in.
I t is important to set access levels so that only authorised users can view and change data. The more users who
have access to a file, the more likely it is to be compromised. Certain users may also have no access to a file -
when they can't view or edit it.
Encryption
ncryption is the process of scrambling data into an unreadable format so that attackers cannot understand it
E
if intercepted during transmission.
The original data (known as plaintext) is converted to scrambled ciphertext using an encryption key. Only at
the correct destination will the encryption key be used to convert the ciphertext back into plaintext to be
understood by the receiving computer.
Physical Security
lock can be used to prevent access to server rooms or locations that store confidential data. Only authorised
A
personnel with a matching key will have access. Biometric devices require the input of a human characteristic
(such a fingerprint, iris or voice). The biometric data is checked against previously inputted data in a database.
Only a match will allow access to the user. Other forms of physical security include keycards, security staff,
CCTV cameras and alarms.
User Management
he OS allows users to create, manage and delete individual accounts. User accounts can be granted different
T
access rights such as an administrator or guest.
The OS will manage security settings such as allowing passwords to be reset and can also be used to monitor
login activity.
File Management
he operating system creates and maintains a logical management system to organise files and directories
T
(folders). File management allows files to be named, renamed, opened, copied, moved, saved, searched for,
sorted and deleted. It also allows users to set access rights for specific files and to view file properties.
User Interface
he final function of an operating system is to provide a user interface, allowing a human to interact with the
T
computer system.
The way in which a user can navigate a computer system is known as human-computer interaction (HCl).
Graphical User Interface
The most common type of user interface is a graphical user interface (GUI) which can be presented in the
following ways:
- Icons are displayed to represent shortcuts to applications and files.
- Multiple windows can be opened at the same time and switched between.
- The interface can be customised, such as changing font sizes and the desktop background.
- A folder and file system is displayed and manipulated allowing for copying, searching, sorting and
deleting data.
- System settings can be accessed such as network and hardware
- Menus can be opened from the start button to display files and shortcuts.
- The taskbar allows shortcuts to be pinned for quick access.
ommand-Line Interface
C
Other types of user interface do exist, such as acommand-line interface(CLI).
This type of interface isentirely text-basedandrequires users to interact with the system bytyping
commands. This is acomplicatedprocess and mistakescould easily accidentally delete data. There are many
commands to learn so onlyexpertswho have beentrainedto learn this interface will be able to efficiently
make use of it.
ouch-Sensitive Interface
T
Another type of user interface is atouch-sensitiveinterface, used withsmartphones and tablets.
A human interacts with the device bypressing on atouchscreen, making it very intuitive and suitablefor most
users without training. Touch-sensitive interfaces may not work with dirty or wet fingers and it will take longer
to write text compared to using a keyboard.
enu-Driven Interface
M
A menu-driven interfacedisplays datain a seriesof linked menus. Examples includecash machines(ATMs)
andold iPods.
This type of interface is generallyuser friendlyandeasy to useas commands do not need to be memorised.
However it can beannoying to find specific datathrougha large number of menus without a search feature.
oice-Driven Interface
V
A voice-driven interface can becontrolled by speakingcommandsaloud to a listening device. Examples
include Amazon'sAlexadevices, Apple'sSiritechnologyandGoogle Home.
This interface isintuitive, can be usedhands-freeand helps tospeed up processes. However commandsmay
be misheard orlimited in what can be performed.
Defragmentation
hat is fragmentation and how does it happen?
W
Over time files stored on a hard disk drive may become fragmented - this is when the file is split into parts that
are saved in different storage locations. Fragmentation occurs when there is limited contiguous space in which
to store a file. This may happen as data is stored and then later deleted on the hard drive. New files are
c reated which may be bigger than the spaces left by the deleted files. The new files are then split up.
Fragmentation increases access time - files that are fragmented take longer to load and read because of the
distance between the fragments of the file.
1-6: Impacts
Topic Contents:
.1a- Impacts of technology
6
6.1b- Legislation
Cultural Issues
6.1b - Legislation
Data Protection Act (2018)
I n 2018 the EU introduced GDPR (General Data Protection Regulation) to protect the privacy of data for
people in the EU. The UK matched this by updating the Data Protection Act introduced in 1998 to a newer, 2018
version.
This act protects the data of individuals that is stored on computers and processed by organisations.
Software Licenses
Open Source License
Proprietary License
2-1: Algorithms
Topic Contents:
1 .1- Computational Thinking
1.2- Designing Algorithms
1.3- Searching & Sorting Algorithms
Abstraction
bstraction is when you ignore unnecessary information and focus only on the important facts. Abstraction is
A
used because it simplifies a problem to make it less complex. This makes it more straightforward to understand
the problem and create a solution.
Decomposition
ecomposition is when you break a problem down into smaller tasks so that it is easier to solve. Each individual
D
problem can be separately tested and solved. Decomposition also enables different people to work on the
different parts of a larger problem that can later be recombined to produce a full solution.
Algorithmic Thinking
lgorithmic thinking is the final stage as logical steps are followed to solve the problem. The problem is broken
A
down using decomposition into smaller problems. The required data and relevant data structures are
considered using abstraction.
What is an algorithm?
n algorithm is a set of instructions, presented in a logical sequence. In an exam you may be asked to read and
A
understand an algorithm that has been written. To prove your understanding you may be asked to respond by
actions such as listing the outputs of the algorithm, correcting errors or identifying an error within it.
Programmers create algorithm designs as a method of planning a program before writing any code. This
helps them to consider the potential problems of the program and makes it easier to start creating source
code. There are two main methods of defining algorithms are pseudocode and flowcharts. In exams, OCR will
display algorithms in their own 'OCR Exam Reference Language'.
Basic Commands
Annotation: //Comments are written using two slashes
ssignment:name="Harold", age=49
A
Constants and Global Variables: constanttax = 15,globalname = "Admin"
Input / Output:name =input("Enter your name"),print("TransactionComplete")
Casting: str(29),int("102"),float(30),bool("False")
Random Number:number =random(1,100)
NEEDS TO BE CONTINUED
Flowcharts
flowchart can be used to visually represent an algorithm. It is more likely you will need to be able to interpret
A
a flowchart rather than draw one. The flowchart symbols are:
Reading Algorithms
I n an exam you may be asked to read an algorithm and prove your understanding,
most commonly by listing the outputs. Start from the first line and follow the
program line by line, recording the value of variables as you go. When you
encounter a for loop, repeat the indented code as many times as stated in the
range.
Understanding Algorithms: Listing Output
Structure Diagrams
tructure diagrams display the organisation (structure) of a problem in a visual format, showing the
S
subsections to a problem and how they link to other subsections. The noughts and crosses structure diagram
below has subsections in light yellow. Each
subsection could be coded by a different
person.
or most algorithms,not
F
every variablewill be
updatedineach
iteration.
Valuesmay not be
entered intheorderof
the trace table either. For
example, each iteration
outputs num1 + num2 and
then decreases the value
of num2 by 1.
Linear Search
linear search is the most simple search algorithm. Each data item is searched in order from the first value to
A
the last as if they were all laid out in a line. The list does not have to be in any order before it is searched. This
search is also known as a sequential search because the list is searched in a sequence from start to end. For
large lists, this search is not very efficient.
Linear Search Explained - CSNewbs
ey features of a linear search:
K
• A loop is used to check the first value in a list and increment by 1, checking each value for a match to the
target.
• Reaching the last element of the list without finding a match means the value is not included.
Binary Search
binary search is a much more efficient searching algorithm as it generally searches through fewer data and
A
is often much quicker - especially for large data sets. In a binary search, the middle point of the data is selected
ith each iteration and compared to the value being searched for. When the midpoint matches the target
w
value, it has been found and the search can stop.
!!However there is a prerequisite of using a binarysearch - the list of data must already be sorted. A
prerequisite is a condition that must be satisfied before an algorithm will work correctly.
Binary Search Explained - CSNewbs
Key features of a binary search:
- A midpoint, lowpoint and highpoint are calculated.
- A while loop is used to repeatedly compare the midpoint to a target value.
- The upper half or lower half of the data is ignored if the midpoint does not equal the target.
Merge Sort
erge sort is a sorting algorithm based on the idea of 'divide and conquer'. A merge sort divides a list into half,
M
again and again until each data item is separate. Then the items are combined in the same way as they were
divided, but now in the correct order. When the individual lists are all merged together as one list again, then
the data is in order and the algorithm will end.
Merge Sort Explained - CSNewbs
Key features of a merge sort:
- This algorithm calls itself from within the subroutine (this is known as a recursive algorithm).
- It continually splits sublists into a left side and a right side until each sublist has a length of 1.
Bubble Sort
his algorithm is based on the comparison of adjacent data elements. Data elements are swapped if they are
T
not in the correct order. The algorithm will only stop when a complete iteration through the data is completed
with no swaps made. A bubble sort is not suitable for large sets of data.
Bubble Sort Explained - CSNewbs
Key features of a bubble sort:
- Uses an outer while loop (condition controlled) to check no swaps have been made.
- Uses an inner for loop (count controlled) to repeat through the length of the data set.
- Uses a flag (a Boolean value) to track if a swap has been made and uses a temporary value to help
correctly swap elements.
Insertion Sort
he list is logically split into sorted values (on the left) and
T
unsorted values (on the right). Starting from the left, values
from the unsorted part are checked and inserted at the correct
position in the sorted part. This continues through all elements
of the list until the last item is reached, and sorted. Insertion
sorts are efficient for small data sets but would be slow to sort
large sets, compared to alternatives such as a merge sort.
Constants
s specified before, a variable is data that can change in value as a program is being run. Aconstantisdata
A
that does not change in valueas the program is run- it isfixedand remains the same. An example ofa
constant in maths programs ispi- it will constantlyremain at3.14159and never change.
Operators
omparison Operators- compares two data values (eg,2>5=FALSE, 5<=(2+4)=TRUE)(ie, >, <, >=, <=, ==,!=)
C
Arithmetic Operators- operators used to mathematicallychange values(ie, +, - , * ,/ , %, //, **)
Logical Operators- operators which determine a booleanoutput (eg, 9>2 AND 2>9 = FLASE)(ie, AND, OR,
NOT)
Casting
onverting the value of a variable from one variable to another is known as casting.
C
Python automatically assumes an input is a string, so the int() command is used to cast the string to an integer
Defining subprograms
A subprogram is defined (identified) using the def command in Python. A program may use many
subprograms, which are usually defined at the start of the code.
Calling subprograms
Running a line of code that includes the name of a subprogram will call (activate) it. When called, the program
will run the subprogram code before returning back to the line that called it. Subprograms are only run when
called, so depending on decisions made, a program may end without calling every (or any) subroutine.
Parameters
A parameter is a value that is passed into a subprogram when it is called, allowing the value to be used within
the subprogram. A subprogram may not use a parameter, e.g. multiply(), or one parameter, e.g.multiply(num),
or several e.g. multiply(num1,num2). Any parameters must be identified when the subprogram is defined, e.g.
def multiply(num):
eturn
R
The return command will send a value back to the line the subprogram was called on, allowing it to be used
there. For example, the 'quad' subprogram in the example below returns the value of the 'result' variable back
t o the main program, allowing it to be printed. A subprogram will end either by reaching the last line of code
within it, or when it reaches a return command. Subprograms that return a value are called functions.
ubprogram example
S
This subprogram is defined using the identifier 'quad' with a parameter named number.
The subprogram is called in the main program, multiplies the number passed in as a parameter by 4 and
returns a value back to the main program to be printed.
def quad(number):
result = number * 4
return result
#Main Program
number = int(input("Enter a number: "))
print("The number quadrupled is" , quad(number))
nter a number: 5
E
The number quadrupled is 20
- S ubprogramsbreak a complex program downinto smallerparts, making iteasier to design and test.
- Using subprograms allows code to beeasily reusedin other programs, as it hasalready been written,
making itquicker to developnew programsor buildon existing work.
- Using subprogramsavoids code repetition, as theycan be called as many times as necessary.
- Work caneasily be split up between team membersto work on different subprograms at the same
time.
Array
n array is a static data structure that can hold a fixed number of data elements. Each data element must be
A
of the same data type i.e. real, integer, string.
The elements in an array are identified by a number that indicates their position in the array. This number is
known as the index. The first element in an array always has an index of 0.
You should know how to write pseudocode that manipulates arrays to traverse, add, remove and search for
data. The following steps use Python as an example, although Python does not use arrays and uses a similar
ata structure called a list (that can change in size as the program runs). See the 8a and 8b Python pages for
d
tasks on how to use lists.
raversing an Array
T
To traverse ('move through') an array a for loop can be used to display each data element in order.
Output:
'Inserting' a value
In an array the size is fixed so you cannot insert new values, but you can change the value of elements that
already exist. Overwriting the fourth element (Daphne) with a new value (Laura) will change it from Daphne to
Laura.
Example code for inserting:
Output:
'Deleting' a value
In an array the size is fixed so you cannot delete values, but you can overwrite them as blank. Overwriting the
second element (Shaggy) with a blank space makes it appear deleted.
Output:
Searching an Array
or large arrays a for loop is needed to search through each element for a specific value. This example checks
F
each name to see if it is equal to Velma.
Output:
COMPLETE THIS
Two-Dimensional Array (2D array)
ften the data we want to process comes in the form of a table.
O
The data in a two dimensional array must still all be of the same
data type, but can have multiple rows and columns. The
two-dimensional array shows the characters from Scooby Doo
along with their associated colour and their species. Each value in
the array is represented by an index still, but now the index has
two values. For example [3] [0] is 'Daphne'. Unless stated in an exam, measure row first, then column.
Records
nlike arrays, records can store data of different data types. Each record is made up of information about one
U
person or thing. Each piece of information in the record is called a field (each row name). Records should have
a key field - this is unique data that identifies each record. For example Student ID is a good key field for a
record on students as no two students can have the same Student ID. A 2D array may be used to represent
database tables of records and fields.
SQL
QL(structured query language) is a language thatcan
S
be used tosearch for datain adatabase.
Input Validation
Validationis a process to check that data isreasonableor sensiblebefore it is accepted.
Maintainability
rograms should be written in a way that makesmaintainingandunderstanding themas straightforward as
P
possible. Examples of making a programmaintainableinclude:
- Usingsubprogramstoreuse codeand make themeasierto test. This is calledmodularisation.
- Appropriate variable names, using anaming convention,ensure thepurposeof a variable is
immediately understood.
- Usingindentationtoimprove readabilityand clearlyshow each ‘block’ of code.
- Commentsenable a programmer tounderstand the purposeof each line of code. Crucial when
working in a team.
- Usingconstantsis another method of improving maintainability.This keeps the program code
consistent, which makes iteasier to read and debuga program
3.2 - Testing
he mainpurpose of testingis to ensure that aprogramworks correctlyno matter whatinput has been
T
enteredby the user.
Other reasons to test a program include ensuring theuser requirements have been met,errorshave been
removedand theprogram doesn't crashwhile running.
Types of testing
I terative Testing
Iterative testing takes placeduring program development.
The programmerdevelops a module,tests itandrepeatsthis processuntil themoduleworks as expected.
inal Testing
F
Final testing, also known asterminal testing, takesplaceafter developmentandbefore the program is
releasedto the end user.
This testing takes place onceall modules have beenindividually testedto ensure thewhole programworksas
originally expected.
Programming Errors
Syntax Error
syntax error is a mistake in the grammatical rules of the programming language, such as an incorrect
A
spelling of a command word.A syntax error will prevent the program from being compiled and executed.
Examples:
Logical Error
logic error is a mistake made by the programmer - the program runs without crashing but will display the
A
wrong output.
Examples:
I ncorrect calculation:
total = num1-num2
print (total)
Incorrect variable printed:
age = 16
name = "Steve"
print ("Nice to meet you" ,age)
Test Data
est data is used to test whether a program is functioning correctly. It should cover a range of possible and
T
incorrect inputs, each designed to prove a program works or to highlight any flaws.
Four types of test data are:
1. Normaldata- Sensible data that the program shouldaccept and be able to process
2. Boundarydata- Data at the extreme boundary of anydata range
3. Invaliddata- Data of the correct data type thatdoes not meet the validation rules
4. Erroneousdata- Data of the wrong data type thatthe program cannot process and should not accept
Order of precedence
The order of precedence is as follows:
- BRACKETS
- NOT
- A ND
- OR
NOT Logic Gate Symbol AND Logic Gate Symbol OR Logic Gate Symbol
Translators
translator changes (translates) a program written in one language into another language (usually machine
A
code). There are two main types of translator:
Interpreters vs Compilers
Interpreter: Compiler:
- E xecution Method:An interpreter translates - E xecution Method:A compiler translates all
source code (high level code) into machine the source code (high level code) into machine
code one line at a time. code in one go. A compiler produces an
executable file that will run on other machines
- Execution Speed:An interpreter is slower
without the compiler needing to be installed.
than a compiler because the code must be
- Execution Speed:Compilers can produce
reinterpreted each time the program is run. much more efficient code than interpreters
- Complexity:Interpreters are smaller, simpler making the compiled programs run faster.
programs. - Complexity:Compilers tend to be large
- Error Reporting:In error reporting, the complex programs.
interpreter would encounter the errors and - Error Reporting:The compiler would analyse
the entire program, taking note of where
report it to the user immediately and stops the
errors have occurred and record them in an
program from running. error file.
- Repetition:Interpreted programs can be - Repetition:Compilation requires analysis and
edited and run without translating the whole the generation of the code only once, whereas
program. Interpreters must reinterpret the interpreters must re-interpret each time.
program every time it is run. However, compiled programs have to be
recompiled after any changes have been
made.
Editors
he editor is software that allows a programmer toenter and edit source code.
T
Editor features may include:
- Automatic formatting(e.g. automatic indentation).
- Automatic line numbering(this helps to identify exactlywhere an error has occurred).
- Automatic colour coding(e.g. Python IDLE turns loopcommands orange and print commands purple).
- Statement completion(e.g. offering to auto-completea command as the user is typing.)
Break Point
he programmerselects a specificline and the programdisplays the variable values at that point. The code
T
can then be executedone line at a timeto find exactlywhere the error occurs. This process is called
single-stepping.
Variable Watch/Watch Window
isplays thecurrent value of a selected variable.A variable can bewatched line-by-lineto see howthe
D
value changes.
Trace
Logsthevalues of variablesandoutputs of the programas the code is executedline by line.
Error Diagnostics & Debugger
oth tools are used todisplay information about anerror when it occurs, such as theline it occurredon and
B
theerror type(e.g. syntax). These tools may alsosuggest solutions to help the programmer to find and fix the
error.