Caie As Level Computer Science 9618 Practical 634fb2359fe6a24c6da54e50 246
Caie As Level Computer Science 9618 Practical 634fb2359fe6a24c6da54e50 246
ORG
CAIE AS LEVEL
COMPUTER
SCIENCE
SUMMARIZED NOTES ON THE PRACTICAL SYLLABUS
Prepared for David Liu 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 David Liu at undefined on 14/05/24.
CAIE AS LEVEL COMPUTER SCIENCE
Boolean:
Date:
Array:
File:
Pseudocode:
2.2. ASCII Code 1-D Array: array = []
2-D Array: array = [[], [], [], …]
Uses 1 byte to store a character
Python:
7 bits available to store data and 8th bit is a check digit Declaring an array: names = []
27 = 128, therefore 128 different values Adding to an array: names.append(‘ZNotes’)
ASCII values can take many forms: numbers, letters Length of array i.e. number of elements: len(names)
(capitals and lower case are separate), punctuation, non- Printing an element in a 1D array:
printing commands (enter, escape, F1) print(names[element position])
Printing element in a 2D array: print (a[row]
2.3. Unicode [column])
Printing row in a 2D array: names[row] = [new row]
ASCII allows few number of characters; good for English Printing column: use for loop and keep adding 1 to the
Unicode allows others too: Chinese, Greek, Arabic etc. row and keep column same
Different types of Unicode:
UTF-8: compatible with ASCII, variable-width encoding 2.5. Bubble Sort
can expand to 16, 24, 32, 40, 48
UTF-16: 16-bit, variable-width encoding can expand to
32 bits
UTF-32: 32 bit, fixed-width encoding, each character
exactly 32 bits
2.4. Arrays
1-Dimensional (1D) Array: declared using a single index,
can be represented as a list
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is authorised
for personal use only by David Liu at undefined on 14/05/24.
CAIE AS LEVEL COMPUTER SCIENCE
Python:
Reading a file:
A FOR loop is set to stop the sort Read all characters: variable.read()
Setting a variable ‘sorted’ to be ‘true’ at the beginning Read each line and store as list: variable.readlines()
Another FOR loop is set up next in order to search through Writing to a file:
the array Write a fixed a sequence of characters to file:
An IF is used to see if the first number of the array is variable.write(“Text”)
greater than the second. If true: Write a list of string to file: variable.write(‘ ‘.join(‘Z’,
First number stored to variable ‘Notes’))
Second number assigned as first number
Stored variable assigned to second number
Set ‘sorted’ to ‘false’ causing loop to start again Abstract Data Types
The second FOR loop is count based thus will stop after a
specific number of times (ADT)
Goes through bigger FOR loop ∴ ‘sorted’ remains ‘true’
This exits the loop ∴ ending the program An Abstract Data Type (ADT) is a collection of data with
associated operations. There are three types of ADTs:
2.6. Linear Search Stack: an ordered collection of items where the addition of
new items and removal of existing items always takes
place at the same end.
Queue: a linear structure which follows the First In First
Out (FIFO) mechanism. Items are added at one end (called
A FOR loop goes through the array the rear) and removed from the other end (called the
It compares item in question to those in list using an IF: front)
If item matches with another then search is stopped Linked List: a linear collection of data elements whose
Also the location where it was found is returned order is not given by physical placements in memory
If not found it exits the FOR loop (non-contiguous). Each element points to the next.
Then returns fact that item in question is not in the list
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is authorised
for personal use only by David Liu at undefined on 14/05/24.
CAIE AS LEVEL COMPUTER SCIENCE
‘’’python ← ‘’’ or ‘’’python ‘’’ Create routines that can be called like built-in command
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is authorised
for personal use only by David Liu at undefined on 14/05/24.
CAIE AS LEVEL COMPUTER SCIENCE
Design program: develop logic plan, write algorithm in Purpose: used in structured programming to arrange
e.g. pseudocode or flowchart and test solution program modules, each module represented by a box
Code program: translate algorithm into high level Tree structure visualizes relationships between modules,
language with comments/remarks and produce user showing data transfer between modules using arrows.
interface with executable processes Example of a top-down design where a problem
Test and debug program: test program using test data, (program) is broken into its components.
find and correct any errors and ensure results are correct
Formalize solution: review program code, revise internal Rules:
documentation and create end-user documentation
Process: Represents a programming module e.g. a
Maintain program: provide education and support to end-
calculation
user, correct any bugs and modify if user requests
Coding:
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:
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is authorised
for personal use only by David Liu at undefined on 14/05/24.
CAIE AS LEVEL COMPUTER SCIENCE
When source code does not obey rules of the language 4.7. Testing Strategies
Compiler generates error messages
Black box testing:
Examples:
Misspell identifier when calling it Use test data for which results already calculated &
Missing punctuation – colon after if compare result from program with expected results
Incorrectly using a built-in function Testing only considers input and output and the code is
Argument being made does not match data type
viewed as being in a ‘black box’
Run-time errors: White box testing:
Source code compiles to machine code but fails upon Examine each line of code for correct logic and accuracy.
execution (red lines show up in Python) May record value of variables after each line of code
When the program keeps running and you have to kill it Every possible condition must be tested
manually
Examples: Stub testing:
Division by 0
Infinite loop – will not produce error message, Stubs are computer programs that act as temporary
program will just not stop until forced to replacement for a called module and give the same
output as the actual product or software.
Logic errors: Important when code is not completed however must be
tested so modules are replaced by stubs
Program works but gives incorrect output
Examples: Dry run testing:
Out By One – when ‘>’ is used instead of ‘>=’
Misuse of logic operators A process where code is manually traced, without any
software used
The value of a variable is manually followed to check
4.5. Corrective Maintenance whether it is used and updated as expected
Used to identify logic errors, but not execution errors
Corrective Maintenance is correcting identified errors
White-Box testing: making sample data and running it Walkthrough testing:
through a trace table
Trace table: technique used to test algorithms; make sure A test where the code is reviewed carefully by the
that no logical errors occur e.g. developer’s peers, managers, team members, etc.
It is used to gather useful feedback to further develop the
code.
Integration testing:
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is authorised
for personal use only by David Liu at undefined on 14/05/24.
CAIE AS LEVEL COMPUTER SCIENCE
This method allows all the code snippets to integrate with the developer.
each other, making the program work. Basically another term for ‘second round of testing’
This is the testing done on software ‘in-house’, meaning it A test carried out by the intended users of the system: the
is done by the developers people who requested the software.
Basically another term for ‘first round of testing’ The purpose is to check that the software performs
exactly as required.
Beta testing: The acceptance criteria should completely be satisfied for
the program to be released.
This is the testing done on the software by beta users,
who use the program and report any problems back to
WWW.ZNOTES.ORG Copyright © 2024 ZNotes Education & Foundation. All Rights Reserved. This document is authorised
for personal use only by David Liu at undefined on 14/05/24.
CAIE AS LEVEL
Computer Science
© ZNotes Education Ltd. & ZNotes Foundation 2024. All rights reserved.
This version was created by David Liu on 14/05/24 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).