CAIE-As Level-Computer Science - Practical
CAIE-As Level-Computer Science - Practical
ORG
CAIE AS LEVEL
COMPUTER SCIENCE
SUMMARIZED NOTES ON THE THEORY SYLLABUS
Prepared for Pham for personal use only.
CAIE AS LEVEL COMPUTER SCIENCE
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Pham at undefined on 11/02/25.
CAIE AS LEVEL COMPUTER SCIENCE
Operator Meaning
<
<=
Less than
Less than/equal
An object that stores data, information, settings or
> Greater than commands
>= Greater/equal Can be opened, saved, deleted & moved
= Equal to
<> Not equal to Transferrable across network connections
Date:
Array:
Data structure consisting of a collection of elements
Identified by at least one array index (or key)
File:
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Pham at undefined on 11/02/25.
CAIE AS LEVEL COMPUTER SCIENCE
Pseudocode:
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Pham at undefined on 11/02/25.
CAIE AS LEVEL COMPUTER SCIENCE
Mode Description ‘’’python identifier = value‘’’ or ‘’’python expression‘’’ or
r Opens file for reading only. Pointer placed at the beginning of the file.
w Opens a file for writing only. Overwrites file if file exists or creates new file if it ‘’’python “string”‘’’
doesn’t
Opens a file for appending. Pointer at end of file if it exists or creates a new file if
3.2. Selections
a not
Reading a file:
Read all characters: variable.read() “IF” Statement
Read each line and store as list: Pseudocode: IF…THEN…ELSE…ENDIF
variable.readlines()
Python: if (expression): (statements) else:
(statements)
Writing to a file:
Write a fixed a sequence of characters to file: “CASE” Statement
variable.write(“Text”)
Pseudocode: CASE OF variable: … … …
OTHERWISE: … ENDCASE
Write a list of string to file: variable.write(‘
‘.join(‘Z’, ‘Notes’))
Python: if (expression): (statement) elif
(expression): statement) … else:
(statement)
Abstract Data Types
3.3. Iterations
(ADT)
Count-controlled Loop
FOR <identifier> ← <val1> TO <val2> STEP <val3>
An Abstract Data Type (ADT) is a collection of data with <statement(s)>
ENDFOR
associated operations. There are three types of ADTs: for x in range(value1, value2):
statement(s)
Post condition Loop
Stack: an ordered collection of items where the addition REPEAT
Not possible in Python
of new items and removal of existing items always takes <statement(s)>
UNTIL <condition> Use ‘’’python WHILE‘’’ and ‘’’python IF‘’’
place at the same end. Pre-condition Loop
WHILE <condition>
Queue: a linear structure which follows the First In First <statement(s)> while expression:
statement(s)
ENDWHILE
Out (FIFO) mechanism. Items are added at one end
(called the rear) and removed from the other end (called
the front) 3.4. Built-in Functions
Linked List: a linear collection of data elements whose
order is not given by physical placements in memory String/character manipulation:
(non-contiguous). Each element points to the next.
Uppercase or lowercase all characters:
(“string”).upper() (“string”).lower()
3. Programming Finding length of a string: len(“string”)
Converting:
Programming is a transferable skill String to Integer - int(“string”)
Transferable skill: skills developed in one situation Integer to String - str(integer)
which can be transferred to another situation. Random number generator: random.randint(a, b)
Where a and b defines the range
3.1. Variables
3.5. Benefits of Procedures and
Declaring a variable:
Pseudocode: ‘’’DECLARE : ‘’’ Functions:
Python: no need to declare however must write
above as a comment (‘’’python #...‘’’) Lines of code can be re-used; don’t have to be repeated
Assigning variables: Can be tested/improved independently of program
Easy to share procedures/functions with other programs
‘’’python ← ‘’’ or ‘’’python ‘’’ Create routines that can be called like built-in command
3.6. Procedure
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Pham at undefined on 11/02/25.
CAIE AS LEVEL COMPUTER SCIENCE
Procedure: subroutine that performs a specific task without
returning a value Analyze problem: define problem, record program
specifications and recognize inputs, process, output & UI
Procedure without parameters: Design program: develop logic plan, write algorithm in
e.g. pseudocode or flowchart and test solution
PROCEDURE <statement(s)>ENDPROCEDURE def identifier():statement(s)
Code program: translate algorithm into high level
When a procedure has a parameter, the function can language with comments/remarks and produce user
either pass it by either reference or value interface with executable processes
Pass by value: data copied into procedure so variable Test and debug program: test program using test data,
not changed outside procedure find and correct any errors and ensure results are
correct
PROCEDURE <identifier> (BYVALUE <param>: Formalize solution: review program code, revise
<datatype>) internal documentation and create end-user
<statement(s)> documentation
ENDPROCEDURE Maintain program: provide education and support to
def identifier(param): end-user, correct any bugs and modify if user requests
statement(s)
There are three different development life cycles:
Pass by reference: link to variable provided so variable
changed after going through procedure (not in Python) Waterfall model: a classical model, used to create a
system with a linear approach, from one stage to
PROCEDURE <identifier> (BYREF <param>: another
<datatype>) Iterative model: a initial representation starts with a
<statement(s)> small subset, which becomes more complex over time
ENDPROCEDURE until the system is complete
Rapid Application Development (RAD) model: a
Calling a procedure: prototyping model, with no (or less) specific planning put
CALL () Identifier()
into it. More emphasis on development and producing a
product-prototype.
3.7. Function
4.2. Integrated Development
Function: subroutine that performs a specific task and Environment
returns a value
Functions are best used to avoid having repeating blocks of A software application that allows the creation of a
code in a program, as well as increasing the reusability of program e.g. Python
code in a large program. Consists of a source code editor, build automation tools,
FUNCTION <identifier> (<parameter>: <data a debugger
type>) RETURNS <datatype>
<statement(s)> Coding:
ENDFUNCTION
def identifier(param): Reserved words are used by it as command prompts
statement(s) Listed in the end-user documentation of IDE
return expression A series of files consisting of preprogrammed-
subroutines may also be provided by the IDE
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Pham at undefined on 11/02/25.
CAIE AS LEVEL COMPUTER SCIENCE
Debugging:
Single stepping: traces through each line of code and
steps into procedures. Allows you to view the effect of
each statement on variables Iteration: Implies that module is executed multiple
Breakpoints: set within code; program stops temporarily times
to check that it is operating correctly up to that point
Variable dumps (report window): at specific parts of
program, variable values shown for comparison
Rules:
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Pham at undefined on 11/02/25.
CAIE AS LEVEL COMPUTER SCIENCE
Run-time errors:
Use test data for which results already calculated &
Source code compiles to machine code but fails upon compare result from program with expected results
execution (red lines show up in Python) Testing only considers input and output and the code is
When the program keeps running and you have to kill it viewed as being in a ‘black box’
manually
Examples: White box testing:
Division by 0
Examine each line of code for correct logic and accuracy.
Infinite loop – will not produce error message, May record value of variables after each line of code
program will just not stop until forced to Every possible condition must be tested
Logic errors: Stub testing:
Program works but gives incorrect output Stubs are computer programs that act as temporary
Examples:
replacement for a called module and give the same
Out By One – when ‘>’ is used instead of ‘>=’ output as the actual product or software.
Misuse of logic operators Important when code is not completed however must be
tested so modules are replaced by stubs
4.5. Corrective Maintenance
Dry run testing:
Corrective Maintenance is correcting identified errors
White-Box testing: making sample data and running it A process where code is manually traced, without any
through a trace table software used
Trace table: technique used to test algorithms; make The value of a variable is manually followed to check
sure that no logical errors occur e.g. whether it is used and updated as expected
Used to identify logic errors, but not execution errors
Walkthrough testing:
A test where the code is reviewed carefully by the
developer’s peers, managers, team members, etc.
It is used to gather useful feedback to further develop
the code.
Integration testing:
Taking modules that have been tested on individually
and testing on them combined together
This method allows all the code snippets to integrate
4.6. Adaptive Maintenance with each other, making the program work.
Making amendments to: Alpha testing:
Parameters: due to changes in specification
Logic: to enhance functionality or more faster or This is the testing done on software ‘in-house’, meaning it
both is done by the developers
Design: to make it more user friendly Basically another term for ‘first round of testing’
Beta testing:
4.7. Testing Strategies
This is the testing done on the software by beta users,
Black box testing: who use the program and report any problems back to
the developer.
Basically another term for ‘second round of testing’
Acceptance testing:
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Pham at undefined on 11/02/25.
CAIE AS LEVEL COMPUTER SCIENCE
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Pham at undefined on 11/02/25.
CAIE AS Level
Computer Science
© ZNotes Education Ltd. & ZNotes Foundation 2024. All rights reserved.
This version was created by Pham on Tue Feb 11 2025 for strictly personal use only.
These notes have been created by Shaikh Ayman Abdul-Majid for the 2023 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).