Caie A2 Level: Computer SCIENCE (9618)
Caie A2 Level: Computer SCIENCE (9618)
ORG
CAIE A2 LEVEL
COMPUTER
SCIENCE (9618)
SUMMARIZED NOTES ON THE SYLLABUS
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
TYPE
ENDTYPE
<main identifier>
ENDTYPE
<assignment value> ← <identifier>^
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
==Serial files:== contains records that have no defined different key, the next position in the file is used. this is
order. A text file may be a serial file where the file has why a search will involve direct access possibly
repeating lines which are defined by an end of line followed by a limited serial search. That's why it's
character(s). There's no end of record character. A record considered partly sequential and partly serial.
in a serial file must have a defined format to allow data to File access:
be input and output correctly. To access a specific record, The value in the key field is submitted to the hashing
it has to go through every record until found. algorithm which then provides the same value for the
File access:
Successively read record by record until the position in the file that was provided when the algorithm
data required is found thus very slow.
Uses: was used at the time of data input. It goes to that hashed
Batch processing position and through another short linear search because
Backing up data on magnetic tape of collisions in the hashed positions. Fastest access.
Banks record transactions involving customer To edit/delete data:
accounts every time there is a transaction Only create a new file if the current file is full. A deleted
==Sequential files:== has records that are ordered and is record can have a flag set so that in a subsequent reading
suited for long term storage of data and thus is process the record is skipped over. This allows it to be
considered an alternative to a database. A key field is overwritten.
required for a sequential file to be ordered for which the Uses:
values are unique and sequential. This way it can be easily Most suited for when a program needs a file in which
accessed. A sequential database file is more efficient than individual data items might be read, updated or deleted.
a text file due to data integrity, privacy and less data
redundancy. A change in one file would update any other Factors that determine the file
files affected. Primary keys from the DBMS(database
management system) need to be unique but not ordered organization to use:
unlike the key field from the sequential files which need to
be ordered and unique. A particular record is found by How often do transactions take place, how often does one
sequentially reading the value of the key field until the need to add data?
required value is found. How often does it need to be accessed, edited, or deleted?
File access:
Successively read the value In the key field until the 1.3. Real numbers and normalized
required key is found.
To edit/delete data:
floating-point representation
Create a new version of the file. Data is copied from the
Real number: A number that contains a fractional part.
old file to the new file until the record is reached which
Floating-point representation: The approximate
needs editing or deleting. For deleting, reading and
representation of
a real number using binary digits.
copying of the old file continue from the next record. If a
record has been edited, the new version is written to the Format: Number = ±Mantissa × BaseExponent
new file and the remaining records are copied to the new Mantissa: The non-zero part of the number.
file. Exponent: The power to which the base is raised to in
==Direct access/random access files:== access isn't order
to accurately represent the number.
defined by a sequential reading of the file(random). It's Base: The number of values the number systems allows a
well suited for larger files as it takes longer to access digit to
take. 2 in the case of floating-point representation.
sequentially. Data in direct access files are stored in an
The floating point representation stores a value for the
identifiable record which could be found by involving initial
mantissa and a value for the exponent.
direct access to a nearby record followed by a limited
A defined number of bits are used for what is called the
serial search. The choice of the position chosen must be
significant/mantissa, +-M. Remaining bits are for the
calculated using data in the record so the same
exponent, E. The radix, R is not stored in the representation
calculation can be carried out when subsequently there's
as it has an implied value of 2(representing 0 and 1's).
If a
a search for the data. One method is the hashing
real number was stored using 8 bits: four bits for the
algorithm which takes the key field as an input and
mantissa and four bits for the exponent with each using two
outputs a value for the position of the record relative to
complement representation. The exponent is stored as a
the start of the file. To access, the key is hashed to a
signed integer. The mantissa has to be stored as a fixed point
specific location. This algorithm also takes into account
real value.
The binary point can be in the beginning after the
the potential maximum length of the file which is the
first bit(immediately after the sign bit) or before the last bit.
number of records the file will store.
The former produces smaller spacing between the values
eg: If the key field is numeric, divide by a suitable large
that can be represented and is more preferred. It also has a
number and use the remainder to find a position. But
greater range than the fixed representation.
we won't have unique positions. If a hash position is
calculated that duplicates one already calculated by a
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
however, the split between the two parts will have been
determined by the floating point processor.
If there were a choice, it's convenient to note that
increasing the number of bits for the mantissa would give
better precision but would leave fewer bits for the
exponent thus reducing the range of possible values and
vice versa.
For maximum precision, it is necessary to
normalize a floating point number.
Optimum precision will only be made once full use is
made of the bits in the mantissa therefore using the
largest possible magnitude for the value represented by
the mantissa.
Also, the two most significant bits must be different. 0 1
for positives and 10 for negatives.
-they both equal 2 but the most precise is the second one
with the, higher bits in the mantissa.
\
0.125 * 2^4 = 2 0 001 0100
0.5 * 2^2 = 2 0 100 0010
-For negatives.
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
weather forecasting which uses the mathematical model of has a port number which identifies the application layer
the atmosphere. protocol at the sending and receiving end system
(however the TCP isn't concerned with the receiving end
system). If the packet is one of a sequence, a sequence
2. Communication and number is included to ensure eventual correct
reassembly of the user data. The TCP is connection
Internet technologies oriented, initially just one packet of a sequence is sent to
the network layer. Once the connection has been
2.1. Protocols established, TCP sends the other packets and receives
response packets containing acknowledgements. This
Protocols are essential for successful transmission of data allows missing packets to be identified and resent.
over a network. Each protocol defines a set of rules that must TCP/IP Suite: A common protocol used to send data over a
be agreed between sender and receiver. At the simplest network.
level, a protocol could define that a positive voltage Protocols are split into separate layers, which are
represents a bit with value 1. At the other extreme, a protocol arranged as
a stack.
could define the format of the first 40 bytes in a packet.
The They service each other thus maintaining the flow of
complexity of networking requires a very large number of the data.
protocols, a protocol suite is a collection of related protocols. Layer: A division of the TCP/IP suite.
TCP/IP is the dominant protocol suite for internet usage. Stack: A collection of elements/protocols/layers.
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
download rare chunks for preference. Each time a 6. Client sends an encrypted message to the server
rare chunk is downloaded it automatically becomes using the server’s public key.
less rare. 7. The server can use its private key to decrypt the
3. How do peers encourage other peers to provide message and get data needed for generating
content rather just using the protocol to download for symmetric key .
themselves? This answer requires dealing with the 8. Both server and client compute symmetric key (to be
free riders/leachers who only download. The solution used for encrypting messages) // session key
is for a peer to initially randomly try other peers but established.
then to continue to upload to those peers that provide 9. The client sends back a digitally signed
regular downloads. If a peer is not downloading or acknowledgement to start an encrypted session.
downloading slowly, it will eventually be 10. The server sends back a digitally signed
isolated/choked. acknowledgement to start an encrypted session.
Transport Layer Security (TLS) Star topology: A network topology in which each
workstation is
connected to a central node/connection
TLS(transport layer security) protocol: Purpose of TLS is to point through which the
network is established.
provide for secure communication over a network, maintain The central node (hub) re-directs and directs the
data integrity and add an additional layer of security. TLS packets
according to the data traffic and their
provides improved security over SSL(secure sockets layer). recipient.
TLS is composed of two layers: record protocol and Wireless networks: A computer network that uses
handshake protocol. TLS protects this information by using wireless data
connections between its network
encryption. It also allows for authentication of servers and components.
clients. A handshake process has to take place before any Bluetooth: A type of short-range wireless communication
exchange of data using the TLS protocol. The handshake that
uses
process establishes details about how the exchange of data Wi-Fi OR IEEE 802.11x.– A type of wireless communication
will occur. Digital certificates and keys are used. The that
allows the users to communicate within a particular
handshake process starts with:
area/ access
internet.
1. The client sending some communication data to the
Component Purpose in a LAN
server.
Allows different networks to
2. The client asking the server to identify itself. Switch
connect
3. The server sending its digital certificate including the
public key. Directs the incoming packets
Router
4. The client validates (the server’s) TLS Certificate. into
5. The client sends its digital certificate (to the server if
requested).
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
A B X
0 0 0 NOR Gate: A + B=X
0 1 0
A B Output
1 0 0
0 0 1
1 1 1
0 1 0
1 0 0
1 1 0
OR Gate: A + B=X
A B Output
0 0 0
XOR Gate: A.B + A.B = X
0 1 1
1 0 1 A B Output
1 1 1 0 0 0
0 1 1
1 0 1
1 1 0
NOT Gate: A = X
A Output
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
{S17-P31} Question: 3
Consider the following logic circuit, which contains a
redundant logic
gate.
clock cycle 6 the first instruction has left the pipeline, the last
stage of instruction 2 is being handled and instruction 6 has 3.4. Flip-flops
just entered.
Once under way, the pipeline is handling 5
stages of 5 individual instructions. At each clock cycle the SR flip-flop: SR(Set-Reset) flip-flop or “Latch”
complete processing of one instruction has finished. Without Used as a storage device for 1 bit in the RAM, since it’s
the pipelining the processing time would've been 5 times values
can be altered
longer. Issue: When the both the input signals are 1 (invalid
One disadvantage is interrupt handling. There will be 5 state)
the flip-flop sets the value of Q and Q’ to 0.
instructions in the pipeline when an interrupt occurs.
Input signals Initial state Final state
1. Erase the pipeline contents for the latest 4 instructions
to have entered. Then the normal interrupt handling S R Q Q’ Q Q’
routine can be applied to the remaining instruction. 0 0 1 0 1 0
2. Construct the individual units in the processor with 1 0 1 0 1 0
individual program counter registers. This allows 0 1 1 0 0 1
current data to be stored for all of the instructions in
0 0 0 1 0 1
the pipeline while the interrupt Is handled.
1 0 0 1 1 0
0 1 0 1 0 1
3.3. Karnaugh Maps
Karnaugh maps: a method of obtaining a Boolean algebra J K Clock Q
expression from a truth table involving the 0 0 ↑ Q unchanged
Benefits of using Karnaugh Maps: 1 0 ↑ 1
Minimises the number of Boolean expressions. 0 1 ↑ 0
Minimises the number of Logic Gates used, thus
1 1 ↑ Q toggles
providing a more
efficient circuit.
Methodology
Try to look for trends in the output, thus predict the Flip-flops are used to build:
Data storage elements
presence
of a term in the final expression
Draw out a Karnaugh Map by filling in the truth table Digital circuits
values
into the table
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
Plain text: data before encryption. At the sending end the sender has a key which is used to
Cipher text: the result of applying an encryption algorithm encrypt some plaintext and the ciphertext produced is
to
data. transmitted to the receiver. Now, the receiver needs to get
Encryption: the making of cipher text from plain text. the key needed for decryption.
Encryption can be used:
When transmitting data over a network. 1. If symmetric key encryption is used, there needs to be
As a routine procedure when storing data within a a secure method for the sender and receiver to be
computing system. provided with the secret key.
Public key: encryption key which is not secret. 2. Using asymmetric key encryption, the process starts
Private key: encryption key which is a secret. with the receiver. The receiver must be in possession
Symmetric key encryption: when there is just one key of two keys. One is a public key which is not secret.
which is used to encrypt and then to decrypt. The secret The other is a private key which is secret and known
key is shared by the sender and the receiver of a only to the receiver. The receiver can send the public
message. key to a sender, who uses the public key for encryption
Asymmetric encryption: when two different keys are used, and sends the ciphertext to the receiver. The receiver
one for encryption and a different one for decryption. Only is the only person who can decrypt the message
one of these is a secret. because the private and public keys are a matched
Sending a private message: pair. The public key can be provided to any number of
different people allowing the receiver to receive a
private message from any of them.
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
for this digest. This speeds up the process of confirming 5. The CA uses encryption with the CA's private key to
the sender's identity. add a digital signature to this document.
It is assumed that the message is transmitted as plaintext 6. The digital certificate is given to A.
together with the digital signature as a separate file. The 7. A posts the digital certificate on a website.
same public hash key function is used that was used by
the sender so the same digest is produced if the message ![PROCESSES INVOLVED IN OBTAINING A DIGITAL
has been transmitted without alteration. The decryption of CERTIFICATEThe individual places the digital certificate on
the digital signature produces an identical digest if the that person's website but you can post it on a website
message was genuinely sent by the original owner of the designed specifically for keeping digital certificate data.
public key that the receiver has used. This allows the Alternatively, a digital certificate might be used solely for
receiver to be confident that the message is both authenticating emails. Once a signed digital certificate has
authentic and unaltered. However someone might forge a been posted on a website, any other person wishing to use
public key and pretend to be someone else. Therefore, A's public key downloads the signed digital certificate from
there is a need for a more rigorous means of ensuring the website and uses the CA's public key to extract A's public
authentication. This can be provided by a Certification key from the digital certificate. For this overall process to
Authority (CA) provided as part of a Public Key work there is a need for standards to be defined.
Infrastructure (PKI).
5.3. Encryption protocols
SSL and TLS encryption protocols are used in client-server
applications.
SSL(Secure Socket Layer) and TLS(Transport Layer
Security) are two closely related protocols providing
security in using the Internet. TLS is a slightly modified
version of SSL. The main use of SSL is in the client server
application. The interface between an application and TCP
uses a port number. In the absence of a security protocol,
TCP services an application using the port number. The
combination of an IP address and a port number is the
socket. When the SSL protocol is implemented it functions
as an additional layer between TCP in the transport layer
and the application layer. When the SSL protocol is in
place, the application protocol HTTP becomes HTTPS.
Provides:
Encryption
Compression of data
Integrity checking
Connection process:
1. An individual(A) who is a would-be receiver and has a Used in online shopping and banking websites.
public-private key pair contacts a local CA.
2. The CA confirms the identity of A. 5.4. Malware
3. A's public key is given to the CA.
4. The CA creates a public-key certificate(a digital Virus: tries to replicate inside other executable programs.
certificate) and writes A's key into this document.
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
6. Artificial Intelligence
6.1. Intro
Artificial Intelligence is the ability for computers perform
tasks that usually only a human would be able to do, such
as decision making, speech recognition, etc.
Machine learning is a subset of artificial intelligence
where computers learn to perform tasks without explicitly
being programmed how to. E.g. Email Spam filters. With
machine learning computers are fed historical training Non
data and this data is used to produce a model from which Linear Regression
predictions about previous unseen data can be made. Used where there is a correlation but it is not linear
Deep learning is a subset of ML where computers learn to
solve problems using neural networks similar to how the
human brain functions. E.g. Image Classification.
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
6.3. Dijkstra’s Algorithm This is where you feed the machine learning algorithm
labelled training data. The labels contain the expected
Dijkstra's algorithm is an algorithm for finding the shortest outcome for that data. The machine used the labels and
paths between nodes in a graph, which may represent, for training data to train the model.
example, road networks. Labelled data is split into training and test data
\n
Limitations
A lack of heuristics
Dijkstra’s algorithm has no notion of the overall shortest
direction to the end goal, so it will actually spend a lot of
time searching in completely the wrong direction if the
routes in the wrong direction are shorter than the route in
the correct direction. It will find the shortest route in the
end but it will waste a lot of time.
In small networks this isn’t a problem but when you have
massive networks (like road networks or the internet) Training data used to train the model
then it will result in massive inefficiencies. \n
Negative Weighted Costs
On physical networks with physical distances you can’t
have negative weights, but one some networks where you
are calculating costs you might have negative costs for a
particular leg. Dijkstra’s cant handle these negative costs.
Directed networks
Dijkstra’s algorithm doesn’t always work best when there
are directed networks (such as motorways that only run in
one direction.
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
Trained model is ready to test \n The trained model can then be deployed \n
Un supervised Learning
7. Computational thinking
and problem-solving
7.1. Big O Notation
The tested model is then ready to deploy \n
What is Big O Notation?
Time Complexity
Time complexity refers to the growth in the number of
instructions executed (and therefore the time taken) as
the length of the array to be searched increases.
Space Complexity
Space complexity refers to the growth in the size of
memory space that is required as the length of the array
is increased.
Algorithm Performance
There are a number of factors that affect the
performance of search / sorting algorithms. Some
algorithms perform well with high entropy (randomness)
data, other algorithms work better when the data is
partially sorted in some manner. This means that no one
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
algorithm works best in every situation and the nature of list, and inserts it there. It repeats until no input elements
the data being sorted needs to considered. remain.
7.3. Recursion
Recursion is a function which it call itself
Solve a large problem by solving a sub-problems
Sub-problems are the same kind as the original problem
and they can be solved with the same algorithm Simpler
to solve: sub-problems are so simple that they can be
solved without further reductions (base case)
It needs at least one base case to stop recursive calls
otherwise the program will crash.
Insertion Sort
WWW.ZNOTES.ORG
CAIE A2 LEVEL
Computer Science (9618)