CAIE-A2 Level-Computer Science - Practical
CAIE-A2 Level-Computer Science - Practical
ORG
CAIE A2 LEVEL
COMPUTER SCIENCE
SUMMARIZED NOTES ON THE THEORY SYLLABUS
Prepared for sasha for personal use only.
CAIE A2 LEVEL COMPUTER SCIENCE
if mid_element == target:
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by sasha at undefined on 20/01/25.
CAIE A2 LEVEL COMPUTER SCIENCE
TopOfStack ← TopOfStack – 1
ENDIF
ENDPROCEDURE
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by sasha at undefined on 20/01/25.
CAIE A2 LEVEL COMPUTER SCIENCE
IF TopOfStack = MaxStackSize
THEN
ELSE
TopOfStack = TopOfStack + 1
MyStack[TopOfStack] = NewItem
ENDIF
ENDPROCEDURE
Use of Stacks:
Interrupt Handling
The contents of the register and the PC are saved and
put on the stack when the interrupt is detected
The return addresses are saved onto the stack as well
Retrieve the return addresses and restore the
register contents from the stack once the interrupt
has been serviced
Evaluating mathematical expressions held in Reverse
Polish Notation
Procedure Calling
Every time a new call is made, the return address
must be stored
Return addresses are recalled in the order ‘the last
one stored will be the first to be recalled.’
If there are too many nested calls, then stack
overflow
2.2. Queues
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by sasha at undefined on 20/01/25.
CAIE A2 LEVEL COMPUTER SCIENCE
Binary Tree
START at Root Node
REPEAT
IF WantedItem = ThisItem
ELSE
3. Recursion
Part of the Computational Thinking and Problem-Solving
Chapter
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by sasha at undefined on 20/01/25.
CAIE A2 LEVEL COMPUTER SCIENCE
For example:
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by sasha at undefined on 20/01/25.
CAIE A2 LEVEL COMPUTER SCIENCE
• Inheritance is a fundamental concept in OOP that allows
you to create a new class (a derived or child class) based on
an existing class (a base or parent class).
• The child class inherits the attributes and methods of the
parent class and can also add new attributes and methods
or override the ones inherited.
When you create an instance of the class, the constructor
In the context of the Person class, Inheritance would involve
is invoked automatically to set the object's initial state.
creating a child class, such as a Student or Employee, that
This ensures that objects are created in a valid and
inherits attributes and methods from the Person class. For
consistent state.
example, a Student class could inherit the name and age
attributes and the get_name method from the Person class.
4.3. Defining Classes and Methods
Polymorphism
• To define a class in Python, use the class keyword followed
by the class name. • Polymorphism is the ability of different classes to be
• Inside the class, you can define attributes (variables) and treated as instances of a common base class. It allows
methods (functions) that belong to the class. objects of different classes to be used interchangeably if
Here's a simple example of defining a class called Person they implement the same methods or interface.
with attributes and methods as shown below: • Polymorphism promotes flexibility and extensibility in your
code.
In the context of the Person class, Polymorphism could be
applied when you have different types of persons, such as
students, employees, and teachers, each having a get_name
method. You can call get_name on instances of these
different classes without knowing their specific type, as long
as they all have a get_name method.
Encapsulation
• Encapsulation is the practice of hiding the internal details
4.4. Get and Set Methods of a class and providing a controlled interface to access and
modify the class's attributes.
These methods are used to access/change attributes set to • This helps maintain the integrity and consistency of the
be private in a class. These methods are decelerated inside object's state by controlling how data is accessed and
the class. modified.
In the context of the Person class, Encapsulation is applied
by making the name attribute private (by convention, using a
leading underscore). This indicates that __name it should not
be accessed directly from outside the class. Instead, you
provide a controlled interface through the get_name and
set_name methods, ensuring that name changes are
validated and controlled.
Below is a brief code example illustrating how inheritance,
polymorphism, and encapsulation could be applied to the
Person class:
4.5. Inheritance
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by sasha at undefined on 20/01/25.
CAIE A2 LEVEL COMPUTER SCIENCE
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by sasha at undefined on 20/01/25.
CAIE A2 Level
Computer Science
© ZNotes Education Ltd. & ZNotes Foundation 2024. All rights reserved.
This version was created by sasha on Mon Jan 20 2025 for strictly personal use only.
These notes have been created by Ashmit Bhola 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).