CAIE-A2 Level-Computer Science - Theory
CAIE-A2 Level-Computer Science - Theory
ORG
CAIE A2 LEVEL
COMPUTER SCIENCE
SUMMARIZED NOTES ON THE THEORY SYLLABUS
Prepared for 无邪 for personal use only.
CAIE A2 LEVEL COMPUTER SCIENCE
Application Layer: Converts the electrical data into analog signals and sends
it, allowing the upper layers access to the physical
The application layer provides user services. medium.
Encodes data in an appropriate format when sending a Formats data into frames for transmission and maps IP
message addresses to MAC (hardware) addresses.
Performs the action requested by the user when Ensures correct network protocols are followed.
receiving a message Verifies the checksum when receiving a message and
then sends it to the internet layer
There are the main types of protocols:
Peer-to-peer File Sharing
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
BitTorrent uses Peer-To-Peer file sharing model. Method of transmission where the message is broken
A BitTorrent client software is made available to the down into packets which can be sent along independent
public. paths
Swarm: All connected peer computers that have all or Data is split into multiple packets and each packet a
parts of file being downloaded/uploaded. route is calculated for each packet.
Tracker: A central server that stores information on Each packet contain a header, which has a source IP
which computers have which files and which parts of address and destination IP address, and a payload.
those files. It also shares the IP addresses of computers Calculates the most efficient path for each packet.
to allow them to connect to each other. Used when sending large files that don’t need to be live
Seed: is the peer computer that uploads the file that is streamed or when it is necessary to be able to overcome
being downloaded. faulty lines by rerouting like emails, text messages,
sending documents, etc.
If a user wishes to join this network, they need to use a Harder to intercept as new route is used each time.
BitTorrent client to load the torrent descriptor file. When a Packets need to be reassembled.
user wishes to download a file, pieces of this file are If there’s a missing packet, a request is sent to retransmit
downloaded and uploaded at the same time. When a user the data.
has even a single piece of a file they become a seed. To be
able to download this file, a complete copy needs to exist on Role of Router:
one of the peer computers.
Examines the header and finds the destination IP
address.
1.2. Circuit Switching, Packet Switching Decides the best route for the packet, with the help of
the information from the routing table, and sends it
Circuit Switching towards the next hop.
Circuit Switching: Method of transmission in which a Comparison
dedicated circuit lasts throughout the duration of the
communication. Circuit Switching Packet Switching
Dedicated circuit is selected before the communication Nature
Setup
Dedicated channel
Requires pre-established channel
Data segmented into packets
No prior setup needed
starts and is used to send all the data through this route. Data handling Message remains intact Message gets split into packets
- Uses the whole bandwidth. Transmission
Order
Single Path
In order
Path recalculated each time
May need reassembly
Releases circuit once the communication ends. Layer (Data) Link Layer Network Layer
Used for live video broadcasts or calling Bandwidth Makes full use of bandwidth Bandwidth can be shared
Error handling Communication ends incase of an error Allows packets to be resent
Data arrives in order so it doesn’t need to be Complexity Simple More complex
reassembled.
Whole bandwidth is available.
Data can’t get lost. 2. Hardware and Virtual
Less secure as it only uses one route.
No alternative route in case of failure. Machines
Bandwidth can’t be shared.
Packet Switching
2.1. RISC & CISC Processors
RISC: Reduced Instruction Set Computers.
CISC: Complex Instruction Set Computers.
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
RISC CISC
Fewer instructions More instructions
Simpler instructions Complicated instructions Pipelining for Five-Stage Instruction Handling
A small number of instruction formats Many instruction formats
Single-cycle instructions whenever possible Multi-cycle instructions
Fixed-length instructions Variable-length instructions
Only load and store instructions to address Many types of instructions to address
memory memory
Fewer addressing modes More addressing modes
Multiple register sets Fewer registers
Hard-wired control unit Microprogrammed control unit
Pipelining easier Pipelining much difficult
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
OR Gate: A + B = X
2.3. Virtual Machines
Virtual machine:
Process interacts with the software interface
provided by the OS. This provides an exact copy of
the hardware.
OS kernel handles interaction with actual host
hardware
Pros Cons
Allows more than one OS to run on a system Performance drop from native OS
The time and effort needed for implementation
Allows multiple copies of the same OS is high
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
A B Output
NOT Gate: A = X 0
0
0
1
1
0
1 0 0
1 1 0
A Output
0 1
1 0
A B Output
0 0 0
0 1 1
1 0 1
1 1 0
Half-Adder
A B Output
0 0 1
0 1 1
1 0 1
1 1 0
NOR Gate: A + B = X
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
A half adder adds two binary digits and outputs the sum Can be made with NAND gates or NOR gates
(s) and their carry (c). Error state exists
A XOR gate acts like a half adder.
Input Output
A B S C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Full-Adder
A full adder adds three binary digits and outputs the sum
and their carry.
S R Q Q Bar
0 0 1 1
0 1 1 0
1 0 0 1
1 1 No Change No Change
S R Q Q Bar
0 0 No Change No Change
0 1 0 1
1 0 1 0
1 1 0 0
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
JK flip flops are only active when the clock is high. Double Complement: A = A
JK flip flops use a clock pulse for synchronization to Identity Law
ensure proper functioning. 1.A = A
Advantages of JK flip flops include the validity of all input 0+A = A
combinations, avoidance of unstable states, and Null Law
increased stability compared to SR flip flops.
0.A = 0
1+A = 1
Idempotent Law
A.A = A
A+A=A
Inverse Law
A.A = 0
A+A = 1
Commutative Law
A.B = B.A
A+B = B+A
Associative
(A.B).C = A.(B.C)
Clock J K Q Q Bar
0 0 0 - - (A + B) + C = A + (B + C)
0 0 1 - - Distributive Law
0 1 0 - -
0 1 0 - - A + B.C = (A + B).(A + C)
1 0 0 No Change No Change
1 0 1 0 1
A. (B + C ) = A.B + A.C
1 1 0 1 0 Adsorption
1 1 0 Toggle Toggle
A. (A + B ) = A
A + A.B = A
2.6. Boolean Algebra De Morgan’s Law
(A.B ) = A + B
(A + B) = A.B
{example}
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
Karnaugh maps: a method of obtaining a simplified 3. Circle the largest group containing an even number
Boolean algebra expression from a truth table. They of 1s.
minimize the number of logic circuits, thus making it
more efficient.
Sum of products: all the combinations that lead to 1 in
the output.
Methodology
Try to look for trends in the output, thus predicting the
presence of a term in the final expression
Draw out a Karnaugh Map by filling in the truth table
values into the table 4. Take the common values from both
Select groups of ‘1’ bits in even quantities (2, 4, 6, etc.); if In the first group, A ⋅ B is common
not possible, then consider a single input as a group In the second group, A ⋅ C is common
Note: Karnaugh Maps wrap around columns 5. Write the simplified expression.
Within each group, only the values that remain constant A⋅C +A⋅B
are retained
User Interface
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
Process States
Ready: The process is not currently being executed. It is
in the queue waiting for the processor’s attention.
Running: The process is being executed and currently
has the processor’s attention.
Blocked: The process is waiting for an event before it
can continue running like a user input.
Terminated: The process has finished execution and has
been removed from the queue.
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
A parse tree is generated for reverse polish notation and
1. The RAM is divided into frames. syntax errors are reported.
2. Virtual memory is divided into same-sized blocks
called pages with fixed sizes. Code generation
3. Page table created to translate logical address to
physical addresses and track all the free frames. Object code is generated.
4. Pages are swapped between them as necessary.
5. When there is no empty space in the memory, a page Code Optimization
gets replaced with the new one. The replacement
algorithm is either first in first out, least used page Code is optimized to improve time for execution.
and recently least used page.
Page
3.5. Backus-Naur Form (BNF) Notation
Virtual memory is divided into equal blocks called pages.
A form of expressing the grammar of a language visually.
Page Frame
Example
Main memory is divided into parts equal in size to a page.
Page Table
Contains the mappings of pages to page frames.
Segmentation
A large process is divided to segments, the segments need
not be the same size.
Disk Thrashing
When pages are needed in the RAM as soon as they are
moved to the disk leading to a continuous swapping of the <variable> ::= <letter> <usigned integer>;
same pages because the pages being swapped in and out
<usigned integer> ::= <digit> | <digit> <digit>;
are inter-dependent.
<letter> ::= X | Y | Z;
3.4. Translation Software
<digit> ::= 1 | 2 | 3;
Interpreter
<operator> ::= + | - | *;
An interpreter reads line by line and checks statements
for errors, if no errors are found it is executed otherwise <assignment statement> ::== <variable> = <variable> <oper
a report is made and the interpreter stops execution. It is
easier for debugging.
A compiler does not run the code line by line but rather Notations
at the end of translation. < > : used to enclose an item
:: == : separates an item from its definition
Lexical Analysis | : between items, indicates a choice
; : the end of each rule.
Characters are converted from strings into tokens.
Comments are removed.
Symbol table stores identifiers and keywords.
3.6. Reverse Polish Notation (RPN)
Keyword table stores the reserved words used and the
matching operators.
Syntax Analysis
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
Reverse Polish notation (RPN): An unambiguous method A private key is never shared. It is used to decrypt data that
for representing an expression left to right without needing was encrypted with its matching public key.
rules of precedence or brackets.
Symmetric Encryption
Advantages
A single key is used for both encryption and decryption. The
No brackets or precedence of operators needed key is shared between the sender and the receiver.
Simpler to evaluate Disadvantages:
No need for backtracking in evaluation as the operators
appear in the order required for computation and can be Key has to be exchanged securely.
evaluated from left to right Once compromised, it can decrypt sent and received
messages.
Uses with a Stack Cannot ensure origin or integrity of data.
Disadvantages:
Public Key
A public key is shared. It is used to encrypt data so that it can
be decrypted with its matching private key.
Private Key
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
When received the message and the digital signature are
Only works for short distances. decrypted with the receiver’s private key. The digital
High cost for maintenance and setup. signature is then decrypted with the sender’s public key. The
Lacks important features like digital signature, certified decrypted message is put through the same hashing
mail etc. function to output a digest. The two digests are compared
High error rate due to being new. and if they are the same then the message was not
Polarization of light may be altered during transmission. tampered with.
Use Cases
Transmitting passwords or session cookies.
Online shopping and banking websites.
Use of Graphs
4.3. Digital Certification
Graphs provide relationships between different nodes.
Digital Certificate Allows AI problem to be defined as the most efficient
route between two nodes
1. An organization sends a request to Certificate Analyzed by machine learning algorithms such as A* to
Authority (CA). perform calculations
2. They send their public key, information to prove their Graphs can also be used to represent neural networks.
identity as well as any additional information
required by the CA.
3. The CA then verifies their identity and then issues the
5.2. A* & Dijkstra’s Algorithm
certificate after encrypting it with their private key. These algorithms are used to find the shortest route
between two nodes based on the distance.
Digital Signature
How to Implement A Algorithm?
The message is put through a hashing algorithm to produce
the digest. This is then encrypted with the sender’s private Below is an example of the implementation of the A*
key. This is the digital signature. Algorithm:
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
Machine Learning
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
Machine learning is a field of artificial intelligence in which
computers learn from provided data and past experiences in
order to improve its performance in a given task without 6. Data Representation
explicitly being programmed to know how to do the task. For
example, rather than telling the computer that emails that 6.1. User-defined data types
advertise free products are most likely scams we feed it a lot
of data and it identifies that pattern on its own. A data type constructed by the programmer using
primitive data types.
Deep Learning User-defined data types are used to create new data
types that help to extend the flexibility of a programming
A subset of machine learning that simulates the decision
language as the programmer can create data types
making and data processing abilities of the human brain. based on the application’s requirements.
Benefits:
Importance of user-defined data types:
Good with extremely large sets of data Code organization- Helps structure and group related
Good with unstructured data data logically, making programs easier to read and
Can identify hidden patterns maintain.
Reusability- Once defined, the data type can be
Reinforcement Learning reused multiple times, reducing redundant code and
improving efficiency.
Reinforcement learning allows the computers to make Examples include:
decisions that maximize the reward, it is then graded based Record
on how well it performed. Over time the computer learns Set
the correct decisions it needs to make based on its past Class
experiences. Object
Unsupervised Learning
In unsupervised learning the computer is fed unlabeled test
data, and it identifies hidden patterns.
Regression
Regression is finding a mathematical function that best fits
out output data based on the previous results in order to
predict the future value.
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
Data types that can be defined without referencing another
Record: A composite data type that is a collection of type. Examples include:
related items which may or may not have different data
types Integers
Booleans
TYPE TBook // Example Strings
DECLARE Name : STRING Enumerated Data Type: A user defined non-composite
DECLARE Isbn : INTEGER data type that contains an ordered list of all possible
ENDTYPE values.
DECLARE Book1: TBook // Creating a variable TYPE <name> : (<value1>, <value2>, ...)
Book1.Name = "To Kill a Mockingbird" // Accessing prop TYPE Days: (Sunday, Monday, Tuesday, Wednesday, Thursd
TYPE Numbers: (1..10) // Inclusive
Set: A set stores a finite number of unique items in no DECLARE Today: Days // Declaration
particular order allowing the program to apply Days ← Sunday
mathematical operations defined in set theory. Days ← Days + 1 // Value is now Monday
TYPE <set-name> = SET OF <type> //Declaration Pointer Data Type: A user defined non-composite data
DEFINE <var-name> (value1,value2,value3,...) : <set-na type that is used to reference a memory location.
TYPE Numbers = SET OF INTEGERS TYPE <Name> = ^<Type>
DEFINE EvenNumbers (2,4,6,8,10) : Numbers
// Declaring a pointer type
Classes: In object-oriented programming (OOP), a class TYPE PIntPointer: ^INTEGER
is the base for creating objects. It has methods and // Declaring a pointer variable
properties. DECLARE MyPointer: PIntPointer
// Class definition
MyPointer^ ← 3 // Sets the value at the address to
CLASS Bird
MyPointer ← 3 // Pointer points to value at the addre
PRIVATE Name: STRING
MyPointer ← @<variable_name> // Makes pointer point t
PUBLIC PROCEDURE NEW(pName: STRING)
Name ← pName
ENDPROCEDURE 6.2. File organization and access
ENDCLASS
File organization
// Implementing inheritance
CLASS FlyingBird IMPLEMENTS Bird
// Class info...
ENDCLASS
// Creating an object
<name> ← NEW <class_name>(<parameter1>, <parameter2>,
MyPet ← NEW Bird("Kiwi")
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.
CAIE A2 LEVEL COMPUTER SCIENCE
Serial: In serial files, records are stored one after Serial: In serial access records are read in the order that
another in chronological order. Records are appended to they are stored in.
the next available spot. Benefits: It is read record by record until the record is found or the
No need to sort list. key field value is exceeded.
Data can be appended easily. This is used for serial and sequential file organization.
Sequential: In sequential files, records are stored one Direct/Random Access: In random access you can
after another in the order of the key field. Records are directly access the data needed.
inserted into the correct position. A new version of the This is used in both sequential and random file
file has to be created to update it. Benefits: organisation.
Allows for batch processing. In sequential, index of all the key fields is used, while
Allows the data to be stored and sorted in a specific hash algorithm is used in random file organization.
order.
Random: In random files, records are stored in no 6.3. Floating-point numbers,
particular order. Changes to file are done directly.
In random file organization a unique key field is representation and manipulation
passed through a hash algorithm which produces the
home location for the data, if that location is empty Floating point representation
the data is stored else it relies on an overflow
method. Mantissa: Represents the numbers. If we increase the
A collision can occur when two different records bits allocated to the mantissa, we increase accuracy.
produce the same hash, this means that the location Exponent: Represents the number of times the decimal
is already being used to store a different record. place needs to move. If we increase the bits allocated to
When saving a file, it searches the file linearly for an exponent, we increase the range.
empty spot and saves the file there or search the M × 2E
overflow area linearly for the next empty spot and M = Mantissa
save the record there. When finding a record, search E = Exponent
the overflow area linearly of the matching record or
start from current location and search linearly and Converting from Binary Digit to Positive Float
until matching record is found.
Benefits: Mantissa = 01101000Exponent = 0011
Fast as real time processing is used
1. Write the binary number with the decimal point
File access
0 ⋅ 1101
2. Multiply with 2 to the power of the exponent (Move
the decimal point the same number of places as the
exponent)
0 ⋅ 1101 x 23 \0110 ⋅ 1
3. Convert to decimal by multiplying
(4 × 1) + (2 × 1) + ( 12 × 1)
13 2 13 3 13
2
4
8
16
13 1 12 1 6 1 3 1 1 2
16 = 16 + 16 = 16 + 8 = 16 + 4 = 16 + 4 + 4 =
1 1 1
16 + 4 + 2
Mantissa: 01101000
Exponent: 0011
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by 无邪 at Chongqing Liangjiang Yucai Middle School on 13/05/25.