CS Notes ZNOTES Programming
CS Notes ZNOTES Programming
ORG
CAIE IGCSE
COMPUTER SCIENCE
SUMMARIZED NOTES ON THE THEORY SYLLABUS
Prepared for Mashal for personal use only.
CAIE IGCSE COMPUTER SCIENCE
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE COMPUTER SCIENCE
Pseudocode - Verbal representation of an algorithm (a Declaration & Usage of Variables & Constants
process or set of steps) and flowcharts are a Variable – Store of data which changes during
diagrammatic representation. execution of the program (due to user input)
Flowcharts: A flowchart shows diagrammatically the Constant – Store of data that remains the same
steps required to complete a task and the order that during the execution of the program
they are to be performed Basic Data Types
Algorithm: These steps, together with the order, are Integer – Whole Number e.g. 2; 8; 100
called an algorithm Real – Decimal Number e.g. 7.00; 5.64
Char – Single Character e.g. ‘a’; ‘Y’
String – Multiple Characters (Text) e.g. “ZNotes”;
“COOL”
Boolean – Only 2 Values e.g. True/False; Yes/No; 0/1
Input & Output (READ & PRINT) – Used to receive and
display data to the user respectively. (It is recommended
to use input and output commands)
INPUT Name
OUTPUT "Hello Mr." , Name
// Alternatively //
READ Name
An example of a flowchart is given below from a past paper
PRINT "Hello Mr," , Name
question in which all of the functions of a flowchart are
shown: Declaration of variable - A variable/constant can be
declared by the following manner
2. Pseudocode
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE COMPUTER SCIENCE
Loop Structures:
FOR…TO…NEXT : Will run for a determined/kn
IF [BOOLEAN VARIABLE]
THEN
OUTCOME
ELSE
OUTCOME
ENDIF
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE COMPUTER SCIENCE
// Average//
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE COMPUTER SCIENCE
Bubble Sort: Iteratively compare and swap adjacent Test data that would be rejected by the solution as not
elements in a list to sort them. Start from the first suitable, if the solution is working properly is called
element and continue until the second-to-last element. abnormal test data / erroneous test data.
After each pass, the last element is in its correct place. e.g. in a program where only whole number values
However, other elements may still be unsorted. Repeat ranging from 0 to 100 (inclusive) are accepted, abnormal
the process, excluding the last element, until only one data will be: -1, 151, 200, 67.2, “Sixty-Two” and -520
element remains or no swaps are needed.
First ← 1
3.3. Extreme Data
Last ← 10
Extreme data are the largest and smallest values that
REPEAT
normal data can take
Swap ← FALSE
FOR Index ← First TO Last - 1
e.g. in a program where only whole number values
IF Array[Index] > Array[Index + 1]
ranging from 0 to 100 (inclusive) are accepted, extreme
THEN
data will be: 0 and 100
Temp ← Array[Index]
Array[Index] ← Array[Index + 1] 3.4. Boundary Data
Array[Index + 1] ← Temp
Swap ← TRUE This is used to establish where the largest and smallest
ENDIF values occur
NEXT Index At each boundary two values are required: one value is
Last ← Last - 1 accepted and the other value is rejected.
UNTIL (NOT Swap) OR Last = 1 e.g. in a program where only whole number values
ranging from 0 to 100 (inclusive) are accepted, one
example of boundary data will be: 100 and 101. 100 will
3. Test Data be accepted and 101 will not be accepted
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE COMPUTER SCIENCE
The ability to write an algorithm is very important for
Whenever a variable's value changes, the new value is this syllabus and paper. Some key steps/points to be
recorded in the respective column of the trace table. known in-order to write the perfect algorithm are as
Each time a value is outputted, it is displayed in the follows:
output column.
1. Make sure that the problem is clearly understood
An example of trace table is given below using a past paper which includes knowing the purpose of the algorithm
question: and the tasks to be completed by the algorithm.
Q: The flowchart below inputs the height of children who 2. Break the problem into smaller problems (e.g. in a
want to ride on a rollercoaster. Children under 1.2 metres program which outputs average values, divide the
are rejected. The ride starts when eight children have been problem into multiple ones i.e. how to count the
accepted. number of iterations and how to count the total of all
values)
3. Identify the data that is needed to be saved into
variables/constants/arrays and what datatype it is,
and declare all the variables/constants/arrays
accordingly, with meaningfull names
4. Decide on how you are going to construct your
algorithm, either using a flowchart or pseudocode. If
you are told how to construct your algorithm, then
follow the guidance.
5. Construct your algorithm, making sure that it can be
easily read and understood by someone else. Take
particular care with syntax e.g. when conditions are
used for loops and selection.
Complete the trace table for the input data: 1.4, 1.3, 1.1, 1.3, 6. Use several sets of test data (Normal, Abnormal and
1.0, 1.5, 1.2, 1.3, 1.4, 1.3, 0.9, 1.5, 1.6, 1.0 Boundary) to dry run your algorithm and check if the
Riders Reject Height OUTPUT
0 0
expected results are achieved (a trace table can be
1 1.4 used for this purpose) . If error is found, find the
2 1.3
1 1.1
point of error in the trace table and fix it in the code.
3 1.3
2 1.0 Note: The algorithms that you have looked at so far in these
4 1.5
3 1.2
notes were not designed with readability in mind because
5 1.3 you needed to work out what the problem being solved was.
6 1.4
7 1.3
8
4 0.9
1.5 Ready to go 4
5.1. Validation and Verification
To ensure the acceptance of reasonable and accurate data
4.1. Identifying errors: inputs, computer systems must thoroughly examine each
data item before accepting it, and this is where Validation
Trace tables can be used to trace errors in a program. and Verification come into play!
For example, if the requirement for the previous
question would be to accept riders that are of height 1.2 Validation
too, rather than rejecting them, then the error would
have been caught in the trace table as when 1.2 is Validation in computer systems involves automated checks
entered, it would increment rejected which it shouldn’t in to ensure the reasonableness of data before accepting it. If
our example the data is invalid, the system should provide an explanatory
message for rejection and allow another chance to enter the
5. How to write an algorithm? data.
There are multiple types of validation. These include:
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE COMPUTER SCIENCE
Range check
A range check verifies that a numerical value falls within Presence check
specified upper and lower limits.
A presence check checks to ensure that some data has been
REPEAT entered and the value has not been left blank
INPUT Value
IF Value < MinimumValue OR Value > MaximumValu OUTPUT "Please enter the value "
THEN REPEAT
OUTPUT "The student's mark should be in the r INPUT Value
ENDIF IF Value = ""
UNTIL Value >= MinimumValue AND Value <= Maximu THEN
OUTPUT "*=Required "
Length check ENDIF
UNTIL Value <> ""
This can either ensure that data consists of a precise
number of characters. Format Check
OUTPUT "Please enter your value of ", Limit , " A format check checks that the characters entered conform
REPEAT to a pre-defined pattern.
INPUT Value
IF LENGTH(Value) <> Limit Check Digit
THEN
OUTPUT "Your value must be exactly" , Limit , A check digit is the final digit included in a code; it is
ENDIF calculated from all the other digits.
UNTIL LENGTH(Value) = Limit Check digits are used for barcodes, product codes,
International Standard Book Numbers (ISBN), and
It can also check if the data entered is a reasonable number Vehicle Identification Numbers (VIN).
of characters or not
Verification
OUTPUT "Please enter your value "
REPEAT
Verification is checking that data has been accurately copied
INPUT Value
from one source to another
IF LENGTH(Value) > UpperLimit OR LENGTH(Value)
There are 2 methods to verify data during entry ( there
THEN are other methods during data transfer, but they are in
OUTPUT "Too short or too long, please re-ent
paper 1)
ENDIF
UNTIL LENGTH(Value) <= UpperLimit AND LENGTH(Va
1. Double Entry
Type check Data is inputted twice, potentially by different operators.
The computer system compares both entries and if they
A type check verifies that the entered data corresponds to a differ, an error message is displayed, prompting the data
specific data type. to be reentered.
OUTPUT "Enter the value "
REPEAT 2. Screen/Visual check
INPUT Value
A screen/visual check involves the user manually
IF Value <> DIV(Value, 1)
reviewing the entered data.
THEN
After data entry, the system displays the data on the
OUTPUT "This must be a whole number, please
screen and prompts the user to confirm its accuracy
ENDIF
before proceeding.
UNTIL Value = DIV(Value, 1)
The user can compare the displayed data against a paper
document used as an input form or rely on their own
knowledge to verify correctness.
6. Boolean Logic
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE COMPUTER SCIENCE
NOR gate: A + B
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE COMPUTER SCIENCE
(B AND C) OR (A NOR (A NAND C)) is the logic statement for
the following Logic Circuit
8.2. Example
10. Exam-Style Question
This is the example of a truth table of a logic circuit
The circuit:
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE COMPUTER SCIENCE
To store data about people, things, and events. 11.3. Validation in databases
Any modifications or additions need to be made only
once, ensuring data consistency. Database management software automatically provides
All users access and utilize the same set of data, some validation checks, while others need to be set up
promoting uniformity. by the developer during construction.
Relational databases store data in a non-repetitive For example; The software automatically validates fields
manner, eliminating duplication. like "DateOfAdmission" in the PATIENT table to ensure
data input is a valid date. \n
11.2. What makes a database?
11.4. Basic Data Types
Each field will require a data type to be selected. A data type
classifies how the data is stored, displayed and the
operations that can be performed on the stored value.
The datatypes for database are quite similar to original
datatypes, however, there are a few differences.
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE COMPUTER SCIENCE
SQL Scripts
11.7. Operators
Just like pseudocode, the operators used there can also be
used here for conditions, however, a few more are also used
in databases
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE COMPUTER SCIENCE
WWW.ZNOTES.ORG Copyright © 2025 ZNotes Education & Foundation. All Rights Reserved. This document is
authorised for personal use only by Mashal at Benchmark School System on 20/05/25.
CAIE IGCSE
Computer Science
© ZNotes Education Ltd. & ZNotes Foundation 2025. All rights reserved.
This version was created by Mashal on Tue May 20 2025 for strictly personal use only.
These notes have been created by Abdullah Aamir, Shriram S, Abhiram Mydi, Maimoona Junjunia & Adarsh SR Nalamalapu for the 2023-
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).