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

Complete Notes

The document covers the fundamentals of data representation, including binary, hexadecimal, and denary systems, as well as binary arithmetic operations like addition and subtraction. It discusses multimedia concepts such as bitmap and vector images, sound sampling, and compression techniques, both lossless and lossy. Additionally, it explains networking devices, their benefits, and the client-server model in network communication.

Uploaded by

Fareed Manj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Complete Notes

The document covers the fundamentals of data representation, including binary, hexadecimal, and denary systems, as well as binary arithmetic operations like addition and subtraction. It discusses multimedia concepts such as bitmap and vector images, sound sampling, and compression techniques, both lossless and lossy. Additionally, it explains networking devices, their benefits, and the client-server model in network communication.

Uploaded by

Fareed Manj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 96

Chapter 1 Information representation

1.1 Data Representation

Binary | Hexa | Denary


The basis of any number system consists of:
• A base: the number of digits that a number system can use to represent numbers
• Place value for each digit: digits in certain positions have a specific value
• Denary - Base 10 integer digits
• Binary Systems - Base 2
• Possible bits (binary digits): 0 and 1
• All data and characters are represented in binary

128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0

E.g. 65 in binary is 0100001


Binary Coded Decimal (BCD)
• Binary representation where each positive denary digit is represented by a sequence of 4 bits (nibble)
• Only certain digits are converted to BCD, because particular digits represent a digit greater than 9.
• Ex. 429 in BCD:
• Convert each digit to their binary equivalents
• 4 = 0100 | 2 = 0010 |9 = 1001
Concatenate the 3 nibbles (4-bit group) to produce BCD: 0100 0010 1001
• Practical applications
• A string of digits on any electronic device displaying numbers (e.g. Calculators)
• Accurately measuring decimal fractions
• Electronically coding denary numbers

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

Hexadecimal Systems - Base 16


• Possible digits: 0 to 9 and A to F, where A to F represent denary digits 10 to 15
• Practical applications:
• Defining colors in HTML
• Defining Media Access Control (MAC) addresses
• Assembly languages and machine code
• Debugging via memory dumps
• E.g. A5 in Denary = (16×10) + (1×5) = 165
• E.g. 65 in Hexadecimal = 65÷16=4 Remainder 1∴ = 41

AS COMPUTER SCIENCE P1 2|P A G E


Binary Addition | Subtraction
Binary addition and binary subtraction are two fundamental operations in binary arithmetic, which is the
mathematical system used in computers and other digital devices.

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.

Carry out the subtraction 95 – 68 in binary

AS COMPUTER SCIENCE P1 3|P A G E


Measurement of the size of computer memories

• kibibyte/mebibyte/gibibyte/tebibyte/pebibyte has a binary prefix,


• kilobyte/megabyte/gigabyte/terabyte/petabyte has a denary prefix

ASCII Code and Unicode


Character Set
Set of characters defined by the computer hardware and software, so that the computer can understand
human characters. Symbols that the computer recognizes. Each character has a unique binary value
ASCII Code
A coding system used to represent all characters on a keyboard, including denary numbers, alphabets,
characters and 32 control codes. Standard ASCII is a 7-bit binary code which supports up to 128 characters,
and extended ascii is an 8-bit code supporting up to 256 characters.

Issues with ASCII coding system How Unicode overcomes them

Only supports 128/256 characters


Uses two, three or four bytes per character
Uses 1 byte to represent each character only

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

AS COMPUTER SCIENCE P1 4|P A G E


1.2 Multimedia

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

How can a computer store this bitmap image?

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

Pixel : Smallest addressable element of a bitmap image


File Header : Contains meta data of the image

AS COMPUTER SCIENCE P1 5|P A G E


What does file header store?
• Confirmation that file is BMP
• File size
• File location
• Type of compression used
• File name
• Color depth
• Image resolution
• File extension
Image Resolution : number of pixels that make up an image, for example, an image could contain 4096 ×
3192 pixels (12738656 pixels in total).
Screen Resolution : number of horizontal and vertical pixels that make up a screen display. If the screen
resolution is smaller than the image resolution, the whole image cannot be shown on the screen, or the
original image will become lower quality
Color Depth/Bit Depth : number of bits used to represent the smallest unit in, for example, a sound or image
file – the larger the bit depth, the better the quality of the sound or color image.

File Size Calculation for Bitmap Image

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.

AS COMPUTER SCIENCE P1 6|P A G E


Differences between bitmap and vector images

Bitmap Image Vector Image


Vector graph store a set of instructions about
Bitmap is made up pixels how to draw the same
Bitmap files are usually bigger than vector Vector files are usually smaller in size than
graphics files, each pixel is stored, which has a vector graphics files because only the
binary value. File size greater compared to instructions and commands required to draw
vector image. the image are stored

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

Advantages of Vector Graphics over bitmap image

• 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

AS COMPUTER SCIENCE P1 7|P A G E


Sound
Sampling
• The analogue value of sound wave measured at set time intervals
• The amplitude of sound wave taken at regular time intervals

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.

How sampling is used to record sound clops


• Analog value of the sound wave is measured at set time intervals
• An approximation of sound wave is achieved.
• the sample is then encoded into binary values and stored.
• Increasing the sampling rate improves the accuracy of sound.

AS COMPUTER SCIENCE P1 8|P A G E


1.3 Compression

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

Run Length Encoding


• Run Length Encoding is a lossless compression algorithm that operates on repeating data.
• Data is not permanently deleted and can be reconstructed back.
• It’s most suitable for files with long run of repeated bits of data
• As the algorithm identifies repeating data, it encodes them into to two values
• The first value represents the number of repetitions
• The second value represents the data, or its index, e.g. ASCII code, color code, or the index with which
it’s stored in a dictionary
• In some cases, the second value is preceded by a control character as well.

Take example of this text:

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.

AS COMPUTER SCIENCE P1 9|P A G E


The algorithm identifies the long run of repeating pixels, and encodes them into
two values, one value represents the number of repetitions whereas the second
value represents the color code/binary value of color. The following image will be
compressed as following
B5 W1 B1 W1 B1 W1 W1 B1 W1 B1 W1 W1 B1 W1 B1 W1 W1 B1 W1 B1 W1

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

2.1 Networks Including the Internet

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.

The benefits of networking devices include:


Improved Communication: Networking devices enable communication between devices within a
network, allowing for real-time collaboration and sharing of information.
Resource Sharing: Networking devices allow for the sharing of resources such as printers, scanners, and
internet connections, reducing costs and improving efficiency.
Increased Security: Networking devices can help to improve network security by providing features such
as firewalls, access controls, and encryption.
Scalability: Networking devices can easily be added or removed from a network, allowing for easy
scalability as a network grows or changes.
Centralized Management: Networking devices can be managed centrally, making it easier to configure
and monitor 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

• There’s at least one computer which acts as a server


• Other computers are referred to as clients
• Client requests resources/services from the server
• Server provides services/resources/applications/files

Webpage Bank

• The information of the user is stored on the


• User’s browser is the client server
• The file is made available from the server • The user’s computer/browser acts as the client
• Client requests for the file • It sends a request to the server via browser
• The desired file is returned to the client • The server responds with the information
computer requested by the user
• E.g. recent transactions, current account
balance, any due payments

AS COMPUTER SCIENCE P1 13 | P A G E
Benefits Drawbacks

✓ Single point of failure: The client-server model


is vulnerable to a single point of failure. If the
server goes down or becomes unavailable,
clients may not be able to access the resources
or services they need.
✓ Scalability: The scalability of the client-server
model can be an issue, as the server may
✓ Centralized storage of data, data can be
become overwhelmed if too many clients try to
accessed from any workstation/computer
access it simultaneously. This can result in slow
✓ Centralized backup
response times or even server crashes.
✓ Creation of security
✓ Security: The client-server model can be
✓ Internet monitoring
vulnerable to security breaches if the server is
✓ Clients can be less powerful, low specification
not properly secured. For example, if a hacker
devices, cheaper to set up
gains access to the server, they can potentially
✓ Saving resources on server reduces burden on
access all the data stored on it and
client
compromise the system.
✓ Access rights can be assigned to users
✓ Cost: Implementing a client-server architecture
can be expensive, as it requires the use of
dedicated servers and specialized software.
✓ Complexity: The client-server model can be
complex to implement and maintain, especially
in large networks. It requires expertise in
server administration, networking, and security
to ensure that everything is running smoothly.

Examples of use of client-server network model


• Using a printing server
• Using a file server
• School or office with centralized storage of data
• Access to network resources needs to be properly controlled
• There is a need for good network security.
• The company requires its data to be free from accidental loss (in other words, data needs to be backed
up at a central location).

AS COMPUTER SCIENCE P1 14 | P A G E
Peer to Peer

• Each node is connected to all other nodes in the network


• All nodes can communicate with each other
• Each node is of equal status in the network
• Each node can share files to all nodes in the network
• Each node can access files from all nodes in the network
• All nodes are responsible for their own security

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

Examples of peer-to-peer network model


• The network of users is fairly small
• There is no need for robust security.
• They require workstation-based applications rather than being server-based.

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

their own programs and data/files


✓ data integrity issues, since many clients
access the same data which can lead to
inconsistencies

✓ 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

centrally) ✓ despite cheaper hardware, the start-up costs


✓ server can offer protection against hacking are generally higher than for thick clients
and malware

AS COMPUTER SCIENCE P1 16 | P A G E
Thick Client Thin Client

• always relies on a connection to a remote


• can run some of the features of the software server or computer for it to work
even when not connected to a server download • requires very few local resources (such as
a file. SSD, RAM memory or computer processing
• relies heavily on local resources time)
• more tolerant of a slow network connection • relies on a good, stable and fast network
• can store data on local resources such as HDD or connection for it to work
SSD • data is stored on a remote server or
computer

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

✓ If the main cable breaks, network problem


degrades badly.
✓ Difficult to detect and troubleshoot fault at
an individual station.
✓ Easier to set up ✓ Efficiency reduces as the number of devices
✓ Less cable required connected to it increases.
✓ Less expensive ✓ Collisions, not suitable for networks with
heavy traffic.
✓ Security is lower because several computers
receive the sent signal from the source.

How are packets transmitted between two computers in Bus Topology?


• Packets have the address of recipients.
• The sender transmits data through the bus.
• The bus carries data along the central cable.
• As the data arrives at each computer, the system compares the address to see if it matches.

Where will we use bus topology?


• Used when small and temporary network is needed.
• Networks which does not rely on high data transfer speed.
• Used in office or schools.

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

✓ Signals only go to destinations so secure


✓ Easy to connect/remove node ✓ If the central device fails then whole network
✓ Centralized management helps in monitoring goes down.
the network. ✓ Performance is dependent on capacity of
✓ Failure of one node or link doesn’t affect the central device.
rest of the network.
✓ Fewer collisions

How are packets transmitted between two computers in Star Topology?


• Packets have the address of recipients.
• Sender sends data to central devices.
• Server reads address and find where recipient is.
• Server directly sends data to recipient.
• Server transmits packets only to recipient.

Where will we use star topology?


• Large organizations
• Educational establishments
• Where high performance is must
• Found in homes as well where router acts as a server.

Features of Star Topology


• Must have a central device
• Each node is connected to the central device.
• Each node has a dedicated connection.
• Each connection must be bi-directional.

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.

How are packets transmitted between computers in Mesh Topology?


• Packets have addresses of recipients.
• Sender transmits packets directly to node.
• As each node is connected to at least one another node.

Where will we use mesh topology?


• Where establishment of communication is very important.
• Military organizations
• Emergency services

AS COMPUTER SCIENCE P1 22 | P A G E
HYBRID TOPOLOGY:
All the devices are interconnected to each other.

Benefits Drawbacks

✓ Highly reliable as in case of failure there are ✓ Cost, expensive to set up


many sub networks. ✓ Difficult to manage
✓ Easy to trouble shoot and fix errors. ✓ Complex network

Where will we use hybrid topology?


Large organizations with different topologies in each building.

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

✓ More secure less interference


✓ Devices not mobile
✓ Data transfer is faster
✓ Tripping hazards
✓ Cheaper overall

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.

Bluetooth is useful when


✓ transferring data between two or more devices which are less than 30 meters apart
✓ the speed of data transmission is not critical
✓ using low bandwidth applications (for example, sending music files from a mobile phone to a
headset).

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

Benefits of Copper Cable (twisted pair)


✓ Cheaper to install
✓ Easy to set up
✓ Been around for years

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

Fiber optic cables


• most commonly used to send data over long distances
• smallest signal attenuation
• very high resistance to external interference.
• high cost
• Fiber optic cables can be single- or multi-mode.1
o Single mode uses a single mode light source and has a smaller central core, which results in less
light reflection along the cable. This allows the data to travel faster and further, making them a
good choice for CATV (community antenna television (CATV), these cable systems use a
“community antenna” to receive broadcast signals (often from communications satellites))
and telecommunications.

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

Differences between fiber optic and copper cable

• Fiber optic data is transmitted using light, copper cable through electrical signals

• Fiber optic has higher bandwidth than copper cable

• Fiber optic has higher transmission rates than copper cable

• 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

• Fiber optic is more prone to damage 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

Wireless Network Adapter


• Hardware component that allows a device to connect to a wireless network
• Provide interface to wireless network
• … as an antenna
• Receives analogue radio waves
• … convert them to digital / binary
• Checks incoming transmissions for correct MAC / IP address
• … ignore transmissions not intended for it
• Encrypts / encodes the data • Decrypts / decodes the data
• Takes digital/binary input and converts to analogue waves
• … sends the radio waves via the antenna

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.

Network interface card (NIC)


• needed to allow a device to connect to a network (such as the internet).
• usually part of the device hardware and frequently contains the MAC address generated at the
manufacturing stage

Wireless Access Point (WAP)


Hardware component that provides radio communication from the central device to nodes on the
network (and vice versa)

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

How is it possible to watch a video on web without it continually pausing


• Fast data transfer speed and fast broadband connection required
• Data is streamed to a buffer o The sequence of bits streamed are stored in buffer, and then
broadcasted to user. The rate of data transfer to from web to buffer should be greater than rate of
data transfer while broadcasting the video to user for it to not stop continuously
• As buffer is emptied it’s filled up again so that viewing is continuous
• Actual playback of the video is a few seconds behind

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.

Real Time Streaming


• An event is being captured with a video camera and microphone
• The video camera and microphone are connected to a computer
• Video signals encoded to streaming media files
• Encoded feed is then uploaded on a dedicated streaming server
• Cannot be paused/forwarded.

Differences between on-demand and real time bit streaming


• On demand: can be fast forwarded or paused.
• real time: streaming is live and cannot be fast forwarded or 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

World Wide Web (WWW) and the internet


Internet
• Massive network of networks/interconnected network of computer devices
• Internet stands for Interconnected Networks
• Uses TCP/IP protocol

World Wide Web


• Collection of multimedia web pages and documents
• .. stored on websites
• http protocol used to transmit data
• web pages are written in html
• URL’s specify location of the webpages
• web documents are accessed using browsers.

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

Hardware used to support the internet

Transmission of Data using PSTN


• uses a standard telephone connected to a telephone line
• The telephone line connection is always open whether or not anybody is talking –
• the link is not terminated until the receivers are replaced by both parties.
• Telephone lines remain active even during a power cut; they have their own power source
• The PSTN consists of many different types of communication lines
• Data is transmitted in both directions at the same time, simultaneously, i.e. full duplex data
transmission
• The communication passes through different switching centers.

Benefits Drawbacks

✓ Faster Connection ✓ Expensive to set-up and maintain


✓ More consistent transmission speed ✓ Disruption to the dedicated line would
✓ Improved Security leave no alternative
✓ Outdated technology

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.

Cellular networks and satellites


Other devices, such as mobile phones, use the cellular network. Here, the mobile phone providers act as
the ISPs and the phones contain communication software which allows them to access the telephone
network and also permits them to make an internet connection. Satellites are an important part of all
network communications that cover vast distances. Due to the curvature of the Earth, the height of the
satellite’s orbit determines how much coverage it can give. Figure 2.22 shows how satellites are classified
according to how high they orbit in relation to the Earth’s surface.

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

IPv6 has benefits over IPv4


• has no need for NATs (network address translation)
• removes risk of private IP address collisions
• has built in authentication
• allows for more efficient routing.

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

With the section 0000:0000 replaced by ::

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

What happens when a web page is requested by a user?


• User keys in the uniform resource locator (URL) into the browser software
• The Domain Name service uses the domain name from the browser to look up the IP address of the
webserver
• The web server sends the web page content to the browser
• Browser software renders the page and displays (If JavaScript is included then the client computer or
the browser processes the JavaScript code and then the requested web page is displayed to user)
How is URL converted to its matching IP address?
• Uniform Resource Locator (URL) us parsed to obtain the domain name
• Domain name is sent to the nearest domain name server (dns)
• Dns holds a list of domain names and matching ip addresses
• Dns name resolved searched its database for the domain name
• If dns does not find the domain name, the request is forwarded to a higher level dnss
• If the domain name is found, the ip address is returned
• If the domain name is not found the request is passed to a higher-level server
• If the domain name is finally not found, an error message is generated

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

Public and Private IP address


• Public is assigned by an ISP
• Public IP addresses can be accessed by anyone using the Internet
• Public is used to get internet service
• Public IP addresses must be unique throughout the Internet

• Private is assigned by a router


• Private IP addresses cannot be accessed by anyone using the Internet
• Private is used to communicate within a network
• Private can be duplicated in different networks // private addresses are unique only within the (local)
network
Purpose of an IP address
• Gives each device on network an identifier, can be used to locate a device on a network Each address
is unique within the network
• Allows a device/gateway/node to send data to correct destination e.g. another device, gateway

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 and Dynamic IP address

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

3.1 Computers and their components

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

Magnetic hard disk


• Hard disk is made up of one or more platters
• These platters/disks rotate at high speed
• On each platter a read/write head moves across the platter
• Electronic circuit controls the movement of the read/write head
• Surface of platter is divided into concentric sector and tracks
• One track in a sector is the basic unit for storage called a block
• Data is stored on these sectors and tracks
• Data is encoded as magnetic pattern
• When writing, variation in current of the writing head produces a variation in the magnetic field on the
disk
• When reading, variation in magnetic field produces a variation in through the head

Solid state (flash) memory


• Most are NAND based technology.
• There are no moving parts
• Uses a grid of column and rows which has two transistors and each intersection
• One transistor is floating gate
• Other one is controlling gate
• Memory cells store voltages which can be represented as 0 or 1
• Essentially the movement of electrons is controlled to read/write
• Not possible to overwrite data, data must be first erased and then new data can be written in the
same location

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.

PROM, EPROM & EEPROM


• PROM can be set once
• EPROM and EEPROM can be overwritten multiple times.
• EPROM needs to be removed from device EEPROM can be erased in situ.
• EPROM and can be erased using UV light, EEPROM can be erased using voltage // is flash storage
• EPROM must be entirely erased before rewriting, EEPROM does not have to be entirely erased before
rewriting.

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 stores each bit as a charge SRAM uses flipflops

DRAM consumes more power SRAM consumed less power

DRAM is cheaper SRAM is more expensive

DRAM has more storage capacity SRAM has lower storage

DRAM has slower data access time SRAM has faster data access time

DRAM is used in main memory SRAM is used for cache memory

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

Importance of feedback in a control system


• to ensure the system operates with the given criteria
• ... by enabling system output to affect subsequent system input
• ... thus allowing conditions to be automatically adjusted

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

4.1 Central Processing Unit (CPU) Architecture

AS COMPUTER SCIENCE P1 48 | P A G E
Von Neumann Architecture

Stored Program Concept


• Programs and instructions are stored in the memory
• Programs consists of sequence of instructions • Each are fetched and then executed in a sequence.
• Instruction fetch and execute cannot occur at the same time

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.

Immediate access store (IAS)


The IAS holds all the data and programs that the processor (CPU) needs to access. The CPU takes data and
programs held in the backing store and puts them into the IAS temporarily. This is done because read/write
operations carried out using the IAS are considerably faster than read/write operations to backing store.
Consequently, any key data needed by an application will be stored temporarily in IAS to speed up
operations. The IAS is another name for primary (RAM) memory.

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

Factors affecting performance of CPU/Computer System


Number of cores
• Each core processes one instruction at a time
• Multiple cores mean the sequence of instructions can be split between them
• Multiple instructions executed at one clock pulse
• More cores decrease the time taken to complete task, fast performance of computer system

Width of Data Bus


• Width of the data bus determines the number of bits that can be transferred
simultaneously
• The greater the width of the data bus, the more bits transferred at the same time, the better
performance of computer system.
• Improves performance as less data transfers required, more data is transferred in one clock pulse

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:

• They use a widescreen format (16:9 aspect ratio).


• The screens use a greater number of pixels (typically 1920 × 1080).
• The screens have a faster refresh rate (such as 120Hz or 120 frames a second).
• The range of colors is extremely large (some companies claim up to four million different color
variations).

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

✓ simpler technology ✓ old outdated analogue technology


✓ only one standard available ✓ it is easy to bend the pins when making
✓ it is easy to split the signal and connect a connections
number of devices from one source ✓ the cables must be of a very high grade to
✓ the connection is very secure ensure good, undistorted signal

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,

Possible causes of interrupts


• I/O Request // Printer asking for more data
• Hardware Fault // Out of toner, no paper, paper jam
• Software Fault
• Multitasking
• Pressing a key on the keyboard

How interrupt is handled during fetch and execute cycle


• At the end of each fetch and execute cycle interrupt is checked
• if the interrupt is found; interrupt flag is set
• Interruption is prioritized.
• If the priority is high enough
• the content of the registers are saved
• Processor calls interrupt service routine
• the program counter is then loaded with the address of the interrupt service routine.
• When the interrupt is serviced, contents of the register are restored
• the processor continues with the next F-E cycle.

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.

There are two types of assembler:


single pass assemblers & two pass assemblers.

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.

Practice past paper w17 p11, 12, 13

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:

Different types of assembly language instructions.


Data movement instructions
These instructions allow data stored at one location to be copied into the accumulator
LDM LDD LDI LDX LDR MOV

Input and output of data


These instructions allow data to be read from the keyboard or output to the screen
IN OUT

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

Unconditional and conditional instructions


These instructions jump to another address if condition is true/false
JMP, JNE

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

AND: Checking, Testing, Resetting all to zero


OR: Setting
XOR: Inversing

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

5.1 Operating System

Why does a pc need an operating system?


• The hardware is unusable without an OS
• Acts as an interface for the user to communicate with the hardware
• Provides an environment for the user to run other programs

Key Management tasks conducted by operating system

Process / Task Management


• Manages the scheduling of processes
• Allows multi-tasking
• Ensures fair access
• Handles priorities
• Manages the resources the processes need
• Enables processes to share information
• Prevents interference between processes

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

Peripheral / Hardware / Device / Input/Output Management


• Installation of device driver software
• Control of hardware usage by processes
• Device detection
• Power Management
• Keep track of device status
• Managing interrupts
• Sending control signals
• Control of buffers
• Management of queues

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

Provision of user interface


• Allows a user to communicate with the hardware
• By making navigation around the system easier
• Provides facility for user inputting the data
• Provides facility for user outputting to the user
• e.g. Command line / GUI / menu-driven

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

Disk repair software


Examine the disk to find any bad sectors and marks bad sectors as unusable
Checks for any errors
Resolves any error on disk
Retrieves files from a damaged disk
reduces access times by optimizing storage

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

DLL Files (dynamic link library files)


• A shared library file
• Code is saved separately from the main .EXE files
• Code is only loaded into main memory when required at run time
• The DDL file can be made available to several applications at the same time

Why should we use DLL files while developing


• DLL file is only loaded into memory when required
• So the executable file for the game is smaller because the executable does not contain all the library
routines
• maintenance not needed to be done by the programmer because the DLL is separate from program
• Changes in the DLL file are independent of the main program
• no need to recompile the main program when changes are made to DLL because changes /
improvements/ error correction to the DLL file code are done independently of the main program The
program will get the benefit of the updates automatically
• The same DLL file can be used in several programs at the same time
• DLL routines are pre written saving the developer’s time
• DLL routines are pre tested so should be reliable
• Developers can take advantage of other programmers expertise

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

Why would one use a compiler?


• To make an executable file
• So it can be distributed without the source code
• To test the program without re-compiling3
• Faster to run the 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

How JavaScript code in interpreted by an interpreter?


• The code is translated one line at a time
• And executed immediately
• Interpreter stops as soon as it finds any error

Why would one use an interpreter?


• To run/test incomplete program, good for development
• To locate individual errors in the program since interpreter stops where error is occurred
• Programmer can correct errors in real time good for debugging
• To make changes and notice effects in real time

Identify debugging tools that a typical IDE can provide


• Breakpoints - Stops the code executing at a set line
• Single stepping - Executes one line of the program and then stops
• Report windows - Outputs the contents of variables and data structures
• Dynamic syntax check - Underlines or highlights statements that do not meet the rules of the language

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

State drawbacks of using a compiler compared to an interpreter during program development.


• larger amounts of source code take time to compile
• slower to produce the object code than an interpreter
• code cannot be changed without recompilation
• the program will not run if there are any errors
• errors cannot be corrected in real-time
• one error may result in other false errors being reported
• cannot easily test specific sections of the source code // cannot easily test unfinished source code

AS COMPUTER SCIENCE P1 70 | P A G E
Chapter 6 Security, Privacy and Data Integrity

6.1 Data Security

Data Security Data Integrity Data privacy

• Security is keeping data • Integrity is making sure


safe data is correct
• Security is preventing data • Integrity is making sure Privacy is keeping data
loss data received is same as confidential, only accessible
• e.g. usernames, data sent to authorized personnel
passwords, encryption, • e.g. parity checks, double
firewall entry

Why is it important to keep database secure?


e.g. why school database must be protected?
• Stop unauthorized data access, so that student’s personal data is not accessible to unauthorized people
• Prevent loss of data, avoid student data getting deleted, e.g. student marks
• Prevent unauthorized changes to data, preventing students changing their grades

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

• Use of proxy server


• Auditing
o Logging all changed to system
o To identify anything suspicious, unauthorized use
• Application Security
o Applying regular updates
o Finding and fixing any security vulnerabilities in any application
• Encryption
o Contents are scrambled so they cannot be understood without a decryption key
o Cannot be understood by unauthorized personnel
• Physical Measures
o Locked doors, keyboards
o Secure methods of access

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

Threats to computer and data security


Malware
Malware is one of the biggest risks to the integrity and security of data on a computer system. Many
software applications sold as antivirus are capable of identifying and removing most of the forms of
malware described below.
Viruses
Programs or program code that can replicate and/or copy themselves with the intention of deleting
or corrupting files or causing the computer to malfunction.
Spyware
software that gathers information by monitoring, for example, key presses on the user’s keyboard.
The information is then sent back to the person who sent the software – sometimes referred to as
key logging software

Similarities between virus and spyware


• Both are pieces of malicious software
• Both are downloaded / installed/run without the user's knowledge
• Both can pretend to be / are embedded in other legitimate software when
• downloaded // both try to avoid the firewall
• Both run in the background

Difference between virus and spyware


• Virus can damage computer data; spyware only records / accesses data
• Virus does not send data out of the computer; spyware sends recorded data to third party
• Virus replicates itself; spyware does not replicate itself

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

Protection against phishing


• Users need to be aware of new phishing scams. Those people in industry or commerce should
undergo frequent security awareness training to become aware of how to identify phishing (and
pharming) scams.
• Do not click on links unless certain that it is safe to do so; fake emails can often be identified by
greetings such as ‘Dear Customer’ or ‘Dear emailperson@gmail.com’, and so on.
• It is important to run anti-phishing toolbars on web browsers (this includes tablets and mobile
phones) since these will alert the user to malicious websites contained in an email.
• Look out for https and/or the green padlock symbol in the address bar (both suggest that traffic to
and from the website is encrypted).
• Regularly check online accounts and frequently change passwords.
o Ensure an up-to-date browser, with all of the latest security upgrades, is running, and run a
good firewall in the background at all times. A combination of a desktop firewall (usually
software) and a network firewall (usually hardware) considerably reduces risk.

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.

Protection against pharming


• using antivirus software, which can detect unauthorized alterations to a website address and warn
the user
• using modern web browsers that alert users to pharming and phishing attacks
• checking the spelling of websites
• checking for https and/or the green padlock symbol in the address bar. It is more difficult to mitigate
risk if the DNS server itself has been infected (rather than the user’s computer)

Hacking – illegal access to a computer system without the owner’s permission.


Protection – Firewall

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

Automatic repeat request (ARQ)


Automatic repeat request (ARQ) is another method to check data following data transmission.
This method can be summarized as follows:
• ARQ uses acknowledgement (a message sent to the receiver indicating that data has been received
correctly) and timeout (the time interval allowed to elapse before an acknowledgement is received).
• When the receiving device detects an error following data transmission, it asks for the data packet to
be re-sent. » If no error is detected, a positive acknowledgement is sent to the sender.
• The sending device will re-send the data package if – it receives a request to re-send the data, or – a
timeout has occurred.
• The whole process is continuous until the data packet received is correct or until the ARQ time limit
(timeout) is reached.
• ARQ is often used by mobile phone networks to guarantee data integrity.

AS COMPUTER SCIENCE P1 78 | P A G E
Chapter 7 Ethics and Ownership

7.1 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.

Why it is important to act ethically in relation to team members?


• To make sure the team members feel valued
• To get the best work out of the team
• To enable them to work well together
• To enable them to create the best product for the client

AS COMPUTER SCIENCE P1 79 | P A G E
Case Scenario Questions
Sophie is about to join a job as a junior developer,

Ethical actions by which she’ll feel confident in firm?


• Read about the languages she will be using
• Visits the office prior to starting
• Speaks to her manager about concerns

Ethical actions by which her manager can make sophie confident?


• Invite sophie in before starting
• Introduce her to team
• Give sophie a mentor

Ethical action her collegues can do to make her confident?


• Prepare a greeting
• Provide structured report
• Invite her to social events

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

Francis has been advised to join a professional ethical body.


Describe the benefits to Francis of joining a professional ethical body
• He has ethical guidelines to follow
o … so clients/other staff know the standards being applied
o … so he does not have to decide what is ethical it's written down
• Clients / staff know he is reputable
o … recognition of his skills / knowledge
o … there may be a test / requirements for entry
• They provide help and support
o … for example if he needs legal advice
• They run training courses
o … to keep his skills up-to-date

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.

Types of software licensing

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

Benefits of choosing commercial software for seller


• Can make money
• Can claim code’s ownership
• Retains copyright
• Cannot be re distributed without seller’s permission
• Prohibits any changes in the code
• Prevents unauthorized access, and prevents illegal copies being sold

Benefits of choosing commercial software for customers


• Support is readily available
• More robust software, since it’s properly maintained,
• Forums also exist for commercial software
• The manufacturer develops patches that can be automatically updated

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.

Social, Economic Impact of AI


As a result of increasing automation over the next few decades, the human race will need to consider the
impacts that AI will have on society, the economy and the environment. So should we all be worried? In
this section, we will consider a number of existing AI technologies, plus some predictions for the future,
to help stimulate discussions. AI is not just about robots, but covers many areas (this is explored further
in Chapter 18, which explores specific AI technologies in more depth). We will look at some of the areas
in more depth and consider the implications of using AI (the descriptions that follow will mix up benefits
and drawbacks

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

8.1 Database Concepts

Limitations with file-based approach as compared to a relational database


• Data redundancy – data is repeated, in different files
• No data integrity – might be changed by one program but not other, reduces consistency
• Data less secure
• Complex queries cannot be performed
• Data not independent of the program

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

• Referential integrity can be enforced

• More complex searches and queries can be executed.

• Privacy is improved

• Linked tables can be set up

• Multiple tables are linked together


o It helps to reduce data redundancy, as data is not repeated, it’s only stored once
o It improves data integriity
o Data only stored once, so if it’s changed by one application it’s changed for the other
applications accessing it as well

• Improved security using access rights

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

Database has a secondary key describe reason for this?


• Database would frequently want to search using secondary key, e.g. contact number
• Allows for faster search using contact number.

E-R Diagrams
A graphical representation of a database and the relationships between the entities. Relationships may
be mandatory or optional. For example, in a workroom with desks, each employee has one desk, but
there could be spare desks. The relationship between desk and employee is zero or one, so this
relationship is optional. The relationship between mother and child is mandatory because every mother
must have at least one child, so the relationship is one or many. The type of relationship and whether it
is mandatory or optional gives the cardinality of the relationship. ( To properly understand E-R
Diagrams, do a handful of past papers for E-R Diagrams)

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.

Why database is fully normalised?


• No repeating attributes 1nf
• No partial dependency 2nf
• No non-key or transitive dependency 3nf

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.

Items in a data dictionary


• Validation
• Tables
• Data types
• Primary keys
• Attribute names
Data Modelling
• Data modelling is an important tool used to show the data structure of a database. A
• n E-R diagram is an example of a data model.
• A logical schema is a data model for a specific database that is independent of the DBMS used to build
the 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

Data Definition Language (DDL):

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) );

Adding a new field:


ALTER TABLE SAMPLE_DATA ADD Salary Integer;

Data Manipulation Language(DML):

Adding the data into the table

When inserting into all columns in logical order (left to right)


INSERT INTO SAMPLE_DATA
VALUES (<data in coulumn 1>, (<data in coulumn 1>,….);
VALUES (5, ‘Double’, #01/01/2023#);

When inserting into only some columns


INSERT INTO SAMPLE_DATA (Stock, Type) VALUES (5,
‘Double’);

Updating data in the table:


UPDATE SAMPLE_DATA
SET <column 1> = <value 1>, <column 2> = <value 2>
SET Stock = 5, Type = ‘Double’ WHERE ID = ‘6A’;

DELETE statement is used to delete existing records in a table:


DELETE FROM SAMPLE_DATA WHERE ID = ‘6A’;

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;

Count, Average and Sum statements

Write the SQL statement to find the number of products


SELECT COUNT (ProductID) FROM PRODUCTS;

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.

SELECT <column name> FROM <table 1> INNER JOIN


<table 2> ON table1.column name = table2.column
name; WHERE ID = ‘6A’

Or simpler method:

SELECT <column name> FROM <table1>, <table2>


WHERE table1.column name = table2.column name
AND ID = ‘6A’

AS COMPUTER SCIENCE P1 95 | P A G E
Comparing to current date

Any date greater than today’s date condition:


WHERE XDate > #######;

Selection of specific data

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy