0% found this document useful (0 votes)
10 views17 pages

A2 Computer Science Notes 2023-2025

This document provides summarized notes on the CAIE A2 Level Computer Science syllabus, covering topics such as data representation, file organization, communication protocols, and processor types. It details user-defined data types, file access methods, and the TCP/IP protocol suite, along with comparisons between circuit and packet switching. The notes are intended for personal use by a student named Yung.

Uploaded by

Sanshray Sayz
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 views17 pages

A2 Computer Science Notes 2023-2025

This document provides summarized notes on the CAIE A2 Level Computer Science syllabus, covering topics such as data representation, file organization, communication protocols, and processor types. It details user-defined data types, file access methods, and the TCP/IP protocol suite, along with comparisons between circuit and packet switching. The notes are intended for personal use by a student named Yung.

Uploaded by

Sanshray Sayz
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

ZNOTES.

ORG

UPDATED TO 2023-2025 SYLLABUS

CAIE A2 LEVEL
COMPUTER SCIENCE
SUMMARIZED NOTES ON THE THEORY SYLLABUS
Prepared for Yung for personal use only.
CAIE A2 LEVEL COMPUTER SCIENCE

Record: A composite data type that is a collection of


1. Data Representation related items which may or may not have different data
types
1.1. User-defined data types TYPE TBook // Example
DECLARE Name : STRING
A data type constructed by the programmer. DECLARE Isbn : INTEGER
User-defined data types are used to create new data ENDTYPE
types that help to extend the flexibility of a programming
language as the programmer can create data types DECLARE Book1: TBook // Creating a variable
based on the application’s requirements. [Link] = "To Kill a Mockingbird" // Accessing
Examples include:
Record Set: A set stores a finite number of unique items in no
Set particular order allowing the program to apply
Class mathematical operations defined in set theory.
Object
TYPE <set-name> = SET OF <type> //Declaration
DEFINE <var-name> (value1,value2,value3,...) : <s
Composite User-Defined Data Types
Composite user-defined data types have a definition TYPE Numbers = SET OF INTEGERS
referencing at least one other type. DEFINE EvenNumbers (2,4,6,8,10) : Numbers

Classes: In object-oriented programming (OOP), a class


is the base for creating objects. It has methods and
properties.
// Class definition
CLASS Bird
PRIVATE Name: STRING
PUBLIC PROCEDURE NEW(pName: STRING)
Name ← pName
ENDPROCEDURE
ENDCLASS

// Implementing inheritance
CLASS FlyingBird IMPLEMENTS Bird
// Class info...
ENDCLASS

// Creating an object
<name> ← NEW <class_name>(<parameter1>, <paramete
MyPet ← NEW Bird("Kiwi")

Non-Composite Data Type


A data type that references only one data type. Examples
include:

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

Integers Serial: In serial files, records are stored one after


Booleans another in chronological order. Records are appended to
Strings the next available spot. Benefits:
Enumerated Data Type: A user defined non-composite No need to sort list.
data type that contains an ordered list of all possible Data can be appended easily.
values. Sequential: In sequential files, records are stored one
after another in the order of the key field. Records are
TYPE <name> : (<value1>, <value2>, ...) inserted into the correct position. A new version of the
TYPE Days: (Sunday, Monday, Tuesday, Wednesday, T file has to be created to update it. Benefits:
TYPE Numbers: (1..10) // Inclusive Allows for batch processing.
DECLARE Today: Days // Declaration Allows the data to be stored and sorted in a specific
Days ← Sunday order.
Days ← Days + 1 // Value is now Monday Random: In random files, records are stored in no
Pointer Data Type: A user defined non-composite data particular order. Changes to file are done directly.
type that is used to reference a memory location and In random file organization a unique key field is
indicates data type of value stored. passed through a hash algorithm which produces the
home location for the data, if that location is empty
TYPE <Name> = ^<Type> the data is stored else it relies on an overflow
method.
// Declaring a pointer type A collision can occur when two different records
TYPE PIntPointer: ^INTEGER produce the same hash, this means that the location
// Declaring a pointer variable is already being used to store a different record.
DECLARE MyPointer: PIntPointer When saving a file, it searches the file linearly for an
empty spot and saves the file there or search the
MyPointer^ ← 3 // Sets the value at the address t overflow area linearly for the next empty spot and
MyPointer ← 3 // Pointer points to value at the a save the record there. When finding a record, search
MyPointer ← @<variable_name> // Makes pointer poi the overflow area linearly of the matching record or
start from current location and search linearly and
1.2. File organization and access until matching record is found.
Benefits:
Fast as real time processing is used
File organization
File access
Serial: In serial access records are read in the order that
they are stored in. It is read record by record until the
record is found or the key field value is exceeded. This is
used for serial and sequential file organization.
Direct/Random Access: In random access you can
directly access the data needed.

Deciding which method to use


When there is no advanced processing and all files need
to be read, serial is generally used
When there is batch processing, sequential is generally
used
When we need one specific file, random is used

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE
0 ⋅ 0110000 0011 →
1.3. Floating-point numbers, 0 ⋅ 1100000 0010
Benefits:
representation and manipulation
Avoids two of the same number being represented
Floating point representation differently.
Maximizes the potential precision.
Mantissa: Represents the numbers. If we increase the Allows us to store the maximum range of numbers in the
bits allocated to the mantissa, we increase accuracy. minimum number of bits.
Exponent: Represents the number of times the decimal
place needs to move. If we increase the bits allocated to Important values
exponent, we increase the range.
Largest positive number 0111 1111 0111
Smallest positive number 0000 0001 1000
Converting from Binary Digit to Positive Float Smallest normalized positive number 0100 0000 1000
Largest magnitude negative number 1000 0000 0111
Mantissa = 01101000
Exponent = 0011 Errors
1. Write the binary number with the decimal point Rounding Error: When numbers can’t be represented be
represented exactly in binary, an approximate value is
0 ⋅ 1101 used which is either more or less than the needed value.
When these numbers are then used in operations, the
2. Multiply with 2 to the power of the exponent (Move
inaccuracies get added to the point where they are
the decimal point the same number of places as the
visible in the final answer. Like 0.1 + 0.2 =
exponent)
0.3000000000004
0 ⋅ 1101 x 23 Underflow: Underflow occurs when a number is too
0110 ⋅ 1 close to zero to be accurately represented in binary,
leading to a loss of precision.
3. Convert to decimal by multiplying Overflow: Overflow happens when a number's
magnitude exceeds the limit that can be represented in a
(4 × 1) + (2 × 1) + ( 12 × 1)

given number of bits.


Therefore the answer is 6.5

Converting from Float to Binary Digit 2. Communication and


3.5 Internet Technologies
1. Keep the values of 2n in mind
2.1. Protocols
3.5 = 21 + 20 + 2−1 = 3.5
0011 ⋅ 1000 0000 A protocol sets the rules of the communication. Protocols
allows for devices to communicate across different
2. Now we need to normalize it, for each place you platforms. If two devices attempted to communicate while
move the decimal point increment the value of the using different protocols, the communication would fail.
exponent TCP/IP is the dominant protocol suite for internet usage.
There are the main types of protocols:
0 ⋅ 1110000 0010

Converting from Binary Digit to Negative Float


By taking two’s compliment on a postive binary float,
converts it gets converted into the negative float.

Do not take two’s compliment of the exponent.

01110000 0010 → 10010000 0010


+3.5 became -3.5

Normalization
For a positive binary digit, the first two bits need to be
different. (Removing extra zeros before in between the
decimal and the first 1 digit).

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

HTTP and HTTPS (Hypertext Transfer Protocol): Used Handles the transmission of data using IP addresses.
to transfer webpages from server to client. HTTPS is Identifies the intended network and host and then
more secure. transmits the packets through the data link layer.
FTP (File Transfer Protocol): Used for sending and Routes each packet independently through the best
receiving files over the network between two devices. route available
POP3 (Post Office Protocol): Used for receiving emails. IP Addresses, of the sender and receiver, and checksum
IMAP (Internet Message Access Protocol): Also used are added when sending messages
for receiving emails. The email client retrieves the emails When receiving a message it reassembles the fragments,
from the mail server. strips the IP header and sends it to the transport layer
SMTP (Simple Mail Transfer Protocol): Used for
sending emails (Data) Link Layer:

Converts the electrical data into analog signals and sends


TCP/IP Suite it, allowing the upper layers access to the physical
A layered model (stack) with 4 layers; Application. medium.
transport, internet and data link. The Suite uses a set of Formats data into frames for transmission and maps IP
protocols for the transmission of data in these layers like addresses to MAC (hardware) addresses.
TCP (Transport Control Protocol) and IP (Internet Ensures correct network protocols are followed.
Protocol). Verifies the checksum when receiving a message and
TCP maintains connection between two nodes and then sends it to the internet layer
ensures delivery of data between the two nodes.
IP provides rules of exchange for packets and decides
Peer-to-peer File Sharing
the route for sending packets.
BitTorrent uses Peer-To-Peet file sharing model.
Diagram showcasing the layers of the tcp/ip suite A BitTorrent client software is made available to the
public.
Application Layer: Swarm: All connected peer computers that have all or
parts of file being downloaded/uploaded.
The application layer provides user services. Tracker: A central server that stores information on
Encodes data in an appropriate format when sending a which computers have which files and which parts of
message those files. It also shares the IP addresses of computers
Performs the action requested by the user when to allow them to connect to each other.
receiving a message Seed: is the peer computer that uploads the file that is
Transport Layer: being downloaded.

Handles packets. If a user wishes to join this network, they need to use a
Converts the data received from the application layer BitTorrent client to load the torrent descriptor file. When a
into individual packets when sending a message. user wishes to download a file, pieces of this file are
Adds packet headers and then sends these packets to downloaded and uploaded at the same time. When a user
the internet layer. has even a single piece of a file they become a seed. To be
Controls the flows of packets and handles packet loss or able to download this file, a complete copy needs to exist on
corruption. one of the peer computers.
When receiving a message, it reads the header and
determines which application layer the data must be 2.2. Circuit Switching, Packet Switching
sent to, then strips the header and forwards it
Circuit Switching
Internet Layer:

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

Dedicated circuit is selected before the communication


starts and is used to send all the data through this route. 3.1. RISC & CISC Processors
- Uses the whole bandwidth.
Releases circuit once the communication ends. RISC: Reduced Instruction Set Computers.
CISC: Complex Instruction Set Computers.
Used for live video broadcasts or calling
Data arrives in order so it doesn’t need to be RISC CISC
reassembled. Fewer instructions More instructions
Simpler instructions Complicated instructions
Whole bandwidth is available. A small number of instruction formats Many instruction formats
Data can’t get lost. Single-cycle instructions whenever possible Multi-cycle instructions
Fixed-length instructions Variable-length instructions
Less secure as it only uses one route. Only load and store instructions to address May types of instructions to address memory
memory
No alternative route in case of failure. Fewer addressing modes More addressing modes
Bandwidth can’t be shared. Multiple register sets Fewer registers
Hard-wired control unit Microprogrammed control unit
Pipelining easier Pipelining much difficult
Packet Switching
Pipelining: Instruction level parallelism
Data is split into multiple packets and each packet a Used extensively in RISC processor-based systems to
route is calculated for each packet. reduce the time taken to run processes
Each packet contain a header, which has a source IP Multiple registers are employed
address and destination IP address, and a payload. Interrupt handling in CISC and RISC Processors:
Calculates the most efficient path for each packet. As soon as the interrupt is detected, the current
Used when sending large files that don’t need to be live processes are paused and moved into registers
streamed or when it is necessary to be able to overcome The ISR (Interrupt Service Routine) is loaded onto the
faulty lines by rerouting like emails, text messages, pipeline and is executed.
sending documents, etc. When the interrupt has been serviced, the paused
Harder to intercept as new route is used each time. processes are resumed by bringing them back from the
Packets need to be reassembled. registers to the pipeline
If there’s a missing packet, a request is sent to retransmit RISC processors allow for providing efficient pipelining.
the data. Pipelining is instruction-level parallelism. Its underlying
Role of Router: principle is that the fetch-decode execute cycle can be
separated into several stages.
Examines the header and finds the destination IP
address. One of the possibilities include:
Decides the best route for the packet, with the help of 1. Instruction fetch (IF)
the information from the routing table, and sends it 2. Instruction decode (ID)
towards the next hop. 3. Operand fetch (OF)
4. Instruction execution (IE)
2.3. Comparison 5. Result write back (WB)

Circuit Switching Packet Switching


Nature Dedicated channel Data segmented into packets
Setup Requires pre-established channel No prior setup needed
Data handling Message remains intact Message gets split into packets
Transmission Single Path Path recalculated each time
Order In order May need reassembly
Layer (Data) Link Layer Network Layer
Bandwidth Makes full use of bandwidth Bandwidth can be shared
Error handling Communication ends incase of an error Allows packets to be resent
Complexity Simple More complex

3. Hardware and Virtual


Machines

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

Pipelining for Five-Stage Instruction Handling SISD


Single Instruction Single Data stream
Found in the early computers
Contains a single processor; thus, there is no
pipelining
SIMD
Single Instruction Multiple Data stream.
Found in array processors
Contains multiple processors, which have their own
memory.
MISD
Multiple Instruction Single Data stream
Used to sort large quantities of data.
Contains multiple processors which process the same
data
For pipelining to be implemented, the construction of the MIMD
processor must have five independent units, each Multiple Instruction Multiple Data.
handling one of the five identified stages. Found in modern personal computers.
Therefore, it's important for RISC processors to have Each processor executes a different individual
many register sets. Each processor unit must have instruction.
access to its own set of registers. The representations Massively parallel computers
1.1, 1.2, and so on are used to define the instruction and Computers that contain vast amounts of processing
the stage of the instruction. Initially, only the first stage power.
of the first instruction has entered the pipeline. At clock Has a bus structure to support multiple processors
cycle 6, the first instruction has left the pipeline, the last and a network infrastructure to support multiple
stage of instruction 2 is being handled, and instruction 6 ‘Host’ computers.
has just been entered. Once underway, the pipeline is Commonly used to solve highly complex
handling 5 stages of 5 individual instructions. At each mathematical problems.
clock cycle, the complete processing of one instruction is
finished. Without the pipelining, the processing time
would've been 5 times longer. 3.3. Virtual Machines
One disadvantage is interrupt handling. There will be 5
instructions in the pipeline when an interrupt occurs, so Virtual machine:
it needs to remove those previous instructions and then Process interacts with the software interface
handle the interrupt. provided by the OS. This provides an exact copy of
the hardware.
OS kernel handles interaction with actual host
3.2. Parallel Processing 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

Examples and Usage:

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

Used by companies wishing to use the legacy software A half adder adds two binary digits and outputs the sum
on newer hardware and server consolidation companies (s) and their carry (c).
Virtualising machines allows developers to test A XOR gate acts like a half adder.
applications on many systems without making expensive Input Output
A B S C
hardware purchases. 0 0 0 0
0 1 1 0
1 0 1 0
3.4. Logic Gates & Circuit Design 1 1 0 1

Logic Gates: A component of a logical circuit that can Full-Adder


perform a Boolean operation
A full adder adds three binary digits and outputs the sum
AND Gate: A.B = X and their carry.

A B X
0 0 0
0 1 0
1 0 0
1 1 1

OR Gate: A + B = X

R is "Carry In"
A B Output
J is "Carry Out"
0 0 0 K is "Sum"
0 1 1
1 0 1
1 1 1

NOT Gate: A = X

A Output
0 1
1 0

NAND Gate: A.B = X

A B Output

3.5. Flip-Flops
0 0 1
0 1 1
1 0 1
1 1 0
Flip flops can store a single bit of data as 0 or 1
NOR Gate: A + B = X ​
Computers use bits to store data.
Flip-flops can be used to store bits of data.
Memory can be created from flip-flops.
A B Output
0 0 1 SR Flip Flops
0 1 0
1 0 0
1 1 0

XOR Gate: A.B + A.B = X

A B Output
0 0 0
0 1 1
1 0 1
1 1 0

Half-Adder

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

Can be made with NAND gates or NOR gates JK flip flops are only active when the clock is high.
Error state exists JK flip flops use a clock pulse for synchronization to
ensure proper functioning.
Advantages of JK flip flops include the validity of all input
combinations, avoidance of unstable states, and
increased stability compared to SR flip flops.

S R Q Q Bar
0 0 1 1
0 1 1 0
1 0 0 1
1 1 No Change No Change

00 causes an error as Q Bar is no longer the complement


of Q
01 sets Q to 1 Clock J K Q Q Bar
10 resets Q to 0 0 0 0 - -
0 0 1 - -
11 leads to no change; the initial value remains 0 1 0 - -
0 1 0 - -
1 0 0 No Change No Change
1 0 1 0 1
1 1 0 1 0
1 1 0 Toggle Toggle

3.6. Boolean Algebra

S R Q Q Bar
0 0 No Change No Change
0 1 0 1
1 0 1 0
1 1 0 0

11 causes an error as Q Bar is no longer the complement


of Q
10 sets Q to 1
01 resets Q to 0
00 leads to no change; the initial value remains

JK Flip Flops

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

Double Complement: A = A Karnaugh maps: a method of obtaining a simplified


Identity Law Boolean algebra expression from a truth table. They
1.A = A minimize the number of logic circuits, thus making it
0+A = A more efficient.
Null Law Sum of products: all the combinations that lead to 1 in
the output.
0.A = 0
1+A = 1 Methodology
Idempotent Law
A.A = A Try to look for trends in the output, thus predicting the
A+A=A presence of a term in the final expression
Inverse Law Draw out a Karnaugh Map by filling in the truth table
A.A = 0 values into the table
A+A = 1 Select groups of ‘1’ bits in even quantities (2, 4, 6, etc.); if
Commutative Law not possible, then consider a single input as a group
A.B = B.A Note: Karnaugh Maps wrap around columns
A+B = B+A Within each group, only the values that remain constant
Associative are retained
(A.B).C = A.(B.C)
Example
(A + B) + C = A + (B + C)
Distributive Law
A + B.C = (A + B).(A + C)
A. (B + C ) = A.B + A.C
Adsorption
A. (A + B ) = A
A + A.B = A
De Morgan’s Law
(A.B ) = A + B
(A + B) = A.B

{example}

1. Sum of Products
A⋅B⋅C +A⋅B⋅C +A⋅B⋅C
2. Fill in the map

3.7. Karnaugh Maps

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

3. Circle the largest group containing an even number Hides complexities of the hardware from the user
of 1s. gives users access to the hardware/software systems
depending on their needs without involving them with
the backend
Examples include GUIs and CLIs

Multi-Tasking
Managing the execution of multiple programs that appear to
be running simultaneously.

Process
4. Take the common values from both
In the first group, A ⋅ B is common A process is the code being executed.
In the second group, A ⋅ C is common
Program
5. Write the simplified expression.
A⋅C +A⋅B A program is the code that has been written.

4. System Software 4.2. Process Scheduling


The process of allocating the CPU’s time on different
4.1. Purposes of an Operating System processes based on their needs.
(OS)
Maximizing Resource Use
Memory
Partitioning main memory into static and dynamic
partitions allowing for more than one program to be
available.
Removing unused items from RAM as soon as the
process is terminated and then marking the partition
as available.
Use virtual memory with paging to swap parts of the
memory and the disk. Importance
Disk
Allows for multi-tasking to take place
Compressing files in order to decrease the size and to
Ensures the CPU is busy at all times
allow for more larger files to be stored.
Makes sure that all programs have fair access to the CPU
Using defragmentation software so that files are
so that they can be executed efficiently.
arranged contiguously in the disk thereby reducing
Prevents starvation
access times.
Caching data that is frequently transferred to/from
Process States
the disk either on the disk or in RAM.
Ready: The process is not currently being executed. It is
User Interface 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.

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

Scheduling Algorithms 1. The RAM is divided into frames.


2. Virtual memory is divided into same-sized blocks
Shortest Job First: Processes are executed in ascending called pages with fixed sizes.
order based on the time needed to execute the task with 3. Page table created to translate logical address to
smaller jobs being executed first. This allows the CPU to physical addresses and track all the free frames.
execute more processes in a smaller amount of time. 4. Pages are swapped between them as necessary.
Round Robin: Each process is allocated a specific 5. When there is no empty space in the memory, a page
amount of time from the CPU. Their execution takes gets replaced with the new one. The replacement
place within these time frames. This helps prevent algorithm is either first in first out, least used page
starvation. and recently least used page.
First Come First Served: No complex logic involved;
processes are executed in the order they are requested. Page
There is less processor overhead due to its simplicity.
Shortest Remaining Time: Processes are executed in Virtual memory is divided into equal blocks called pages.
order of shortest remaining time for execution. It
ensures there is smaller waiting times between process Page Frame
execution.
Main memory is divided into parts equal in size to a page.
Interrupt Handling
Page Table
When an interrupt occurs, the process in the running state is
Contains the mappings of pages to page frames.
moved to the ready state and the interrupt is moved to the
running state so that it may be serviced.
Low Level Scheduler: Decides which of the processes in the
Segmentation
ready state should be moved to the running state based on A large process is divided to segments, the segments need
their priority/position. not be the same size.
High Level Scheduler: Decides which of the processes
should be loaded from the backing store into the ready Disk Thrashing
state.
When pages are needed in the RAM as soon as they are
4.3. Memory Management moved to the disk leading to a continuous swapping of the
same pages because the pages being swapped in and out
Virtual Memory are inter-dependent.

Temporarily using secondary storage to simulate additional 4.4. Translation Software


main memory, as only part of a program needs to be in
RAM. Data is swapped between the two. Interpreter
Paging An interpreter reads line by line and checks statements for
errors, if no errors are found it is executed otherwise a
A large process is divided into pages of equal sizes. report is made and the interpreter stops execution. It is
easier for debugging.

Lexical Analysis
Characters are converted from strings into tokens.
Comments are removed.
Symbol table stores identifiers and keywords.
Keyword table stores the reserved words used and the
matching operators.

Tokens: Strings with an assigned meaning

Syntax Analysis
A parse tree is generated for reverse polish notation and
syntax errors are reported.

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

Code generation Uses with a Stack


Object code is generated. RPN expression is read left to right
As values are read numbers are pushed into the stack.
Code Optimization If an operator is read the last two values in the stack are
popped, the operation is performed on them, and the
Code is optimized to improve time for execution. result is pushed back onto the stack.
Repeated until the end of the expression is reached.
4.5. Backus-Naur Form (BNF) Notation
Example
A form of expressing the grammar of a language visually.
(a–b) ∗ (a + c)/7 ↔ ab − ac + ∗7/
Example ab/4 ∗ ab + − ↔ (a/b) ∗ 4 − (a + b)

5. Security
5.1. Encryption
The process of converting of data into an unreadable
format.

Plain Text
Data before applying encryption.

<variable> ::= <letter> <usigned integer>


Cipher Text
Data after applying encryption.
<usigned integer> ::= <digit> | <digit> <digit>
Key Encryption:
<letter> ::= X | Y | Z
To ensure a message is authentic.
<digit> ::= 1 | 2 | 3 To ensure a message isn’t altered during transmission.
To ensure that only the intended receiver can
<operator> ::= + | - | * understand the message.
To ensure that neither send nor receiver can deny
<assignment statement> ::= <variable> = <variable> < involvement in the transmission.

Public Key
4.6. Reverse Polish Notation (RPN)
A public key is shared. It is used to encrypt data so that it can
Reverse Polish notation (RPN): An unambiguous method be decrypted with its matching private key.
for representing an expression left to right with needing
rules of precedence or brackets. Private Key

Advantages A private key is never shared. It is used to decrypt data that


was encrypted with its matching public key.
No brackets or precedence of operators needed
Simpler to evaluate Symmetric Encryption
No need for backtracking in evaluation as the operators
appear in the order required for computation and can be A single key is used for both encryption and decryption. The
evaluated from left to right key is shared between the sender and the receiver.
Disadvantages:
Key has to be exchanged securely.
Once compromised, it can decrypt sent and received
messages.
Cannot ensure origin or integrity of data.

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

Asymmetric Encryption Allow for more security when communicating over the
internet as it allows two parties identify and verify each
Two keys are used: public key and private key. The message other and communicate confidentially with integrity
is encrypted with the public key and decrypted using the Provides encryption.
matching private key.
Working
Symmetric VS Asymmetric
An SSL/TLS connection is initiated between two
Symmetric Asymmetric applications.
Number of Keys 1 key for both 2 keys
Is Key Shared Yes Only public key
The one initiating it is the client. The one receiving it is
Security Less secure as key needs to be shared More secure the server.
Complexity Simple Complex
Speed Fast Slow
Session begins with a handshake.
Key Length Short Longer Server sends its digital certificate and public key
Client confirms the server’s identity.
Security concerns relating to a transmission: Encryption algorithm is agreed upon and the symmetric
session keys are generated.
Confidentiality: Only the intended recipient should be
able to decrypt the message.
Use Cases
Authenticity: Receiver must know who sent the
ciphertext. Transmitting passwords or session cookies.
Integrity: Message must not be modified during Online shopping and banking websites.
transmission.
Non-repudiation: Neither the sender nor the receiver
should be able to deny involvement in the transmission. 5.3. Digital Certification
Quantum Cryptography Digital Certificate

Quantum Cryptography is used to produce a virtually 1. An organization sends a request to Certificate


unbreakable encryption system using the properties of Authority (CA).
photons. 2. They send their public key, information to prove their
Advantages: identity as well as any additional information
required by the CA.
More secure. 3. The CA then verifies their identity and then issues the
Eavesdropping can be detected. certificate after encrypting it with their private key.
Longer keys can be used.
Almost un-hackable. Digital Signature
Cannot be copied and decrypted at a later time.
The message is put through a hashing algorithm to produce
Disadvantages: the digest. This is then encrypted with the sender’s private
key. This is the digital signature.
Only works for short distances. When received the message and the digital signature are
High cost for maintenance and setup.
decrypted with the receiver’s private key. The digital
Lacks important features like digital signature, certified
signature is then decrypted with the sender’s public key. The
mail etc.
decrypted message is put through the same hashing
High error rate due to being new.
function to output a digest. The two digests are compared
Polarization of light may be altered during transmission. and if they are the same then the message was not
tampered with.
5.2. Encryption Protocols
Purpose 6. Artificial Intelligence (AI)
6.1. Graphs

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE
A graph is an abstract datatype that contains a collection of
nodes. These nodes are connected to each other with edges.
A node usually has a name, and an edge usually has a
numerical value.
One example of graphs is A* or Dijkstra's algorithm. The
nodes represent locations, and the edges represent the
distance between them.

Start from the Home. The cost from Home to Home is 0,


so g= 0. The heuristic cost of a home is 14, so h=14 and
f=g+h=14.
Now, there are three immediate nodes from home: A, B,
and C. Calculate the values of g, h and f for A, B and C
from home and write them in the table.
Select the node whose f value is the shortest (in this
Use of Graphs case, Node A).
From A, there are two immediate nodes, B and E.
Graphs provide relationships between different nodes. Calculate the g value for each node and add the g value
Allows AI problem to be defined as the most efficient of A. Then, add the corresponding h values to get f for
route between two nodes each node.
Analyzed by machine learning algorithms such as A* to From E, there are two immediate nodes, School and F.
perform calculations Calculate the g value for each node and add the g value
Graphs can also be used to represent neural networks. of E. Then, add the corresponding h values to get f for
each node.
6.2. A* & Dijkstra’s Algorithm From F to School, add the g value (3) to the g value of F
(8) and calculate f.
These algorithms are used to find the shortest route
between two nodes based on the distance. Final path = Home → A→E→F→School.

How to Implement A Algorithm?*


Below is an example of the implementation of the A*
Algorithm:

h is the heuristic value


g is the movement cost
F is the sum of gand h values.

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 LEVEL COMPUTER SCIENCE

6.3. Neural Networks & Machine Reinforcement Learning


Learning Reinforcement learning allows the computers to make
decisions that maximize the reward, it is then graded based
Neural Networks on how well it performed. Over time the computer learns
the correct decisions it needs to make based on its past
experiences.

Supervised Learning
In supervised learning the computer is fed labelled test data,
and it identifies the patterns that led to the data being
labelled in a specific way. This allows it to then predict labels
for new unseen data.

Unsupervised Learning
In unsupervised learning the computer is fed unlabeled test
Neural networks are modelled on the human brain. data, and it identifies hidden patterns.
They contain input and output nodes as well as one or
more hidden layers. Back Propagation of Errors
Each input node is assigned a specific weight, these
weights are summed, and an activation function An algorithm identifies errors with the machine learning and
calculates a value for the output. is then used to adjust the model for improved accuracy by
Repeated for each layer within the network thereby starting at the output layer and working backwards through
allowing reinforcement learning to take place. the hidden layers to the input layer.
For example, if you threw a ball and missed your target.
Use of Hidden Layers: You'd check how far off you were from the target and then
adjust things like angle and strength the next time you threw
Allow deep learning to take place the ball.
Allows the network to make decisions independently
Helps to improve the accuracy of the output Regression
Machine Learning Regression is finding a mathematical function that best fits
out output data based on the previous results in order to
Machine learning is a field of artificial intelligence in which predict the future value.
computers learn from provided data and past experiences in
order to improve its performance in a given task without
explicitly being programmed to know how to do the task. For
example, rather than telling the computer that emails that
advertise free products are most likely scams we feed it a lot
of data and it identifies that pattern on its own.

Deep Learning
A subset of machine learning that simulates the decision
making and data processing abilities of the human brain.
Benefits:

Good with extremely large sets of data


Good with unstructured data
Can identify hidden patterns

[Link] Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Yung at Trinity International College on 09/02/25.
CAIE A2 Level
Computer Science

© ZNotes Education Ltd. & ZNotes Foundation 2024. All rights reserved.
This version was created by Yung on Sun Feb 09 2025 for strictly personal use only.
These notes have been created by Talal Aamer for the 2024-2025 syllabus.
The document contains images and excerpts of text from educational resources available on the internet and printed books.
If you are the owner of such media, test or visual, utilized in this document and do not accept its usage then we urge you to contact us
and we would immediately replace said media. No part of this document may be copied or re-uploaded to another website.
Under no conditions may this document be distributed under the name of false author(s) or sold for financial gain.
"ZNotes" and the ZNotes logo are trademarks of ZNotes Education Limited (registration UK00003478331).

You might also like