Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
21 views11 pages

CAIE-As Level-Computer Science - Practical

The document provides summarized notes on the CAIE AS Level Computer Science theory syllabus, covering key concepts such as algorithm design, data representation, programming structures, and software development cycles. It includes definitions and examples of programming operations, data types, control structures, and file handling, along with pseudocode and Python syntax. The notes are intended for personal use by an individual named Pham and are updated for the 2023-2025 syllabus.

Uploaded by

kai791704
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)
21 views11 pages

CAIE-As Level-Computer Science - Practical

The document provides summarized notes on the CAIE AS Level Computer Science theory syllabus, covering key concepts such as algorithm design, data representation, programming structures, and software development cycles. It includes definitions and examples of programming operations, data types, control structures, and file handling, along with pseudocode and Python syntax. The notes are intended for personal use by an individual named Pham and are updated for the 2023-2025 syllabus.

Uploaded by

kai791704
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
You are on page 1/ 11

ZNOTES.

ORG

UPDATED TO 2023-2025 SYLLABUS

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

Assignment: an instruction in a program that places a


1. Algorithm Design & value into a specified variable
Sequence: programming statements are executed
Problem-Solving consequently, as they appear in the program
Selection: control structure in which there is a test to
Abstraction: filtering out and concentrating on the decide if certain instructions are executed
relevant information in a problem; allowing a IF selection: testing 2 possible outcomes
programmer to deal with complexity CASE selection: testing more than 2 outcomes
Decomposition: breaking down problems into sub- Repetition/Iteration: control structure in which a group
problems in order to understand a process more clearly; of statements is executed repeatedly
program modules, procedures and functions all help the FOR loop: count-controlled; executed a set no. of
programmer to break down large problems times
Algorithm: a solution to a problem expressed as a WHILE loop: pre-conditional; executed based on
sequence of steps condition at start of statements
REPEAT loop: post-conditional; executed based on
condition at end of statements
1.1. Identifier Table
As for selecting what loop to use, it is best to use FOR loops
Identifier: name given to a variable in order to call it when you know the number of iterations required, and a
An identifier table depicts information about the WHILE or REPEAT loop if you do not know the number of
variable, e.g. iterations required.

Iterate over an array: FOR Loop


Reading a file into a variable: WHILE Loop
Asking for user input: WHILE/REPEAT Loop
A loop that should execute n times: FOR Loop

Rules for naming identifiers: 1.3. Stepwise Refinement


Must be unique
Spaces must not be used Process of developing a modular design by splitting a
Must begin with a letter of the alphabet problem into smaller sub-tasks, which themselves are
Consist only of a mixture of letters and digits and the repeatedly split into even smaller sub-tasks until each is
underscore character ‘_’ just one element of the final program.
Must not be a ‘reserved’ word – e.g. Print, If, etc.
1.4. Program Modules
1.2. Basic Program Operations
This refers to a modular program design
Subroutines: self-contained section of code, performing
a specific task; part of the main program
Procedures: performs a specific task, no value returned
to part of code where called
Functions: performs a specific task, returns a value to
part of code where called

1.5. Logic Statements

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

2. Data Representation 2.2. ASCII Code


Uses 1 byte to store a character
2.1. Data Types 7 bits available to store data and 8th bit is a check digit
27 = 128, therefore 128 different values
Integer: ASCII values can take many forms: numbers, letters
Positive or negative number; no fractional part (capitals and lower case are separate), punctuation, non-
Held in pure binary for processing and storage printing commands (enter, escape, F1)
Some languages differentiate short/long integers (more
bytes used to store long integers) 2.3. Unicode
Real: ASCII allows few number of characters; it is good for
English
Number that contains a decimal point
Unicode allows others, too: Chinese, Greek, Arabic, etc.
Referred to as singles and doubles depending upon the
Different types of Unicode:
number of bytes used to store
UTF-8: compatible with ASCII, variable-width encoding
Character: can expand to 16, 24, 32, 40, 48
UTF-16: 16-bit, variable-width encoding can expand
A character is any letter, number, punctuation or space to 32 bits
Takes up a single unit of storage (usually a byte). UTF-32: 32-bit, fixed-width encoding, each character
exactly 32 bits
String:

Combination of alphanumeric characters enclosed in “ ” 2.4. Arrays


Each character is stored in one byte using ASCII code
Each character is stored in two bytes using Unicode 1-Dimensional (1D) Array: declared using a single index,
The maximum length of a string is limited by available can be represented as a list
memory.
Incorrect to store dates or numbers as strings
Phone no. must be stored as a string; otherwise, the
initial 0 is lost
Boolean:

It can store one of only two values; “True” or “False.”


Stored in 1 byte: True = 11111111, False = 00000000

Date:

Dates are stored as a ‘serial’ number


Equates to the number of seconds elapsed since 1st
January 1970 00:00:00 UTC, excluding leap seconds. 2-Dimensional (2D) Array: declared using two indices,
Usually takes 8 bytes of storage can be represented as a table
Displayed as dd/mm/yyyy or mm/dd/yyyy

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

A FOR loop is set to stop the sort


Setting a variable ‘sorted’ to be ‘true’ at the beginning
Another FOR loop is set up next in order to search
through the array
An IF is used to see if the first number of the array is
greater than the second. If true:
First number stored to variable
Second number assigned as first number
Stored variable assigned to second number
Set ‘sorted’ to ‘false’ causing loop to start again
The second FOR loop is count based thus will stop after a
specific number of times
Pseudocode: Goes through bigger FOR loop ∴ ‘sorted’ remains ‘true’
1-D Array: array = [] This exits the loop ∴ ending the program
2-D Array: array = [[], [], [], …]
Python:
Declaring an array: names = [] 2.6. Linear Search
Adding to an array: names.append(‘ZNotes’)
Length of array, i.e. number of elements:
len(names)
Printing an element in a 1D array:
print(names[element position]) A FOR loop goes through the array
Printing element in a 2D array: print (a[row] It compares item in question to those in list using an IF:
[column]) If item matches with another then search is stopped
Printing row in a 2D array: names[row] = [new Also the location where it was found is returned
row] If not found it exits the FOR loop
Printing column: Use it for loop, add 1 to the row, and Then returns fact that item in question is not in the list
keep the column the same.
2.7. File Handling
2.5. Bubble Sort
Files are needed to import contents (from a file) saved in
secondary memory into the program, or to save the
output of a program (in a file) into secondary memory, so
that it is available for future use

Pseudocode:

Opening a file: OPENFILE <filename> FOR


READ/WRITE/APPEND
Reading a file: READFILE <filename>, <variable>
Writing a line of text to the file: WRITEFILE
<filename>, <string>
Closing a file: CLOSEFILE <filename>
Testing for end of the file: EOF(filename)
Python:

Opening a file: variable = open(“filename”,


“mode”)

Where the mode can be:

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

4. Software Development Initial Error Detection:

4.1. Program Development Cycle

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

The IDE executes the code & initial error detection


carried out by compiler/interpreter doing the following:
Syntax/Logic Error: before program is run, an error
message warns the user about this
Runtime Error: run of the program ends in an error

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

4.3. Structure Charts


Purpose: used in structured programming to arrange
program modules, each module represented by a box
Tree structure visualizes relationships between modules,
showing data transfer between modules using arrows.
Example of a top-down design where a problem Example:
(program) is broken into its components.

Rules:

Process: Represents a programming module e.g. a


calculation

Data couple: Data being passed from module to module


that needs to be processed

4.4. Types of Errors


Flag: Check data sent to start or stop a process. E.g.
check if data sent in the correct format Syntax errors:

When source code does not obey rules of the language


Compiler generates error messages
Selection: Condition will be checked and depending on Examples:
the result, different modules will be executed Misspell identifier when calling it
Missing punctuation – colon after if
Incorrectly using a built-in function
Argument being made does not match data type

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

A test carried out by the intended users of the system:


the people who requested the software.
The purpose is to check that the software performs
exactly as required.
The acceptance criteria should completely be satisfied
for the program to be released.

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).

You might also like