Z Notes Comp p2
Z Notes Comp p2
ORG
CAIE AS LEVEL
COMPUTER SCIENCE
SUMMARIZED NOTES ON THE THEORY SYLLABUS
Prepared for Avi for personal use only.
CAIE AS LEVEL COMPUTER SCIENCE
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Avi at undefined on 15/11/24.
CAIE AS LEVEL COMPUTER SCIENCE
Operator Meaning
< Less than An object that stores data, information, settings or
commands
<= Less than/equal
Can be opened, saved, deleted & moved
> Greater than
Transferrable across network connections
>= Greater/equal
= Equal to
<> Not equal to 2.2. ASCII Code
Uses 1 byte to store a character
2. Data Representation 7 bits available to store data and 8th bit is a check digit
27 = 128, therefore 128 different values
2.1. Data Types ASCII values can take many forms: numbers, letters
(capitals and lower case are separate), punctuation, non-
Integer: printing commands (enter, escape, F1)
Date:
Dates are stored as a ‘serial’ number 2-Dimensional (2D) Array: declared using two indices,
Equates to the number of seconds elapsed since 1st can be represented as a table
January 1970 00:00:00 UTC, excluding leap seconds.
Usually takes 8 bytes of storage
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 © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Avi at undefined on 15/11/24.
CAIE AS LEVEL COMPUTER SCIENCE
Pseudocode:
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Avi at undefined on 15/11/24.
CAIE AS LEVEL COMPUTER SCIENCE
Mode Description ‘’’python identifier = value‘’’ or ‘’’python expression‘’’ or
Opens file for reading only. Pointer placed at the ‘’’python “string”‘’’
r
beginning of the file.
w
Opens a file for writing only. Overwrites file if file 3.2. Selections
exists or creates new file if it doesn’t
Opens a file for appending. Pointer at end of file if it “IF” Statement
a
exists or creates a new file if not
Pseudocode: IF…THEN…ELSE…ENDIF
Python: if (expression): (statements) else:
Reading a file:
(statements)
Read all characters: variable.read() “CASE” Statement
Read each line and store as list:
Pseudocode: CASE OF variable: … … … OTHERWISE:
variable.readlines()
… ENDCASE
Writing to a file:
Python: if (expression): (statement) elif
Write a fixed a sequence of characters to file:
(expression): statement) … else: (statement)
variable.write(“Text”)
Write a list of string to file: variable.write(‘
‘.join(‘Z’, ‘Notes’)) 3.3. Iterations
Count-controlled Loop
Abstract Data Types FOR <identifier> ← <val1> TO
<val2> STEP <val3>
(ADT) <statement(s)>
ENDFOR
An Abstract Data Type (ADT) is a collection of data with for x in range(value1, value2):
statement(s)
associated operations. There are three types of ADTs:
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)> Use ‘’’python WHILE‘’’ and
place at the same end. UNTIL <condition> ‘’’python IF‘’’
Queue: a linear structure which follows the First In First Pre-condition Loop
Out (FIFO) mechanism. Items are added at one end WHILE <condition>
while expression:
(called the rear) and removed from the other end (called <statement(s)>
statement(s)
ENDWHILE
the front)
Linked List: a linear collection of data elements whose
order is not given by physical placements in memory 3.4. Built-in Functions
(non-contiguous). Each element points to the next.
String/character manipulation:
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Avi at undefined on 15/11/24.
CAIE AS LEVEL COMPUTER SCIENCE
Lines of code can be re-used; don’t have to be repeated Analyze problem: define problem, record program
Can be tested/improved independently of program specifications and recognize inputs, process, output & UI
Easy to share procedures/functions with other programs Design program: develop logic plan, write algorithm in
Create routines that can be called like built-in command e.g. pseudocode or flowchart and test solution
Code program: translate algorithm into high level
3.6. Procedure language with comments/remarks and produce user
interface with executable processes
Procedure: subroutine that performs a specific task without Test and debug program: test program using test data,
returning a value find and correct any errors and ensure results are
correct
Procedure without parameters: Formalize solution: review program code, revise
internal documentation and create end-user
PROCEDURE def documentation
<statement(s)>ENDPROCEDURE identifier():statement(s) Maintain program: provide education and support to
end-user, correct any bugs and modify if user requests
When a procedure has a parameter, the function can
either pass it by either reference or value There are three different development life cycles:
Pass by value: data copied into procedure so variable
not changed outside procedure Waterfall model: a classical model, used to create a
system with a linear approach, from one stage to
PROCEDURE <identifier> (BYVALUE <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
def identifier(param): Rapid Application Development (RAD) model: a
statement(s) prototyping model, with no (or less) specific planning put
into it. More emphasis on development and producing a
Pass by reference: link to variable provided so variable product-prototype.
changed after going through procedure (not in Python)
PROCEDURE <identifier> (BYREF <param>: <datatype>) 4.2. Integrated Development
<statement(s)>
ENDPROCEDURE
Environment
Calling a procedure: A software application that allows the creation of a
program e.g. Python
CALL () Identifier() Consists of a source code editor, build automation tools,
a debugger
3.7. Function Coding:
Function: subroutine that performs a specific task and Reserved words are used by it as command prompts
returns a value Listed in the end-user documentation of IDE
Functions are best used to avoid having repeating blocks of A series of files consisting of preprogrammed-
code in a program, as well as increasing the reusability of subroutines may also be provided by the IDE
code in a large program.
FUNCTION <identifier> (<parameter>: <data type>) Initial Error Detection:
RETURNS <datatype>
The IDE executes the code & initial error detection
<statement(s)>
carried out by compiler/interpreter doing the following:
ENDFUNCTION
Syntax/Logic Error: before program is run, an error
def identifier(param):
message warns the user about this
statement(s)
Runtime Error: run of the program ends in an error
return expression
Debugging:
4. Software Development
4.1. Program Development Cycle
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Avi at undefined on 15/11/24.
CAIE AS LEVEL COMPUTER SCIENCE
Rules:
Logic errors:
Iteration: Implies that module is executed multiple
times Program works but gives incorrect output
Examples:
Out By One – when ‘>’ is used instead of ‘>=’
Misuse of logic operators
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Avi at undefined on 15/11/24.
CAIE AS LEVEL COMPUTER SCIENCE
Walkthrough testing:
4.5. Corrective Maintenance A test where the code is reviewed carefully by the
developer’s peers, managers, team members, etc.
Corrective Maintenance is correcting identified errors It is used to gather useful feedback to further develop
White-Box testing: making sample data and running it
the code.
through a trace table
Trace table: technique used to test algorithms; make Integration testing:
sure that no logical errors occur e.g.
Taking modules that have been tested on individually
and testing on them combined together
This method allows all the code snippets to integrate
with each other, making the program work.
Alpha testing:
This is the testing done on software ‘in-house’, meaning it
is done by the developers
Basically another term for ‘first round of testing’
Beta testing:
4.6. Adaptive Maintenance This is the testing done on the software by beta users,
who use the program and report any problems back to
Making amendments to: the developer.
Parameters: due to changes in specification Basically another term for ‘second round of testing’
Logic: to enhance functionality or more faster or Acceptance testing:
both
Design: to make it more user friendly A test carried out by the intended users of the system:
the people who requested the software.
4.7. Testing Strategies The purpose is to check that the software performs
exactly as required.
Black box testing: The acceptance criteria should completely be satisfied
for the program to be released.
Use test data for which results already calculated &
compare result from program with expected results
Testing only considers input and output and the code is
viewed as being in a ‘black box’
Stub testing:
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Avi at undefined on 15/11/24.
CAIE AS Level
Computer Science
© ZNotes Education Ltd. & ZNotes Foundation 2024. All rights reserved.
This version was created by Avi on Fri Nov 15 2024 for strictly personal use only.
These notes have been created by Zubair Junjunia for the 2017 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).