caie-igcse-computer-science-0478-practical-v1
caie-igcse-computer-science-0478-practical-v1
ORG
CAIE IGCSE
COMPUTER
SCIENCE
SUMMARIZED NOTES ON THE PRACTICAL SYLLABUS
CAIE IGCSE COMPUTER SCIENCE
Testing
1. Algorithm Design & The completed program or set of programs is executed
multiple times using various sets of test data.
Problem-Solving This testing process ensures that all the tasks within the
program work together as specified in the program
1.1. Program Development Life Cycle design.
By running the program with different test data, potential
(PDLC) issues and errors can be identified and addressed.
The testing phase aims to verify the overall functionality
Analysis and performance of the program by evaluating its
Design behavior with a variety of inputs.
Coding
Testing
1.2. Structure Diagrams
Every computer system is made up of sub-systems, which
Analysis
are in turn made up of further sub-systems.
Structure Diagrams – The breaking down of a computer
Before solving a problem, it is essential to define and
system into sub-systems, then breaking each sub-system
document the problem clearly, known as the
into smaller sub-systems, until each one only performs a
"requirements specification" for the program.
single action. A structure diagram diagrammatically
The analysis stage involves using tools like abstraction
represents top-down design. Example below.
and decomposition to identify the specific requirements
for the program.
Abstraction focuses on the essential elements needed for
the solution while eliminating unnecessary details and
information.
Decomposition involves breaking down complex problems
into smaller, more manageable parts that can be solved
individually.
Daily tasks can be decomposed into their constituent
parts for easier understanding and solving. 1.3. Pseudocode & Flowcharts
Design Pseudocode - Verbal representation of an algorithm (a
process or set of steps) and flowcharts are a
The program specification derived from the analysis diagrammatic representation.
stage is used as a guide for program development. Flowcharts: A flowchart shows diagrammatically the steps
During the design stage, the programmer should have a required to complete a task and the order that they are to
clear understanding of the tasks to be completed, the be performed
methods for performing each task, and how the tasks will
Algorithm: These steps, together with the order, are
work together. called an algorithm
Documentation methods such as structure charts,
flowcharts, and pseudocode can be used to formally
document the design of the program.
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
An example of a flowchart is given below from a past paper Array: Array is similar to variable but it can store multiple
question in which all of the functions of a flowchart are values of same datatype under single name
shown:
DECLARE [ARRAYNAME] : ARRAY [Lower Limit : Upper Limit
Conditional Statements:
IF…THEN…ELSE…ENDIF
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
corresponding consequences \n
THEN
Total ← 0
OUTCOME
FOR Counter ← 1 TO NumberOfValues
ELSE
Total ← Total + StudentMark[Counter]
OUTCOME
ENDIF
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
NEXT Counter
1.4. Normal Data
Average ← Total / NumberOfValues
Normal data is the test data which accepts values in
Linear Search: In a linear search, each item in the list is
inspected sequentially until a match is found or the entire acceptible range of values of the program
list is traversed. Normal data should be used to work through the solution
to find the actual result(s) and see if they are the same as
the expected result(s)
INPUT Value e.g. in a program where only whole number values
Found ← FALSE ranging from 0 to 100 (inclusive) are accepted, normal
Counter ← 1 test data will be : 23, 54, 64 , 2 and 100
REPEAT
IF Value = Array[Counter] Abnormal Data
THEN
Found ← TRUE Test data that would be rejected by the solution as not
ELSE suitable, if the solution is working properly is called
Counter ← Counter + 1 abnormal test data / erroneous test data.
ENDIF e.g. in a program where only whole number values
UNTIL Found OR Counter > NumberOfValues ranging from 0 to 100 (inclusive) are accepted, abnormal
IF Found data will be: -1, 151, 200, 67.2, “Sixty-Two” and -520
THEN
OUTPUT Value , " found at position " , Counter, " in the list."
ELSE
Extreme Data
OUTPUT Value , " not found."
Extreme data are the largest and smallest values that
ENDIF
normal data can take
Bubble Sort: Iteratively compare and swap adjacent e.g. in a program where only whole number values
elements in a list to sort them. Start from the first element ranging from 0 to 100 (inclusive) are accepted, extreme
and continue until the second-to-last element. After each data will be: 0 and 100
pass, the last element is in its correct place. However,
other elements may still be unsorted. Repeat the process, Boundary Data
excluding the last element, until only one element
remains or no swaps are needed. This is used to establish where the largest and smallest
values occur
First ← 1
At each boundary two values are required: one value is
Last ← 10 accepted and the other value is rejected.
REPEAT
e.g. in a program where only whole number values
Swap ← FALSE ranging from 0 to 100 (inclusive) are accepted, one
FOR Index ← First TO Last - 1 example of boundary data will be: 100 and 101. 100 will
IF Array[Index] > Array[Index + 1] be accepted and 101 will not be accepted
THEN
Temp ← Temperature[Index]
Array[Index] ← Array[Index + 1] Trace Table
Array[Index + 1] ← Temp
Swap ← TRUE A trace table is utilized to document the outcomes of
ENDIF every step in an algorithm. It is employed to record the
NEXT Index variable's value each time it undergoes a change.
Last ← Last - 1 A dry run refers to the manual process of systematically
UNTIL (NOT Swap) OR Last = 1 executing an algorithm by following each step in
sequence.
Test Data A trace table is set up with a column for each variable and
a column for any output e.g.
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
Test data is employed to execute a dry run of the flowchart Trace tables can be used to trace errors in a program. For
and document the outcomes in a trace table. During the dry example, if the requirement for the previous question
run: would be to accept riders that are of height 1.2 too, rather
than rejecting them, then the error would have been
Whenever a variable's value changes, the new value is caught in the trace table as when 1.2 is entered, it would
recorded in the respective column of the trace table. increment rejected which it shouldn’t in our example
Each time a value is outputted, it is displayed in the output
column.
1 1.4 Note: The algorithms that you have looked at so far in these
2 1.3 notes were not designed with readability in mind because you
1 1.1 needed to work out what the problem being solved was.
3 1.3
2 1.0 Validation and Verification
4 1.5
3 1.2 To ensure the acceptance of reasonable and accurate data
5 1.3 inputs, computer systems must thoroughly examine each
data item before accepting it, and this is where Validation and
6 1.4
Verification come into play!
7 1.3
4 0.9
1.7. Validation
8 1.5 Ready to go 4
Validation in computer systems involves automated checks to
1.5. Identifying errors: ensure the reasonableness of data before accepting it. If the
data is found to be invalid, the system should provide an
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
explanatory message for rejection and allow for another A presence check checks to ensure that some data has been
chance to enter the data. entered and the value has not been left blank
\n There are many types of it
OUTPUT "Please enter the value "
Range check REPEAT
INPUT Value
A range check verifies that a numerical value falls within IF Value = ""
specified upper and lower limits. THEN
OUTPUT "*=Required "
REPEAT ENDIF
UNTIL Value <> ""
This can either ensure that data consists of a precise number A check digit is the final digit included in a code; it is
of characters. calculated from all the other digits in the code.
Check digits are used for barcodes, product codes,
OUTPUT "Please enter your value of ", Limit , " characters " International Standard Book Numbers (ISBN) and Vehicle
REPEAT Identification Numbers (VIN).
INPUT Value
IF LENGTH(Value) <> Limit
THEN
Verification
Verification is checking that data has been accurately copied
ENDIF
from one source to another
UNTIL LENGTH(Value) = Limit
There are 2 methods to verify data during entry ( there are
It can also check if the data entered is a reasonable number other methods during data transfer but they are in paper 1)
of characters or not
1. Double Entry \n
OUTPUT "Please enter your value "
REPEAT Data is inputted twice, potentially by different operators.
The computer system compares both entries, and if they
differ, an error message is displayed, prompting for the
data to be reentered.
OUTPUT "Too short or too long, please re-enter "
ENDIF 2. Screen/Visual check
UNTIL LENGTH(Value) <= UppLimit AND
LENGTH(Value) >= LowerLimit A screen/visual check involves the user manually
Type check reviewing the entered data.
After data entry, the system displays the data on the
A type check verifies that the entered data corresponds to a screen and prompts the user to confirm its accuracy
specific data type before proceeding.
The user can compare the displayed data against a paper
OUTPUT "Enter the value " document used as an input form or rely on their own
REPEAT knowledge to verify correctness.
INPUT Value
IF Value <> DIV(Value, 1)
THEN 2. Programming Concepts
OUTPUT "This must be a whole number, please re-enter"
ENDIF
UNTIL Value = DIV(Value, 1)
2.1. Constructs of a program
Data use – variables, constants and arrays
Presence check
Sequence – order of steps in a task
Selection – choosing a path through a program
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
Iteration – repetition of a sequence of steps in a program Data saved to a file is stored permanently, allowing it to
Operator use – arithmetic for calculations, logical and be accessed by the same program at a later date or by
Boolean for decisions. other programs.
Stored data in a file can be transferred and used on other
Variables and Constants computers.
The storage of data in files is a commonly used feature in
A variable within a computer program refers to a named programming.
storage unit that holds a value, which has the potential to be
Key point: When writing in a file, the program is outputing the
modified throughout the program's execution. To enhance
data to the file, and when reading a file, the program in
comprehension for others, it is advisable to assign significant
inputing the data from the file
names to variables.
\n There are 3 ways a file can be opened in a program i.e. to
A constant within a computer program represents a named
write, to read and to append
storage unit that holds a value, which remains unchanged
throughout the program's execution. Similar to variables, to
enhance comprehensibility for others, it is recommended to 2.2. Writing in a file
assign meaningful names to constants as well.
OPENFILE "filename.txt" FOR WRITE
Data Types: //When opening a file to write, all the data already existing
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
Languages Strings are used to store text and can contain a varying
number of characters.
An empty string has no characters, while the maximum
There are many high-level programming languages to
choose from. We will be only treating Python, Visual Basic or number of characters allowed is specified by the
Java programming language.
Characters in a string can be identified by their position
Python is an open-source, versatile programming number, starting from either zero or one depending on
language that encourages quick program development the programming language.
and emphasizes code readability. The integrated String handling is an important aspect of programming.
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
In IGCSE Computer Science, you will need to write any moment within a program to accomplish a particular
algorithms and programs for the following string task. Unlike a procedure, a function also has the capability to
methods: return a value back to the main program.
Length: Determines the number of characters in a Parameters refer to variables that store the values of
string, including spaces. arguments passed to a procedure or function. While not all
Substring: Extracts a portion of a string. procedures and functions require parameters, some do
Upper: Converts all letters in a string to uppercase. utilize them to facilitate their operations.
Lower: Converts all letters in a string to lowercase. Procedures without parameters:
These string manipulation methods are commonly
provided in programming languages through library PROCEDURE ProcedureName ()
routines. [Commands]
ENDPROCEDURE
Finding the length of a string: //Calling/running the procedure
CALL ProcedureName()
LENGTH("Text Here")
Procedure with parameters:
LENGTH(Variable)
PROCEDURE ProcedureName (ParameterName : Parameter
Extracting a substring from a string: [Commands]
ENDPROCEDURE
SUBSTRING("Computer Science", 10, 7) //Calling/running the procedure
Converting a string to lower case When defining procedures and functions, the header is
the first statement in the definition.
LCASE("Text Here")
The header includes:
The name of the procedure or function.
LCASE(Variable)
Parameters passed to the procedure or function,
along with their data types.
Arithmetic, logical and Boolean The data type of the return value for a function.
operators Procedure calls are standalone statements.
Function calls are made as part of an expression, typically
Explained in the previous chapter already on the right-hand side.
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
Two-Dimensional Array
AND gate: A.B
A two-dimensional array can be referred to as a table,
with rows and columns A B Output
0 0 0
0 1 0
1 0 0
1 1 1
OR gate: A + B
A B Output
0 0 0
When a two-dimensional array is declared in pseudocode, 0 1 1
the first and last index value for rows and the first and last
1 0 1
index value for columns alongside the data type are
1 1 1
included.
Declaring a 2D Array:
3. Boolean Logic
NOR gate: A + B
3.1. Logic Gates and their functions
A B Output
Six types of logic gates
0 0 1
NOT Gate 0 1 0
AND Gate 1 0 0
OR Gate 1 1 0
NAND Gate
NOR Gate
XOR Gate
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
XOR gate: A ⨁ B
A B Output
0 0 0
0 1 1
1 0 1
1 1 0
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE
Each field will require a data type to be selected. A data type SELECT (fieldsname)
classifies how the data is stored, displayed and the FROM (tablesname)
operations that can be performed on the stored value. WHERE (condition)
The datatypes for database are quite similar to original ORDER BY (sortingcondition) ;
datatypes, however, there are a few differences.
Selecting Sum of values in a table:
SQL Scripts
Select Statements:
WWW.ZNOTES.ORG
CAIE IGCSE
Computer Science