Cambridge OL/IGCSE
2025
COMPUTER SCIENCE
PRACTICAL PAPER SHORT
NOTE DISCUSSION 2
DHANUSHKA NILANKA
077 0886853
Chapter 7: Algorithm design and Problem solving
1)Linear search
Fifty numbers are already stored in the array Values[1:50].
Write an algorithm in pseudocode to input a number, MyNumber, and use a linear search to
test if that number is stored in the array. If the number is found in the array, the position in
the array is output. If the number is not found in the array, “Not found” is output.
2)Bubble sort
Write an algorithm in pseudocode to sort the array Values[1:50] into ascending order using a
bubble sort.
1
3) Validation and verification
Validation is the automated checking by a program that data is reasonable before it is
accepted into a computer system.
There are many different types of validation checks including:
» range checks
» length checks
» type checks
» presence checks
» format checks
» check digits.
1)Range check
A range check checks that the value of a number is between an upper value and a lower
value. For example, checking that percentage marks are between 0 and 100 inclusive:
2) Length check
A length check checks that data contains an exact number of characters, for example that a
password must be exactly eight characters in length so that passwords with seven or fewer
characters or nine or more characters would be rejected.
2
3)Type check
A type check checks that the data entered is of a given data type, for example, that the
number of brothers or sisters would be an integer (whole number).
4)Presence check
A presence check checks to ensure that some data has been entered and the value has not
been left blank, for example, an email address
3
5)Format check
A format check checks that the characters entered conform to a pre-defined pattern.
Ex:CUB9999.
6)Check digit
A check digit is the final digit included in a code; it is calculated from all the other digits in the
code. Check digits are used for barcodes, product codes, International Standard Book Numbers
(ISBN) and Vehicle Identification Numbers (VIN).
Check digits are used to identify errors in data entry caused by mis-typing or mis-scanning a
barcode.
• an incorrect digit entered, for example, 5327 entered instead of 5307
• transposition errors where two numbers have changed order for example 5037 instead
of 5307
• phonetic errors, for example, 13, thirteen, instead of 30, thirty.
Verification
Verification is checking that data has been accurately copied from one source to another.
Verification methods for input data include:
» Double entry
» Screen/visual check.
For double entry the data is entered twice, sometimes by different operators. The computer
system compares both entries and if they are different outputs an error message requesting
that the data is entered again.
A screen/visual check is a manual check completed by the user who is entering the data.
When the data entry is complete the data is displayed on the screen and the user is asked to
confirm that it is correct before continuing.
4
4) Test data
Students mark range 1-100(inclusive)
i)Normal data
data will be within the range.
Example:50
ii)Abnormal(Errorneous) data
data will be out the range.
Example:150
iii)Extreme data
data is maximum or minimum both are accepted.
Example:1(minimum)
Example:100(maximum)
iv) boundary data
data is maximum and minimum,one is accepted and one is rejected.
Example:100(accepted)
Example:101(rejected)