Complete Notes
Complete Notes
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0
Two’s Complement
• We can represent a negative number in binary by making the most significant bit (MSB) a sign bit,
which indicates whether the number is positive or negative.
• Converting negative denary into binary (ex. -42)
• Find the binary equivalent of the denary number (ignoring the -ve sign) | 42 = 101010
• Add extra 0 bits before the MSB, to format binary number to 8 bits | 00101010
• Convert binary number to one’s complement (flip the bits) | 11010101
• Convert binary number to two’s complement (add 1) |1010101 + 1 = 11010110
• Converting binary two’s complement into denary (ex. 11010110)
• Flip all the bits | 00101001
• Add 1 | 00101010
• Convert binary to denary and put a –ve sign) | -42
• Range is -127 to 128
Binary Addition:
In binary addition, two binary numbers are added together to produce a third binary number. The process
of binary addition is similar to decimal addition, but with only two digits, 0 and 1. Here's an example of how
binary addition works:
In this example, we are adding two 8-bit binary numbers: 10110110 and 01011101. We start by adding the
least significant bits (LSBs), which are the rightmost digits, and then carry over any remainders to the next
column if needed. In this case, 0 + 1 = 1, 1 + 0 = 1, 1 + 1 = 0 with a carry of 1, and so on.
Once we have added all the bits, we get the final result of 11000100 in binary, which is equivalent to the
decimal value of 196.
1 0 1 1 0 1 1 0
1 1 0 0 0 1 0 0
1 1 0 0 0 1 0 0
Binary Subtraction:
Binary subtraction using the two's complement method is a common technique used in computers to
perform subtraction of binary numbers. It works by representing negative numbers using the two's
complement representation.
Doesn’t support all languages in world Supports all languages around the world
Extended ASCII is not standardized, there’s It’s standardized
variation in different ASCII Coding system after First 128 characters are same
first 128 characters
Bitmap Image
• A bit map image is made up of a 2D representation of pixels
• Smallest addressable element of a bit map image is a pixel
• Each pixel has a color
• Each pixel has a binary value corresponding to its color
• Number of bits used to represent each pixel is called the bit depth
Since it’s a monochrome image, each pixel can have one color, so two bit per
pixel will be the color depth, black pixel can be represented as 00 and white can
be represented as 01, Each pixel will have a color either black or white, each
pixel will have a binary value. Bits are stored in sequence.
00000 10101 10101 10101 10101
File Size = (Number of Pixels Horizontal x Number of pixels vertical) × color depth → Answer would be in
bits
File Size = (Total Pixels) × color depth
Bits → Bytes (Divide by 8)
Bytes → Kilobytes/Kibibytes (Divide by 1000/1024)
Kilobytes/Kibibytes → Megabyte/Mebibyte (Divide by 1000/1024)
Vector image
• A vector image is made up of geometric shapes
• These shapes are joined by 2D points, and coordinates
• Each shape has its own drawing list
• Which stores the commands and instructions on how to the draw the image as well its
properties/attributes
• Such as radius, thickness, fill color etc.
Enlarging a bitmap means the image is pixelated Vector graphic can be enlarged without the
image becoming pixelated
Bitmap images can compress, vector graphic
Vector graphics cannot be compressed well
images do not compress well
Bitmap images are more suitable for Vector graphics are more suitable for geometric
photographs shapes
Individual elements of bitmap cannot be Individual elements on vector can be grouped
grouped
• Vector graphics are smaller in size since they only store the commands and instructions on how to draw
the image
• Vector graphics can be scaled up and down Static dimensions are not stored, relative positions of drawing
objects are stored, position and dimensions are recalculated with adjustment in size
Sampling Resolution
• Number of distinct values available to encode the sound wave
• Number of bits used to encode each sample i.e. bit depth
• Higher the sampling resolution is
✓ better the quality
✓ less quantization errors
✓ less distortion in sound.
✓ Greater accuracy of sound
✓ Greater file size as well
✓ Longer to transmit
✓ Greater bandwidth required when uploading
✓ Greater processing power required
Sampling Rate
• Number of samples taken per unit time
• Number of times the analogue value of sound is measured per unit time, per second
• Higher sampling rate results in more accurate representation of sound.
Compression Techniques
Lossless Compression
A compression algorithm is used, the data is not permanently deleted, the original file can be reconstructed
back to the original. This type of compression is mostly used in text documents, spreadsheets, code files
where it’s essential to decompress the file. It operates by identifying repeating bits of data, indexes/collates
them and replaces the repeating data with the index value. Examples of compression algorithms based on
lossless compression are Run Length Encoding, and Huffman coding. Include example of RLE on text as well
AAAAAABBBBCCCCCCCCCC
The RLE will compress this text in the following way:
6 65 4 66 10 67
Where 65, 66. 67 is the ascii code of the characters
6, 4. 7 are the number of repetitions of the corresponding data.
Lossy Compression
A compression algorithm is used, the data is permanently deleted, and the original file cannot be
reconstructed back, It decides what part of the file is important, and discards other data that’s not important
enough. It’s usually used to compress audio, and video files; it operates in a way that there’s no significant
compromise in the quality of the file compressed e.g. a music file, or a movie file. The compression algorithm
identifies bits of data that aren’t important or not detected by a human, and deletes them. Example,
perceptual music shaping used on audio files. Files using lossy compression are JPEG, MP3 etc.
MP3 Compression
Lossy compression algorithm is used, perceptual music shaping, the data is permanently deleted and the
original audio file cannot be reconstructed back, the algorithm basically removes sound with low amplitude,
if two sounds are played at the same it removes the softer sound. Removes background sound, or sounds
not noticed by human ear. Since the algorithm only removes bits of data not identified by a human, it still
retains most of the quality of the original file.
AS COMPUTER SCIENCE P1 10 | P A G E
Chapter 2 Communication
AS COMPUTER SCIENCE P1 11 | P A G E
A networking device is a hardware device that is used to connect multiple computers or other devices
together to form a network. The purpose of networking devices is to enable communication and data
sharing between devices within a network.
LAN / WAN
LAN
• Devices connected over a small geographical area
• company-owned infrastructure // Uses dedicated infrastructure // No leasing external infrastructure /
transmission media // does not use internet to transmit within the building
WAN
• A network connecting computers on different sites, possibly thousands of kilometers apart
AS COMPUTER SCIENCE P1 12 | P A G E
Network Models
Client-Server
Webpage Bank
AS COMPUTER SCIENCE P1 13 | P A G E
Benefits Drawbacks
AS COMPUTER SCIENCE P1 14 | P A G E
Peer to Peer
Benefits Drawbacks
✓ It avoids the possibility of congestion when ✓ Reduced Security, Any virus on any computer
more clients are simultaneously requesting to can be transmitted to all other nodes
download a file. ✓ No central backup of data, if the node storing
✓ It allows the user to download different parts some specific data gets damaged for some
of files separately. reason data is lost.
✓ The parts are available from more than one ✓ In order to share files, all the computers must
host. be on, otherwise files cannot be shared, this
means that files aren’t accessible always
AS COMPUTER SCIENCE P1 15 | P A G E
Thin clients & Thick clients
Thin Client
A thin client is heavily dependent on having access to a server to allow constant access to files and to
allow applications to run uninterrupted. A thin client can either be a device or software which needs to
be connected to a powerful computer or server to allow processing to take place (the computer or server
could be on the internet or could be part of a LAN/MAN/WAN network). The thin client will not work
unless it is connected at all times to the computer or server. A software example would be a web browser
which has very limited functions unless it is connected to a server. Other examples include mobile phone
apps which need constant access to a server to work. A hardware example is a POS terminal at a
supermarket that needs constant access to a server to find prices, charge customers and to do any
significant processing.
Thick Client
A thick client can either be a device or software that can work offline or online; it is still able to do some
processing whether it is connected to a server or not. A thick client can either be connected to a
LAN/MAN/WAN, virtual network, the internet or a cloud computing server. A hardware example is a normal
PC/laptop/tablet since it would have its own storage (HDD or SSD), RAM and operating system which means
it is capable of operating effectively online or offline. An example of software is a computer game which can
run independently on a user’s computer, but can also connect to an online server to allow gamers to play
and communicate with each other
Pros Cons
✓ more robust (device can carry out processing ✓ less secure (relies on clients to keep their
even when not connected to server) own data secure)
✓ clients have more control (they can store ✓ each client needs to update data and
software individually
Thick Clients
✓ less expensive to expand (low-powered and ✓ high reliance on the server; if the server goes
cheap devices can be used) down or there is a break in the
✓ all devices are linked to a server (data communication link then the devices cannot
updates and new software installation done work
Thin Clients
AS COMPUTER SCIENCE P1 16 | P A G E
Thick Client Thin Client
AS COMPUTER SCIENCE P1 17 | P A G E
TOPOLOGY
A network topology is the arrangement with which computer system are connected to each other.
BUS TOPOLOGY:
Uses a single central cable to which all computers and devices are connected.
Benefits Drawbacks
AS COMPUTER SCIENCE P1 18 | P A G E
Past Paper Question
AS COMPUTER SCIENCE P1 19 | P A G E
STAR TOPOLOGY:
Every computer is linked with central device.
Benefits Drawbacks
AS COMPUTER SCIENCE P1 20 | P A G E
Past Paper Question
AS COMPUTER SCIENCE P1 21 | P A G E
MESH TOPOLOGY:
All the devices are interconnected to each other.
Benefits Drawbacks
✓ Any broken links in the networks do not ✓ A large amount of cabling is needed, which is
affect the other nodes. expensive and time-consuming.
✓ Good privacy and security, since packets ✓ Setup and maintenance is difficult and
travel along dedicated routes complex.
AS COMPUTER SCIENCE P1 22 | P A G E
HYBRID TOPOLOGY:
All the devices are interconnected to each other.
Benefits Drawbacks
AS COMPUTER SCIENCE P1 23 | P A G E
Cloud Computing
A physical server is located in an offsite location, with files/applications stored on it. It basically acts as a
remote server.
Public Cloud
The firm or the company using the remote server to store the files, doesn’t own the remote server,
Owned by third party, and is available to anyone with an internet connection, and credentials. Computing
services offered over the public network.
Private Cloud
A firm/company has purchased and installed a remote server to store their files/applications/software,
and own the server. Only available to selected users, only accessible for the organization., computing
services offered over internet or a private internal network.
Benefits Drawbacks
✓ No need to store files on hard drive ✓ Cannot access files if lost internet
✓ Files can be accessed from anywhere in the ✓ Data is not secure, data breaches, no control
world, at any time from any device provided that over security
internet connection is available ✓ The cloud server is a physical server located
✓ Can acts as backup storage somewhere, it fails due to some natural disaster
✓ Data can be shared easily all data will be deleted, no control over backups
✓ It can almost go unlimited ✓ Expensive for long term
✓ Free for little amount of storage ✓ Have to pay for more storage
AS COMPUTER SCIENCE P1 24 | P A G E
Wired & Wireless Network
Numerous factors should be considered when deciding if a network should use wired or wireless
connectivity, as listed below.
Wireless Network
Benefits Drawbacks
✓ Interference of signals
✓ Devices are more mobile; The network can be ✓ Easier to hack
accessed from anywhere within range of an ✓ Signals degrades quickly
access point ✓ Transmissions may be less secure because
✓ Easier to connect more devices data packets can be intercepted // easier
✓ Easy to set up, No cabling required connection by unauthorized user
✓ Many devices can be connected at the same time ✓ Bandwidth may be limited // As more devices
✓ Less hard wiring/hardware is required, Reduced connect the bandwidth can be reduced so access
cost of setting up the network may be slow
✓ No need to physically connect each device, It is ✓ It is subject to interference from other signals
much more straightforward to connect other or obstacles which can hinder transmission or
devices corrupt data
✓ Limited range // greater attenuation so there
is a need for repeaters // users can easily move
out of range
✓ Higher latency so transmission will be slower
Wired
Benefits Drawbacks
AS COMPUTER SCIENCE P1 25 | P A G E
Wi-Fi & Bluetooth
Both Wi-Fi and Bluetooth offer wireless communication between devices. They both use electromagnetic
radiation as the carrier of data transmission. Bluetooth sends and receives radio waves in a band of 79
different frequencies (known as channels). These are all centered on a 2.45GHz frequency. Devices using
Bluetooth automatically detect and connect to each other, but they do not interfere with other devices
since each communicating pair uses a different channel (from the 79 options) When a device wants to
communicate, it picks one of the 79 channels at random. If the channel is already being used, it randomly
picks another channel. This is known as spread spectrum frequency hopping. To further minimize the
risks of interference with other devices, the communication pairs constantly change the frequencies
(channels) they are using (several times a second). Bluetooth creates a secure wireless personal area
network (WPAN)
based on key encryption.
As mentioned earlier in the chapter, Wi-Fi also uses spread spectrum technology. However, Wi-Fi is best
suited to operating full-scale networks, since it offers much faster data transfer rates, better range and
better security than Bluetooth. A Wi-Fi-enabled device (such as a computer or smart phone) can access,
for example, the internet wirelessly at any wireless access point (WAP) or ‘hot spot’ up to 100 meters
away.
Satellites
Penetration : measures the ability of electromagnetic radiation to pass through different media.
Attenuation : the reduction in amplitude of a signal
The use of microwaves and radio waves was previously mentioned as a method for allowing Wi-Fi
connectivity in networks. These methods are perfectly satisfactory for short distances – the
electromagnetic waves carry the signals – but the curvature of the Earth prevents such methods
transmitting data globally. The communication between antennae and satellite is carried out by radio
waves or microwave frequencies. Different frequency bands are used to prevent signal interference and
to allow networks spread across the Earth to communicate through use of satellites
AS COMPUTER SCIENCE P1 26 | P A G E
Cables
Twisted pair cables
• most common cable type used in LANs
• lowest data transfer rate
• suffers the most from external interference
• cheapest option
• Unshielded is used by residential users. Shielded is used commercially
Coaxial cables
• most commonly used cables in MANs (metropolitan area network (network which is larger than a LAN but
smaller than a WAN, which can cover several buildings in a single city, such as a university campus)
• cost of coaxial cables is higher than twisted pair
• better data transfer rate than twisted pair
o Multi core allows for a multi-mode light source; the construction causes higher light reflections
in the core, so they work best over shorter distances (in a LAN, for example).
AS COMPUTER SCIENCE P1 27 | P A G E
Benefits Drawbacks
✓ Greater security
✓ Greater bandwidth
✓ Need less signal boosting ✓ Expensive to set up
✓ Lightweight ✓ Requires expertise
✓ Consume less power
✓ High resistance to signal attenuation
✓ Fastest data transfer rate
• Fiber optic data is transmitted using light, copper cable through electrical signals
• Fiber optic has smaller risk of (noise) interference than copper cable
• Fiber optic can be used over longer distances than copper cable before repeaters are needed
• Fiber optic is much more difficult to hack into than copper cable
AS COMPUTER SCIENCE P1 28 | P A G E
Devices used to support a LAN
Router
• Connects two or more networks
• Can connect a network to a WAN
• Receives packets and forwards towards destination
• Assigns private IP addresses
• Operates between similar networks using same protocol
• Can be used to segment a network
• To store / update / maintain a routing table
• To find the most efficient path to the destination
• To maintain a table of MAC and IP addresses
Gateway
• Connects two or more networks
• Can connect a network to a WAN
• Receives packets and forwards towards destination
• Assigns private IP addresses
• Connects two dissimilar networks using different protocols
Switch
• they connect a number of devices or computers together to form a LAN (for example, a star network).
• However, unlike a hub, the switch checks the data packet received
• works out its destination address (or addresses)
• sends the data to the appropriate computer(s) only.
• makes using a switch a more secure and efficient way of distributing data
AS COMPUTER SCIENCE P1 29 | P A G E
Repeater
• When signals are sent over long distances, they suffer attenuation or signal loss.
• Repeaters are devices which are added to transmission systems to
• boost the signal so it can travel greater distances.
• They amplify signals on both analogue (copper cable) and digital (fiber optic cable) communication
links.
• Repeaters can also be used on wireless systems.
• These are used to boost signals to prevent any ‘dead spots’ in the Wi-Fi zone.
• These devices plug into electric wall sockets and send out booster signals.
• They are termed non-logical devices because they will boost all signals which have been detected; they
are
• not selective.
Bridge
• devices that connect one LAN to another LAN that uses the same protocol
• used to connect different parts of a LAN so that they can function as a single LAN.
Ethernet
Ethernet is a protocol used by many wired LANs. It was adopted as a standard by the Institute of Electrical
and Electronic Engineers (IEEE) and Ethernet is also known as IEEE 802.3.
A network using Ethernet is made up of:
• a node (any device on the LAN)
• medium (path used by the LAN devices, such as an Ethernet cable)
• frame (data is transmitted in frames which are made up of source address)
Conflicts
if devices on the same network have been given the
same IP address; without a unique IP address it is not
possible to connect to a network. This is most likely
to occur on a LAN where dynamic IP addresses may
have been used. can be resolved by re-starting the
router. Any dynamic IP addresses will be re-
assigned, which could resolve the issue.
AS COMPUTER SCIENCE P1 30 | P A G E
CSMA/CD collision management
• CSMA/CD is a protocol used to detect and prevent collisions in a bus topology
• Workstations listen to the communication channel
• If no data is being transmitted, he computer frames as packet and transmits it
• Collision is caused when two messages are sent from the same channel at the same time
• As collision occurs a jamming signal is sent
• Transmission is terminated
• If collisions occur each workstation waits a random time before retransmitting
• Each time a collision occurs, random time is increased.
Bit Streaming
• Data is compressed before streaming
• Sequence of bits are streamed over the internet
• They require fast data transfer speed and fast broadband connection
• the bits are stored in the buffer and then played back for the user as they’re downloaded from the
dedicated streaming server
• Bits arrive in the same sequence as they were streamed
Benefits Drawbacks
✓ Any video file or music file can be played on ✓ Requires high bandwidth
demand ✓ Video lags/stops and waits for the buffer to get
✓ No need to store video/music files on hard drive loaded, with an unstable internet connection or
✓ Better security, harder to copy streamed files insufficient buffer capacity
then downloaded files ✓ Viruses may be downloaded from websites
✓ No need to wait for entire video/music file to be ✓ Cannot access videos/music without internet
downloaded to play it • No specialist software ✓ Copyright issue
required to playback video in browser
On Demand Streaming
• Digital video file is stored on the file server
• It’s encoded into bit streaming format and uploaded on dedicated streaming server
AS COMPUTER SCIENCE P1 31 | P A G E
• A link is available for the user on the website, through which user can download the file • User clicks
on the link to download encoded streaming video
• As the file is streamed to the user, it’s broadcasted to user.
• Video can be forwarded, rewound and paused.
• On Demand: Digital video stored on server which is encoded into bit streaming format and uploaded to
dedicated video server
• Real Time: Video captured real time from a video camera connected to a computer
• On Demand: Streaming of video that has been recorded in the past, recorded lessons etc.
• Real Time: Live real time streaming of any event that’s currently taking place, e.g. a football match
AS COMPUTER SCIENCE P1 32 | P A G E
Difference between Internet and WWW
• Internet is the infrastructure , the global collection of networks
• World Wide Web is collection of multimedia web page and documents, content
• World Wide Web is accessed over the internet
• Web pages are written in html
• Internet uses IP/TCP protocol, WWW uses HTTP protocol to transfer web pages
Supplementary Question
Ali is sending an email to his boss, using a website?, Is he using WWW or Internet, or both?
Answer: Obviously both, Internet is being used to the send data on the infrastructure, whereas the
WWW used to access the website stored on webserver
Benefits Drawbacks
AS COMPUTER SCIENCE P1 33 | P A G E
Phone calls using the internet
Phone calls using the internet use either an internet phone or microphone and speakers (video calls also
require a webcam).The internet connection is only ‘live’ while data (sound/video image) is being
transmitted.
Voice over Internet Protocol (VoIP) converts sound to digital packages (encoding) which can be sent over
the internet. VoIP uses packet switching; the networks simply send and retrieve data as it is needed so
there is no dedicated line, unlike PSTN. Data is routed through thousands of possible pathways, allowing
the fastest route to be determined. The conversation (data) is split into data packages. Each packet
contains at least the sender’s address, receiver’s address and order number of packet – the sending
computer sends the data to its router which sends the packets to another router, and so on. At the
receiving end, the packets are reassembled into the original state (see Chapter 14 for more details).VoIP
also carries out file compression to reduce the amount of data being transmitted. Because the link only
exists while data is being transmitted, a typical 10-minute phone call may only contain about 3 minutes
where people are talking; thus only 3MB of data is transmitted making it much more efficient than PSTN.
Modems
Modern computers work with digital data, whereas many of the public communication channels still only
allow analogue data transmission. To allow the transmission of digital data over analogue communication
channels we need to use a modem (modulator demodulator). This device converts digital data to analogue
data. It also does the reverse and converts data received over the analogue network into digital data which
can be understood by the computer. Wireless modems transmit data in a modulated form to allow several
simultaneous wireless communications to take place without interfering with each other. A modem will
connect to the public infrastructure (cable, telephone, fiber-optics or satellite) and will supply the user with
a standard Ethernet output which allows connection to a router, thus enabling an internet connection to
occur While the router will allow the creation of a network in a home, for example, the modem allows for
the connection to the external networks (for example, the internet). Routers and modems can be combined
into one unit; these devices have the electronics and software to provide both router and modem functions.
Another example of a modem is a soft modem (software modem), which uses minimal hardware and uses
software that runs on the host computer. The computer’s resources (mainly the processor and RAM) replace
the hardware of a conventional modem.
AS COMPUTER SCIENCE P1 34 | P A G E
2.1 Networks Including the Internet Continued
IPV4
• most common type of addressing on the internet
• This is based on 32bits giving 232 (4294 967296) possible addresses.
• 32 bits are split into four groups of 8bits (thus giving a range of 0 to 255).
• For example, 254.0.128.77.
The system uses the group of bits to define network (netID) and network host (hostID). The netID allows
for initial transmission to be routed according to the netID and then the hostID is looked at by the
receiving network. Networks are split into five different classes
AS COMPUTER SCIENCE P1 35 | P A G E
Consider the class C network IP address 190.15.25.240, which would be written in binary as:
10111110 00001111 00011001 11110000
Here the network id is 190.15.25 and the host ID is 240.
Consider the class B network IP address 128.148.12.14, which would be written in binary as:
10000000 10010100 00001100 00001110
Here the network ID is 128.148 and the host ID is 12.14 (made up of sub-net ID 12 and host ID of 14).
Consider the class A network IP address 29.68.0.43, which would be written in binary as:
00011101 01000100 00000000 00101011
Here the network ID is 29 and the host ID is 68.0.43 (made up of sub-net ID 68.0 and host ID of 43).
IPv6
• IPv6 addressing has been developed to overcome some of the problems associated with IPv4.
• uses 128-bit addressing
• IPv6 address is broken into 16-bit chunks
• it adopts the hexadecimal notation.
• For example: A8FB:7A88:FFF0:0FFF:3D21:2085:66FB:F0FA
• colon (:) rather than a decimal point (.) is used here.
• designed to allow the internet to grow in terms of number of hosts
Zero compression
IPv6 addresses can be quite long; but there is a way to shorten them using
zero compression. For example, 900B:3E4A:AE41:0000:0000:AFF7:DD44:F1FF
can be written as:
900B:3E4A:AE41::AFF7:DD44:F1FF
The zero compression can only be applied ONCE to an IPv6 address, otherwise
it would be impossible to tell how many zeros were replaced on each occasion
where it was applied. For example, 8055:F2F2:0000:0000:FFF1:0000:0000:DD04
can be rewritten either as:
8055:F2F2::FFF1:0000:0000:DD04
or as:
8055:F2F2:0000:0000:FFF1::DD04
AS COMPUTER SCIENCE P1 36 | P A G E
Uses of subnetting
• Improved security
• Reduces congestion
• Allows extension of the network
• Aids day to day management
• Improves performance
Supplementary Question
Why the above IPV6 would be an invalid IPV4 address?
Answer: It’s using colon as separators instead of dot, there are too many groups, IPV4 has only 4 groups
some groups are more than 8 bits, the address is more than 32 bits overall. Too many digits per group
AS COMPUTER SCIENCE P1 37 | P A G E
Public IP Private IP
Statement
Address Address
🗸
192.168.2.1 is an example of this type of address
🗸
Assigned by the ISP
🗸
IP address cannot be duplicated in different networks
🗸
Network address translation is necessary to access the internet directly
🗸
The address can be reached over the internet
🗸
The address is more secure
🗸
The address can only be accessed through the same LAN
🗸
The address can be duplicated in different networks
Static Dynamic
When a computer disconnects and joins the Each time the computer rejoins the network, the
network back the IP address is unchanged, it’s address changes, address is assigned by the
assigned by the ISP network OS
AS COMPUTER SCIENCE P1 38 | P A G E
Chapter 3 Hardware
AS COMPUTER SCIENCE P1 39 | P A G E
Primary memory
Primary memory is the part of computer memory which can be accessed directly from the CPU Secondary
storage devices
Secondary storage
includes storage devices that are not directly accessible by the CPU. They are nonvolatile devices which
allow data to be stored as long as required by the user. This type of storage is much larger than primary
memory, but data access time is considerably slower than RAM and ROM. All applications, the operating
system, device drivers and general files (for example, documents, photos and music) are stored in secondary
storage.
Embedded systems
• Microprocessor designed to perform specific tasks/functions.
• e.g. for washing machines
o it controls the programs for the washing cycle
o it’s part of the machine but doesn’t perform any function within it
• e.g. for tv,
o the embedded system is built into / integrated into the TV
o combination of hardware and software designed for a specific function
o The system is not easily changed/updated by the TV owner
o Monitoring and Control/Sensors
Benefits Drawbacks
✓ small in size and therefore easy to fit into ✓ difficult to upgrade devices to take
devices advantage of new technology
✓ relatively low cost to make ✓ troubleshooting faults in the device
✓ usually dedicated to one task, making for becomes a specialist task
simple interfaces ✓ although the interface can appear to be
✓ often no requirement of an operating system simple, in reality it can be more confusing
✓ consume very little power (changing the time on a cooker clock can
✓ very fast reaction to changing input (operate require several steps, for example)
in real time) ✓ any device that can be accessed over the
✓ with mass production comes reliability internet is also open to hackers, viruses,
and so on
✓ due to the difficulty in upgrading and fault
finding, devices are often just thrown away
rather than being repaired (wasteful)
AS COMPUTER SCIENCE P1 40 | P A G E
Principal Operations Of Hardware Devices
Laser printer
• A document from the computer is sent to the printer
• Printer driver ensures that the document is in a format that printer can understand
• A check is made by the printer driver that selected printer is available and there’s no issue such as
paper jam, out of toner etc.
• Data from the printer is stored in printer buffer
• A printing drum rotates and it’s given a positive charge
• The laser scans the drum in which leaves negative charge in areas which exactly match the document
to be printed
• The toner is then given positive charge, and the drum is rolled over it, toner sticks to the areas scanned
by laser
• A sheet of paper which is given negative charge is rolled over the drum, the toner from the drum now
sticks onto the paper
• Paper is then passed through a fuser which melts the toner and fixes it permanently onto the paper
• The charge from the drum is removed after the print
AS COMPUTER SCIENCE P1 41 | P A G E
Optical Disk
• A drive motor is used to spin the disk
• A red laser is used to read/write data
• A lens focuses the laser onto the disk
• Data is stored on pits and bumps on the spiral track
• Surface of disk is made up of a reflective metal
• Reflected light is then encoded as a bit pattern
Components of speaker
• Coil of wire
• Outer frame
• Diagram/Cone
• Dust cap
• Magnet
• Basket
Speaker
• Speaker basically operates by converting electric signals to physical vibration.
• A coil of wire is wrapped onto a permanent magnet, electric current in coil produces a magnetic field
• The permanent magnet is attached to a cone
• Change is audio signals cause change in current flowing through the coil, as the current changes
direction of current changes
• As direction of current changes, direction of electromagnet also changes
• This electromagnet is attracted or repelled by the permanent magnet, this causes the coil to vibrate
• As coil vibrates, the diagram/cone vibrates
• The vibration of the cone causes the air ahead of it to vibrate, vibration is transmitted as sound waves
• The amount of movement will determine the frequency and amplitude of the sound wave.
Microphone
• Microphone has a diaphragm
• As the person speaks near to the microphone, the air vibrates, the air causes the diaphragm to vibrate
• This diaphragm is attached to a coil, the vibration causes the coil to move, as the coil moves it induces a
current/electric signal which is interpreted as binary values and stored in computer.
AS COMPUTER SCIENCE P1 42 | P A G E
Virtual reality headset
• Video is sent from a computer to the headset (either using an HDMI cable or a smartphone fitted into
the headset).
• Two feeds are sent to an LCD/OLED display (sometimes two screens are used, one for the left side of
the image and one for the right side of the image); lenses placed between the eyes and the screen
allow for focusing and reshaping of the image/video for each eye, thus giving a 3D effect and adding to
the realism.
• Most headsets use 110° field of view which is enough to give a pseudo 360° surround image/video.
• A frame rate of 60 to 120 images per second is used to give a true/realistic image.
• As the user moves their head (up and down or left to right), a series of sensors and/or LEDs measure
this movement, which allows the image/video on the screen to react to the user’s head movements
(sensors are usually gyroscopic or accelerometers; LEDs are used in conjunction with mini cameras to
further monitor head movements).
• Headsets also use binaural sound (surround sound) so that the speaker output appears to come from
behind, from the side or from a distance, giving very realistic 3D sound.
• Some headsets also use infrared sensors to monitor eye movement (in addition to head movement),
which allows the depth of field on the screen to be more realistic; an example of this is to make objects
in the foreground appear fuzzy when the user’s eyes indicate they are looking into the distance (and
vice versa)
Touchscreen
Resistive Touchscreen
• Made up of two charged plates
• When the plates touch due to pressure applied
• a circuit is completed
• Microprocessor calculates the coordinates of touch
• Coordinates used to calculate the position and the desired action is performed by the
microprocessor
Capacitive Touchscreen
• Made up from material that stores electric charge
• When the touchscreen is touched, the charge flows from the screen to the user’s finger •
• A sensor detects the change and point of contact is registered
• The coordinates are used to calculate the position.
Buffer
Buffers are used to temporarily store data in memory for processing. They are commonly used in computer
programming to hold input or output data that is being transferred between different parts of a program or
between multiple programs. Buffers can help improve the performance of a program by reducing the
amount of disk I/O or network traffic that is required for data processing. They can also be used to prevent
data loss or corruption in case of a system failure or interruption.
AS COMPUTER SCIENCE P1 43 | P A G E
Random Access Memory (RAM) and Read Only Memory (ROM)
RAM
• Random Access Memory
• volatile
• Data is not stored permanently, only applications and part of operating system currently in use is
stored in RAM.
ROM
• Read Only Memory
• Non-Volatile Memory Data is stored permanently mostly instructions regarding BIOS are stored and
general instructions for startup.
• Rom cannot be altered.
Explain the differences between Static RAM (SRAM) and Dynamic RAM (DRAM)
DRAM needs to be refreshed constantly after every SRAM doesn’t need to be refreshed constantly
15 microseconds, otherwise the capacitor loses its
charge.
DRAM makes use of single transistor and capacitor SRAM has more complex circuitry
DRAM has slower data access time SRAM has faster data access time
AS COMPUTER SCIENCE P1 44 | P A G E
Monitoring & Control Systems
• Sensors send data to microprocessor
• Data is converted from analog to digital if necessary
• Microprocessor calculates a value based on the results from sensor
• Microprocessor compares this value with the stored value or acceptable range
• Monitoring System o If value is within range then computer might not do anything
o If value is outside range, microprocessor sends a signal to a buzzer/printer which is converted
from analog to digital if necessary to alarm/inform the user that sensor reading is outside
range.
• Control System o If value is outside the range microprocessor sends a signal to the actuator which is
converted from analog to digital is necessary, the device then affects the next set of readings from
sensor.
• Process is continuous
AS COMPUTER SCIENCE P1 45 | P A G E
3.2 Logic Gates and Logic Circuits
AS COMPUTER SCIENCE P1 46 | P A G E
AS COMPUTER SCIENCE P1 47 | P A G E
Chapter 4 Processor Fundamentals
AS COMPUTER SCIENCE P1 48 | P A G E
Von Neumann Architecture
ALU
• Arithmetic Logic Unit or ALU is used to perform arithmetic and logical operations. The temporary result
of which is stored in accumulator.
Control Unit
• Control unit sends signals through the control bus to various components to synchronize the fetch and
execute cycle.
System Clock
• Generates timing signals to synchronize fetch and execute cycle.
AS COMPUTER SCIENCE P1 49 | P A G E
Registers
• Status Register
o Status register is interpreted as flags for different reasons, such as overflow in addition
calculation, or result of a calculation is zero.
• PC
o Program Counter is used to store the address of the next current instruction to be fetched.
o It is increased by one as soon as the address is fetched into MAR.
How special registers are used in the fetch and execute cycle
• Program Counter is used to store the address of the next current instruction to be fetched, once an
instruction is fetched the program counter is incremented by one.
• The address stored in the PC is the transferred to MAR
• The content at the location in MAR is stored in MDR
• The instruction stored in MDR is then transferred to CIR, instruction is then decoded and Control unit
sends signals through control bus to various components to synchronize the fetch and execute cycle.
AS COMPUTER SCIENCE P1 50 | P A G E
Buses used in Von Neumann model
• Data Bus
o Bidirectional
o Transfer data to and from processor and i/o devices
• Address bus
o Unidirectional
o Used to transfer address of instruction of memory or input output device
• Control bus
o Bidirectional
o Used to transmit control signals to synchronize fetch and execute cycles o
Clock Speed
• Clock speed determines the number of instructions executed per second.
• Each processor instruction takes specific number of clock cycles to execute
• The greater the clock speed is, the more clock cycles per unit time, instructions are fetched
and executed quicker, less execution time.
• however there’s a limit on clock speed because heat generated by high clock speed cannot
be removed fast and can affect the performance of CPU.
Cache Memory
• When a processor reads memory, it first checks out cache and then moves
• on to main memory if the required data is not there.
• Cache memory stores frequently used instructions and data that need to be accessed faster.
• This improves processor performance.
AS COMPUTER SCIENCE P1 51 | P A G E
USB / HDMI / VGA
USB ports
The Universal Serial Bus (USB) is an asynchronous serial data transmission method. It has quickly become
the standard method for transferring data between a computer and a number of devices. The USB cable
consists of a four-wired shielded cable, with two wires for power and the earth, and two wires used for data
transmission. When a device is plugged into a computer using one of the USB ports
• the computer automatically detects that a device is present (this is due to a small change in the voltage
level on the data signal wires in the cable)
• The device is automatically recognized, and the appropriate device driver is loaded up so that
computer and device can communicate effectively
• if a new device is detected, the computer will look for the device driver which matches the device. If
this is not available, the user is prompted to download the appropriate software
Benefits Drawbacks
✓ Supported by many operating systems ✓ the present transmission rate is limited to less
✓ Plug and play feature, appropriate drivers are than 500 megabits per second
installed automatically ✓ the maximum cable length is presently about
✓ Universal/Industrial standard so variety of five meters
support is available ✓ the older USB standard (such as 1.1) may not
✓ Backwards compatible be supported in the near future
✓ Almost impossible to connect it incorrectly
✓ Allows power to be drawn to charge devices
HDMI
High-definition multimedia interface (HDMI) ports allow output (both audio and visual) from a computer to
an HDMI-enabled device. They support highdefinition signals (enhanced or standard). HDMI was introduced
as a digital replacement for the older Video Graphics Array (VGA) analogue system. Modern HD (high
definition) televisions have the following features, which are making VGA a redundant technology:
This means that modern HD televisions require more data, which has to be received at a much faster rate
than with older televisions (around 10 gigabits per second). HDMI increases the bandwidth, making it
possible to supply the necessary data for high quality sound and visual effects. HDMI can also afford some
protection against piracy since it uses high-bandwidth digital copy protection (HDCP). HDCP uses a type of
authentication protocol. For example, a Blu-ray player will check the authentication key of the device it is
sending data to (such as an HD television). If the key can be authenticated, then handshaking takes place
and the Blu-ray can start to transmit data to the connected device.
AS COMPUTER SCIENCE P1 52 | P A G E
Benefits Drawbacks
✓ the current standard for modern televisions ✓ not a very robust connection (easy to break
and monitors connection when simply moving device)
✓ allows for a very fast data transfer rate ✓ limited cable length to retain good signal
✓ improved security (helps prevent piracy) ✓ there are currently five cable/ connection
✓ supports modern digital systems standards
VGA
VGA was introduced at the end of the 1980s. VGA supports 640 × 480-pixel resolution on a television or
monitor screen. It can also handle a refresh rate of up to 60Hz (60 frames a second) provided there are
only 16 different colors being used. If the pixel density is reduced to 200 × 320, then it can support up to
256 colors. The technology is analogue and, as mentioned in the previous section, is being phased out.
Benefits Drawbacks
AS COMPUTER SCIENCE P1 53 | P A G E
Interrupt
• An interrupt is a signal from a device or program to demand processor’s attention,
AS COMPUTER SCIENCE P1 54 | P A G E
F.E Cycle
AS COMPUTER SCIENCE P1 55 | P A G E
4.2 Assembly Language
The only programming language that a CPU can use is machine code. Every different type of computer/chip
has its own set of machine code instructions. A computer program stored in main memory is a series of
machine code instructions that the CPU can automatically carry out during the fetch-execute cycle. Each
machine code instruction performs one simple task, for example, storing a value in a memory location at a
specified address. Machine code is binary, it is sometimes displayed on a screen as hexadecimal so that
human programmers can understand machine code instructions more easily
The first programming language to be developed was assembly language, this is closely related to machine
code and uses mnemonics instead of binary.
The structure of assembly language and machine code instructions is the same. Each instruction has an
opcode that identifies the operation to be carried out by the CPU. Most instructions also have an operand
that identifies the data to be used by the opcode
AS COMPUTER SCIENCE P1 56 | P A G E
Stages of assembly
Before a program written in assembly language (source code) can be executed, it needs to be translated
into machine code. The translation is performed by a program called assembler. An assembler translates
each assembly language instruction into a machine code instruction. An assembler also checks the syntax
of the assembly language program to ensure that only opcodes from the appropriate machine code
instruction set are used. This speeds up the development time, as some errors are identified during
translation before the program is executed.
A single pass assembler puts the machine code instructions straight into the computer memory to be
executed.
A two-pass assembler produces an object program in machine code that can be stored, loaded then
executed at a later stage. This requires the use of another program called a loader. Two pass assemblers
need to scan the source program twice, so they can replace labels in the assembly program with memory
addresses in the machine code program
Pass 1
✓ Read the assembly language program one line at a time.
✓ Ignore anything not required, such as comments.
✓ Allocate a memory address for the line of code.
✓ Check the opcode in the instruction set.
✓ Add any new labels to the symbol table with the address, if known.
✓ Place the address of the labelled instruction on the symbol table.
Pass 2
✓ Read the assembly language program one line at a time.
✓ Generate object code, including opcode and operand, from the symbol table generated in Pass 1.
✓ Save or execute the program.
The second pass is required as some labels may be referred to before their address is known. For
example, Found is a forward reference for the JPN instruction
AS COMPUTER SCIENCE P1 57 | P A G E
If the program is to be loaded at memory address 100, and each memory location contains 16 bits, the
symbol table for this small section of program would look like this:
Arithmetic operations
These instructions perform simple calculations on data stored in the accumulator and store the answer the
accumulator, overwriting the original data.
ADD, INC, DEC
Compare instructions
Compare the operand with the accumulator value
CMP
AS COMPUTER SCIENCE P1 58 | P A G E
Different modes of addressing
Absolute addressing – the contents of the memory location in the operand are used. For example, if the
memory location with address 200 contained the value 20, the assembly language instruction LDD 200
would store 20 in the accumulator.
Direct addressing – the contents of the memory location in the operand are used. For example, if the
memory location with address 200 contained the value 20, the assembly language instruction LDD 200
would store 20 in the accumulator. Absolute and direct addressing are the same.
Indirect addressing – the contents of the contents of the memory location in the operand are used. For
example, if the memory location with address 200 contained the value 20 and the memory location with
address 20 contained the value 5, the assembly language instruction LDI 200 would store 5 in the
accumulator.
Indexed addressing – the contents of the memory location found by adding the contents of the index
register (IR) to the address of the memory location in the operand are used. For example, if IR contained
the value 4 and memory location with address 204 contained the value 17, the assembly language
instruction LDX 200 would store 17 in the accumulator.
Immediate addressing – the value of the operand only is used. For example, the assembly language
instruction LDM #200 would store 200 in the accumulator.
Relative addressing – the memory address used is the current memory address added to the operand.
For example, JMR #5 would transfer control to the instruction 5 locations after the current instruction.
Symbolic addressing – only used in assembly language programming. A label is used instead of a value.
For example, if the memory location with address labelled MyStore contained the value 20, the assembly
language instruction LDD MyStore would store 20 in the accumulator.
AS COMPUTER SCIENCE P1 59 | P A G E
4.3 Bit Manipulation
AS COMPUTER SCIENCE P1 60 | P A G E
Shifts
Logical shift left involves shifting bits to the left by a certain number of positions, while logical shift right
involves shifting bits to the right by a certain number of positions. These shifts fill the empty positions
with zeroes. In contrast, arithmetic shift involves shifting bits to the left or right while preserving the sign
bit, which is the leftmost bit representing the sign (+/-) of the number.
To perform a logical shift left or right on an 8-bit binary number, we simply shift the bits in the desired
direction and fill the empty positions with zeroes. For example, if we want to logical shift an 8-bit binary
number 3 positions to the left, we will shift all the bits 3 places to the left and fill the empty positions
with zeroes.
To perform an arithmetic shift left or right on an 8-bit binary number, we similarly shift the bits in the
desired direction. However, for an arithmetic shift right, we fill the empty positions with the same bit as
the sign bit, while for an arithmetic shift left, we fill the empty positions with zeroes. For example, if we
want to arithmetic shift an 8-bit binary number 3 positions to the right, we will shift all the bits 3 places
to the right and fill the empty positions with the sign bit.
Cyclic shift, also known as circular shift, involves shifting the bits of a binary number to the left or right,
and then bringing the "extra" bits around to the other side of the number. This is different from a logical
or arithmetic shift, where the extra bits are always filled with zeroes or the sign bit.
To perform a cyclic shift on an 8-bit binary number, you can first determine the number of positions to
shift. Then, you can shift the bits in the desired direction and wrap the extra bits around to the other end
of the number. For example, if you are performing a cyclic shift to the left by 3 positions on the binary
number 10101110, you would get 01110101.
AS COMPUTER SCIENCE P1 61 | P A G E
Chapter 5 System Software
AS COMPUTER SCIENCE P1 62 | P A G E
File / Secondary Storage Management
• Storage space divided into file allocation units
• Space allocated to particular files
• Maintains/creates directory structures
• Specifies the logical method of file storage (e.g. FAT or NFTS)
• Provides file naming conventions
• Controls access // implements access rights // implements password protection
• Specifies tasks that can be performed on a file, close, minimize, delete, copy, duplicate, create, move
etc.
• Creates files/folders
• Renames file/folders
Interrupt Handling
• Handles the signals sent when the attention of the processor is required elsewhere
• Halts the execution of the current process
• Stores the current values of the current process on the stack
• Loads and executes the appropriate ISR code
• Use of priorities for handling multiple interrupts
• Saves data on power outage
Error Detection And Recovery Management
• Deals with interrupts
• Deal with run time errors generated by software
• Deal with hardware faults
• Error diagnostic messages
• Deadlock detection and recovery
• Safe-mode boot-up routines
• System shutdown
• Saves system restore points
AS COMPUTER SCIENCE P1 63 | P A G E
Security Management
• Provides user accounts and passwords
• Sets up user accounts
• Checks passwords, authentication
• Implements access rights
• Automatic backup
• System restore
• Ensures privacy of data
Printer Management
• Installs printer driver
• Sends data to the printer buffer
• Sends commands to printer
• Receives and handles error messages/signals/interrupts from the printer
Memory management
• Reads data from RAM, Writes data to RAM e.g. any current data
• RAM is assigned into blocks
• dynamic allocation of RAM to programs / processes
• Allocates virtual memory when there’s insufficient space in RAM to run a program
• Allocates RAM to optimize performance
• Ensures fair usage of memory
• Organizes memory
• Keep processes separate
• To release memory when a process stops
• moves data from secondary storage when needed // manages paging, segmentation and virtual
memory // Swaps data to and from the hard drive
• Memory protection, prevents the process to access memory not allocated to it, prevents two programs
/ processes occupying the same area of RAM at the same time
AS COMPUTER SCIENCE P1 64 | P A G E
Utility programs
Disk Defragmenter
• Rearrange the data on a disk
• so that files are contiguous/together and all free space is collected together to improve efficiency
• Creates a larger area of contiguous free space
• Less time is taken to access files because each one is contiguous so there is less head movement
Disk formatter
• Prepare a disk for initial use
• Makes existing data inaccessible
• Sets up the specified file system
• Partitions the disk into logical drives
• May check of errors on the disk
File compression
Reduce the size of file
Virus Checker
Scans files stored on a computer system
Scans files when they enter the system
Sets up schedules for virus-checking
Isolates/Quarantines/deletes viruses
Regularly updates the virus definitions
makes more RAM available for programs to run because it removes software that might be taking up
memory / replicating
Backup Software
Creates copy of the contents of disk
Allows user to decide what is backed up, all data, all files that have changed since last backup
Allows the user to set up an offsite backup
May encrypt backup files
Restores data if necessary
AS COMPUTER SCIENCE P1 65 | P A G E
Program libraries
Library routine
• Pre written code
• To perform common / complex tasks
• Library is imported into the program, and the functions written in the library routine can be called in
your program
Advantages Disadvantages
✓ Code is already tested, so it is robust and ✓ May not work with other code,
more likely to work compatibility issues
✓ Saves programming time, no need to write ✓ Not guaranteed throughout testing, may
from scratch have bugs
✓ The programmer can use functions that ✓ May not meet exact needs, may need
he/she may not be able to code editing otherwise
✓ In there is an improvement in the library ✓ If library routine is changed, it might cause
routine, program is updated automatically problems with the code or produce
unexpected outcomes
AS COMPUTER SCIENCE P1 66 | P A G E
Why we shouldn’t DDL files while developing
• Application will not work if DLL is corrupted, could mean that the program stops working as expected
• Malicious changes to the DLL file could install a virus on the user’s computer
• An external change to the DLL could stop the application working or change the way it works
• The DDL file must be present at run time otherwise there’s an error
• Appropriate software must be available at run time to link the DDL file
AS COMPUTER SCIENCE P1 67 | P A G E
5.2 Language Translators
Language Translators
Compiler
• Converts a high-level language into a different form
• Attempts to translate the whole source code
• Creates a separate error report at the end of the translation process
• If translation successful / no errors creates an executable file
AS COMPUTER SCIENCE P1 68 | P A G E
Interpreter
• Converts a high-level language into a different form
• Reads each line then translates it and executes it
• Needs the source code to be present when the user’s program is run
• Stops when an error is encountered // displays errors where it finds them
Identify three other tools or features found in a typical IDE to support the writing of the program
• Color coding // pretty printing
• Auto complete
• Auto correct
• Context sensitive prompts - Displays predictions of the code being entered
• Expand and collapse code blocks
Explain why high-level language programs might be partially compiled and partially interpreted.
• partially compiled programs can be used on different platforms as they are interpreted when run
• code is optimized for the CPU as machine code is generated at run time
How is java compiled?
• Java uses a twostep translation process
• Java code is partially compiled and partially interpreted
• Code is first translated into intermediate code using java compiler
• Intermediate code is finally interpreted by the java virtual machine
AS COMPUTER SCIENCE P1 69 | P A G E
Benefit and drawback of using a language that’s partially compiled and partially interpreted
• Benefit: program may be interpreted on different platforms
• Drawback: intermediate code, program still needs to interpreted on user’s computer which may run
slowly
• Extra CPU resources may be required
AS COMPUTER SCIENCE P1 70 | P A G E
Chapter 6 Security, Privacy and Data Integrity
AS COMPUTER SCIENCE P1 71 | P A G E
Preventing data loss and restricting data access
• Usernames and passwords
o User has a username and password access to resources, can be limited to specific accounts
o Cannot access them without valid username and password, prevents unauthorized access to
system
o To prevent unauthorized access
• Biometrics / Fingerprints / Retina Scan / Iris Scanner
• Password protect file
• Two step verification
• Token authentication / use of dongle / swipe cards
• Firewall
o A firewall can be software or hardware. It sits between the user’s computer and an external
network (such as the internet) and filters information in and out of the computer.
o Prevents unauthorized access to data
o Monitors incoming and outgoing traffic
o Blocks transmissions from unauthorized sources
o Blocks signals that don’t meet set of requirements
o Keeps a log of signals
o Applications can have network access denied
o Maintains an allow list / deny list of IP addresses
o Stops unauthorized access, by preventing hackers gaining access to system
• Anti-virus / Anti malware
o Scans for malicious software
o Quarantines or deleted any malicious software found
o Scans at regular intervals
o Should be kept up to date
When should antivirus check for virus?
• When a new file is downloaded
• External storage device is connected
AS COMPUTER SCIENCE P1 72 | P A G E
• Access Rights
o Different access rights for individuals users
o To stop users editing data they’re not permitted to access
• Digital signatures
o Digital signatures protect data by providing a way of identifying the sender of, for example, an
email.
o (email) message put through hashing algorithm to produce a digest
o Digest encrypted with sender’s private key (to create the digital signature)
o the (digital) signature can only be decrypted with matching sender’s public key
• Disk Mirroring
o Data is written on two or more disks simultaneous
AS COMPUTER SCIENCE P1 73 | P A G E
Phishing
Phishing is when someone sends legitimate-looking emails to users. They may contain links or
attachments which, when clicked, take the user to a fake website, or they may trick the user into
responding with personal data such as bank account details or credit card numbers. The email often
appears to come from a trusted source such as a bank or service provider. The key is that the recipient
has to carry out a task (click a link, for example) before the phishing scam causes harm
Pharming
Pharming is malicious code installed on a user’s computer or on a web server. The code re-directs the
user to a fake website without their knowledge (the user does not have to take any action, unlike
phishing). The creator of the malicious code can gain personal data such as bank details from users. Often,
the website appears to belong to a trusted company and can lead to fraud or identity theft
illegal access to a computer system without the owner’s permission.
AS COMPUTER SCIENCE P1 74 | P A G E
6.2 Data Integrity
Validation
Validation checks that data entered is reasonable. One example is range check, present check, type
check.
Check digit
AS COMPUTER SCIENCE P1 75 | P A G E
Validation Checks
AS COMPUTER SCIENCE P1 76 | P A G E
Verification
• Verification checks that the data entered is same as original. One example is double entry
• Checking that data entered is consistent to that of source
• Comparison of two versions of data
• e.g. double entry. Proof reading, visual check
• In event of mismatch user is forced to reenter data
• Does not check that whether data is sensible or not
Verification Checks from paper-based source during data entry
• Double Entry // The data from the form is entered twice by two different people from the paper form
and automatically compared
• Visual check // The data from the compared by two different people after entry from to the paper form
Verification Checks
Parity Check
• Parity can be odd or even
• Parity check uses the number of 1s in a binary pattern
• If there is an even / odd number of 1s then parity is even / odd
• Following the transmission parity of each byte checked
• A parity bit is used to ensure parity is correct
• Automatically checks for errors on receipt of data
• Alerts if data has been received incorrectly, requests data to be resent
• Provides a verification check on data
How a parity block check can identify a bit that has been corrupted?
• Each byte has a parity bit
• An additional parity byte is sent with vertical and horizontal parity
• Each row and column must have odd/even number of 1s
• Identify the incorrect row and column
• Their intersection is the error
AS COMPUTER SCIENCE P1 77 | P A G E
Give a situation where a parity block cannot identify corrupted bits?
• Errors in an even number of bits could cancel each other out
• Prevents error being identified
• Could appear to be correct
How does a computer use parity byte to perform further check on received data?
• Parity bit of each column is worked out
• Computer generates a parity byte and compares
• If incorrect parity, there’s an error occurred
• Incorrect bit can be identified
Checksum
• A calculation is done on block of data
• The result is transmitted with the data
• Calculation repeated at receiving end
• Results compared
• If different results an error has occurred
AS COMPUTER SCIENCE P1 78 | P A G E
Chapter 7 Ethics and Ownership
Ethics
• A system of moral principles
• That guides behavior and decision making
• Based on philosophical and religious values
• e.g. respectful and considerate behavior
As a computing professional, it is essential to understand the need for ethics. The purpose of ethics is to
guide professionals in making responsible decisions that impact individuals, society, and organizations. By
following ethical guidelines, computing professionals can ensure the development and use of technology
that benefits society and minimizes harm. Additionally, ethical behavior helps to build trust, credibility, and
professionalism within the field.
AS COMPUTER SCIENCE P1 79 | P A G E
Case Scenario Questions
Sophie is about to join a job as a junior developer,
Why’s sofia asked to sign a professional code of conduct before starting work?
• Sophie is confirming that she understands the code of conduct
• To make sure she knows what sort of behaviour is expected from her
• To make sure she understands what consequences she’d have to face for some actions
• To ensure all employees adhere to the standards
AS COMPUTER SCIENCE P1 80 | P A G E
Copyright
• Formal or legal recognition of ownership of the program
• Intellection property rights to the program
• Protects against unauthorized reproduction of work
• Provides for legal right of redress
Need for copyright
• Copyright legislation protects the intellectual property of creators and encourages innovation and
creativity.
• It allows creators to control how their works are used, distributed, and copied.
• Copyright laws prevent unauthorized copying and distribution of works, which can lead to financial
losses and discourage further innovation.
• In the context of computer science, copyright laws protect software developers from having their code
stolen or copied without permission.
• Software development requires a significant investment of time and resources, and developers deserve
to be compensated for their efforts.
• The protection of software code helps to encourage further innovation by ensuring that developers can
profit from their work and continue to invest in new projects.
Commercial
• Software is purchased before it can be used
• With a license that restricts the number of users
• Program code cannot be edited
• Anyone can download if agree to the terms
• Restricted use
• Software key required to install
AS COMPUTER SCIENCE P1 81 | P A G E
• Compatibility is inbuilt for this software
Shareware
• Software is provided with free trial
• Users do not have access to source code
• Users may re distribute the software
Benefits for customer to obtain a shareware
• Can check the program whether it meets the requirements of the user
• Can check whether it’s worth to the spend money on it
• Shareware is free trial, so program can be checked without paying fee for a limited time
Open Source
• Software code comes with the software
• The user can modify software
• Once edited the software is re distributed with the changes
Why some programs are distributed under an open-source license.
• to allow users to customize the code
• to allow errors to be reported / identified / fixed by users
• to allow additional features to be added to the code
• to allow for collaboration
Freeware
• There is no charge for the software
• The software could still be copyrighted
• She can set her own restrictions on what a user can do with the program
AS COMPUTER SCIENCE P1 82 | P A G E
Artificial Intelligence
Artificial intelligence (AI) is a machine or application which carries out a task that requires some degree
of intelligence when carried out by a human being.
Artificial intelligence (AI) New developments in AI are constantly being announced and you are advised
to keep up to date by checking out the many websites that keep an eye on AI development. Below are
some of the developments and impacts that are currently expected to be seen in the near future.
Research has predicted that, by 2030, some 600 million jobs will be lost globally and as many as 400
million people will need to retrain or switch jobs – all caused by the inevitable advances in AI. The most
likely jobs to be lost are those doing medium- and low-skilled work, but high-skilled jobs (such as hospital
technicians, architects, engineers) are also at risk. This could lead to civil unrest with large numbers of
young people out of work, with few or no employment prospects, unless they have a sought-after skill.
History has shown, however, that previous technological advances all ended up creating a net increase
in jobs. As automation takes over, jobs on the factory floor are lost, but production becomes much faster
and more efficient, thus requiring an increase in the number people doing tasks that the automation
process cannot yet do, such as quality control, test driving new vehicles and so on. Technology creates
new jobs which are more interesting to humans than the manual jobs which are lost. However, history
does not always repeat itself, so we need to prepare ourselves for a large reduction in employment and
think about how to redistribute wealth so that the overall impact of AI will be positive. It is predicted
that, eventually, 99% of all jobs could be eliminated since the increase in the use of AI is exponential –
competition between countries and companies to expand their economies will continue to fuel this
growth. One question that might be legitimately asked is,
‘if 99% of jobs disappear, who will build the robots and maintain them?’ To answer that question, let us
consider a present-day solution to the question. 3D printers are actually now being designed and made
by other 3D printers with no human interaction – the entire process is automatic with AI algorithms in
control of the building, design and maintenance of these printers. So, it seems logical that other
robots/machines will build and maintain future robots and other AI systems. An increase in AI will leave
people with more time to pursue their hobbies and have a better lifestyle. Previous industrial revolutions
have led to steep changes in the economies of countries that embrace the modern technology. Being left
behind is not an economic option but is it a good environmental option? Improvements in AI technology
can have a positive impact on the environment. Scientists now have more information than ever about
what affects the environment. AI can help by finding patterns and interconnections within the thousands
of data sets. This helps scientists make informed predictions about the environment and potential
climate change. Since this analysis is overly complex, the use of AI systems can speed up this process
AS COMPUTER SCIENCE P1 83 | P A G E
incredibly and allow the human race to take action much faster than they could by present methods.
Here are some potential ways in which AI can help:
» AI can help us to conserve natural resources (for example, improve the conservation of water supplies).
Detection of pollution in the air and in the seas using AI is much more accurate, allowing scientists to
pinpoint the source(s) of pollution more accurately and much faster.
» In the future it could be possible to combine weather forecasting and AI to allow for better predictions
about renewable energy resources needed for the next few days. This would lead to a more precise
automated renewable energy forecast using solar, tide, thermal and wind energy generation.
» AI would allow us to learn from nature’s ecosystems by monitoring and modelling, for example, a river’s
ecosystem.
This would enable us to gain a better understanding of what can affect the delicate balance of life in the
river. Such real-time environmental monitoring would allow us to quickly take remedial action before the
affects became irreversible. AI would make this possible due to the ability to analyze vast amounts of
very complex (inter-related) data.
Applications of AI
• the use of a language
• conducting a mathematical calculation or function
• recognizing a person’s face
• the ability to operate machinery, such as a car, an airplane or a train
• analyzing data to predict the outcome of a future event, such as weather forecasting.
• Police identifying wanted people
o Uses image recognition
o ... to identify features/characteristics/items in an image
• Natural language interfaces
o Use speech recognition to identify words that are spoken
o ... and adapts to learn regional accents
• Self-driving cars
o Detects its position on the road and within the traffic
o Follows a route // Collision avoidance // Self-parking etc.
• Spoken Interfaces
o Use natural language processing
o ... to take a sentence and work out its meaning
• Game playing
o Models characters in a computer game
o to allow computer characters to react according to the player's
o Movements
• Natural Language Processing (NLP): AI-powered NLP applications can analyze, understand, and
generate human language. Examples include chatbots, language translation services, and voice
assistants.
AS COMPUTER SCIENCE P1 84 | P A G E
• Image Recognition: AI-powered image recognition technology is used to identify objects, people, and
patterns in images and videos. Examples include facial recognition software, image-based search
engines, and self-driving cars.
• Speech Recognition: AI-powered speech recognition technology can understand and interpret spoken
language. Examples include speech-to-text software, virtual assistants like Siri and Alexa, and
interactive voice response (IVR) systems.
• Fraud Detection: AI-powered fraud detection systems can analyze large volumes of data to identify
patterns and detect potential fraud. Examples include credit card fraud detection, insurance claims
fraud detection, and identity verification systems.
• Healthcare: AI is being used in healthcare to help diagnose and treat diseases. Examples include AI-
powered diagnostic tools, predictive analytics for personalized treatment plans, and drug discovery.
• Finance: AI is being used in finance to automate tasks, detect fraud, and improve investment decisions.
Examples include algorithmic trading, credit scoring, and fraud detection.
• Autonomous Vehicles: AI is powering the development of self-driving cars and other autonomous
vehicles. This technology relies on sensors and algorithms to navigate and make decisions in real-time.
• Robotics: AI is being used to power robots in a variety of applications, from manufacturing and logistics
to healthcare and entertainment. Examples include warehouse robots, surgical robots, and
entertainment robots.
• Personalization: AI-powered personalization is being used to deliver tailored experiences to users in a
variety of industries, from e-commerce to entertainment. Examples include personalized
recommendations, targeted advertising, and customized content.
• Predictive Maintenance: AI-powered predictive maintenance systems can analyze data from equipment
sensors to predict when maintenance is needed, reducing downtime and increasing efficiency.
Examples include predictive maintenance in manufacturing, transportation, and energy.
•
How would the computer use Artificial Intelligence (AI) to play the board game
• The rules / past moves / decision making algorithms of the game will be stored
• The AI program is trained, by playing many times
• AI will look (ahead) at possible moves
• ... and/or analyse the pattern of past choices
• … and choose the move most likely to be successful
• Computer could learn how to improve // learn from previous mistakes
• … by storing the positive/negative result of choices
• ... and changing its future choices
AS COMPUTER SCIENCE P1 85 | P A G E
Chapter 8 Databases
AS COMPUTER SCIENCE P1 86 | P A G E
Why database should be upgraded from file-based approach to relational database
• To reduce data redundancy, File based approach has data redundancy issues, data is repeated in
different files, repetition of data. In a relational data base, data in tables in database are linked
together using foreign keys.
• Improved data integrity, Data is stored in separate tables in a file based approach, it has inconsistency
in data, data might be changed by one application but not by other, in relational data base, data is
only entered once and is related, so any changes made by one application would mean that the data
would be changed for other applications as well.
• Data dependency is overcome, File based approach also has data dependency issues, in relational
database data is not depended on the database, data structure can used independent of application
and query program. structure of data can change and doesn’t affect program. Data can be accessed by
any program
• Privacy is improved
AS COMPUTER SCIENCE P1 87 | P A G E
Database terminology
Entity - anything that can have data stored about it, for example, a person, place, event, thing.
Table - a group of similar data, in a database, with rows for each instance of an entity and columns for
each attribute.
Record - a row in a table in a database.
Field - a column in a table in a database.
Tuple - one instance of an entity, which is represented by a row in a table.
Attribute - an individual data item stored for an entity, for example, for a person, attributes could include
name, address, date of birth.
Primary key - a unique identifier for a table. It is a special case of a candidate key.
Candidate key - an attribute or smallest set of attributes in a table where no tuple has the same value.
Secondary key - a candidate key that is an alternative to the primary key.
Foreign key - a set of attributes in one table that refer to the primary key in another table.
Relationship (one-to-many, one-to-one, many-to many) - situation in which one table in a database has
a foreign key that refers to a primary key in another table in the database.
Referential integrity
• Referential integrity is making sure that the data that is being referenced actually exists.
• The foreign key that is used to refer to a primary key, must be valid, primary key must exist.
• Primary key and foreign key must have same data type
• Every foreign key value has a matching value in the corresponding primary key
• Cascading delete
o If a record is deleted in primary table
o All corresponding linked records must also be deleted
• Cascading update
o If a record is modified in primary table
o All linked records must be modified as well
Indexing - a data structure built from one or more columns in a database table to speed up searching for
data
AS COMPUTER SCIENCE P1 88 | P A G E
Normalisation
Normalisation (database) – the process of organising data to be stored in a database into two or more
tables and relationships between the tables, so that data redundancy is minimised.
First normal form (1NF) – the status of a relational database in which entities do not contain repeated
groups of attributes.
Second normal form (2NF) – the status of a relational database in which entities are in 1NF and any non-
key attributes depend upon the primary key. No primitive dependency.
Third normal form (3NF) – the status of a relational database in which entities are in 2NF and all non-key
attributes are independent. No transitive dependencies.
AS COMPUTER SCIENCE P1 89 | P A G E
8.2 Database Management System (DBMS)
Data management
• the organization and maintenance of data in a database to provide the information required.
Data Dictionary
• a set of data that contains metadata (data about other data) for a database.
AS COMPUTER SCIENCE P1 90 | P A G E
Security Features in DBMS
• Access Rights
o Restricts actions of specific users
• Encryption
o Makes the data incomprehensible
• Auto-backup
o Creates regular copies of data in case of loss
• Passwords
o Prevents unauthorized access
• Views
o Restrict which parts of database specifc users can see
Schema of a database
External
o Individual view of the database
Conceptual
o Describes the views the database users might have
Physical
o Describes how data will be stored on the physical media
Logical
o Describes how relationships will be implemented in the logical structure of the database
o the overview of a database structure
o models the problem / situation
o ... by using methods such as an ER diagram
o independent of any particular DBMS
Developer interface
• Reports can be made to output data, e.g marks of a student
• Forms can be set up to input data
• Objects such as drop down can be used to make input easier
• A menu can be added to select options for different actions
• Create a table
• Create reports
• Create forms
• Create relationship between tables
• Create queries
• To create user friendly features e.g. forms
• To create outputs e.g. reports for a given date
• To create interactive features e.g. dropdowns
AS COMPUTER SCIENCE P1 91 | P A G E
Query Processor
• To create SQL queries
• To search for data based on set criteria
• To perform calculations on extracted data
• searches for the data that meets the entered criteria
• organizes the results to be displayed to the user
AS COMPUTER SCIENCE P1 92 | P A G E
8.3 Data Definition Language (DDL) and Data Manipulation Language (DML)
AS COMPUTER SCIENCE P1 93 | P A G E
Structured Query Language
The standard query language used with relational databases for data definition and data modification
Creating a database:
CREATE DATABASE SAMPLE
Creating a table:
CREATE TABLE SAMPLE_DATA ( EmployeID VarChar(7)
NOT NULL, FirstName VarChar, DateOfBirth Date,
Stock Integer, Price Real, EntryTime Time, Alive
Boolean, PRIMARY KEY (EmployeID) FOREIGN KEY
(ClassID) REFERENCES CLASS (ClassID) );
AS COMPUTER SCIENCE P1 94 | P A G E
Display/return a value
SELECT table1.<column 1>, table2.<column 2> FROM
SAMPLE_DATA WHERE table.ID = ‘6A’; AND
table2.Price >= 50 GROUP BY Customer ID ORDER BY
Time DESC GROUP BY Customer ID ORDER BY Time ASC;
Write the SQL statement to find the average price of all the products
SELECT AVG (Price) FROM PRODUCTS;
Write the SQL statement to find the sum of all the prices
SELECT SUM (Price) FROM PRODUCTS;
Inner Join
The INNER JOIN keyword selects records that have matching values in both tables.
Or simpler method:
AS COMPUTER SCIENCE P1 95 | P A G E
Comparing to current date
Q: Select all records where the value of the City column starts with ‘a’
WHERE City LIKE ‘a%’;
Q: Select all records where the value of the City column ends with ‘a’
WHERE City LIKE ‘%a’;
Q: Select all records where the value of the City column contains letter ‘a’
WHERE City LIKE ‘%a%’;
Q: Select all records where the value of the City column starts with ‘a’ and ends with letter ‘b’
WHERE City LIKE ‘a%b’;
Q: Select all records where the value of the City column does not start with ‘a’
WHERE City NOT LIKE ‘a%’;
Q: Select all records where the second letter of the City is an ‘a’
WHERE City LIKE ‘_a%’;
Q: Select all records where the first letter of the City is an ‘a’ or ‘c’ or ‘s’
WHERE City LIKE ‘[acs]%’;
AS COMPUTER SCIENCE P1 96 | P A G E