Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
27 views

caie-igcse-computer-science-0478-practical-v1

Uploaded by

Carmen Vigueras
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

caie-igcse-computer-science-0478-practical-v1

Uploaded by

Carmen Vigueras
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

ZNOTES.

ORG

UPDATED TO 2023-2025 SYLLABUS

CAIE IGCSE
COMPUTER
SCIENCE
SUMMARIZED NOTES ON THE PRACTICAL SYLLABUS
CAIE IGCSE COMPUTER
SCIENCE

1. Algorithm
Design &
Problem-Solving
1.1.Program Development
Decomposing a problem
Life Cycle (PDLC)
any problem that uses any kind of computer system for
its solution needs to be decomposed into its
component parts. These component parts of any
Analysis
computer system are:
Design
Coding data entered to the system
INPUT while it is active.
Testing
Maintenance tasks performed using input
PROCESS and stored data.
Analysis
information displayed or printed
OUTPUT for the users of the system.
Identifies the problem and its requirement.

Design STORAGE data stored in files for future


use.

Develops an algorithm to solve the problem by


using structure diagrams, flowcharts, or
Input:
pseudocode. setting/removin
g/switching
Coding and iterative testing off/snoozing an
alarm.
Writes and implements the instructions to solve
the problem. Process:
checking if the
Testing time matches
an alarm,
Detects and fixes the problem. storage and
removal of
alarms,
1.2.Structure Diagrams management of
snooze.
Every computer system is made up of sub-
systems, which are in turn made up of further Output:
sub-systems. continuous
sound.
– The breaking down of a
computer
system into sub-systems, then breaking each Storage:
time(s) for
sub-system into smaller sub-systems, until
alarm set.
each one only performs a single action. A
structure diagram diagrammatically represents 1.3.Pseudocode & Flowcharts
top-down design. Example below.
Verbal representation of an
algorithm (a process or set of steps) and
flowcharts are a diagrammatic representation.
A flowchart shows diagrammatically
the steps required to complete a task and the
order that they are to be performed.
These steps, together with the
order, are called an algorithm.

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
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
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
PRINT "Hello Mr," , Name

A variable/constant can be
declared by the following manner

DECLARE [Variable Name] : [DATATYPE OF VARIABLE]

Array is similar to variable but it can store


An example of a flowchart is given below from a past multiple values of same datatype under single
paper question in which all of the functions of a name
flowchart are shown:
DECLARE [ARRAYNAME] : ARRAY [Lower Limit : Upper
Limi

Each variable is assigned using a left


arrow.

[VARIABLE NAME] < [Value to be assigned]


ArrayName [IndexValue] < [Value to be
assigned]

Conditional Statements: IF…


THEN…ELSE…ENDIF

This flowchart’s task is to check if a rider’s height is


more the requirement (1.2) in this case. It then
counts until the accepted riders are 8. After they are
8, it outputs the number of rejected riders and tells
the rest that they are ready to go!

Pseudocode
CASE…OF…OTHERWISE…ENDCASE – Multiple conditions and
corresponding sequences \n

Declaration & Usage of Variables & Constants


Variable – Store of data which changes during
execution of the program (due to user input)

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
Constant – Store of data that remains the same during
the execution of the program
Basic Data Types
Integer – Whole Number e.g. 2; 8; 100
Real – Decimal Number e.g. 7.00; 5.64

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
corresponding consequences \n

Standard methods used in


algorithm:
Totalling :Totalling means keeping a total that values
are added to
Total ← 0
FOR…TO…NEXT : Will run for a determined/known . FOR Counter ← 1 TO LoopLimit
amount of times
Total ← Total + ValueToBeTotalled
NEXT Counter

Counting: Keeping a count of the number of times


an action is performed is another standard
method.

REPEAT… UNTIL – Will run at least once till condition PassCount ← 0


is satisfied; Verification is done after running code FOR Counter ← 1 TO LoopLimit
INPUT Value
IF Value > Range
THEN
WHILE…DO…ENDWHILE – PassCount ← PassCount + 1
May not ever run; Verification is done before ENDIF
running code
NEXT Counter

Maximum, minimum and average : Finding


the largest and smallest values in a list are two
W en using standard methods that are frequently found in
conditions in these loop structures and h
algorithms
conditional statement, it has to be kept in mind
that it can be done in two ways. MaxiumumValue <--- Array[1] MinimumValue <---
1. use of a Boolean variable that can have Array[1] FOR Counter ← 2 TO LoopLimit
the value TRUE or FALSE IF Array[Counter] >
2. comparisons made by using coparison MaximumValue THEN
operators, where comparisons are made MaximumValue ← Array[Counter]
from left to right ENDIF

IF [BOOLEAN VARIABLE]
IF Array[Counter] <
THEN
MinimumValue THEN
OUTCOME
MinimumValue ←
ELSE
Array[Counter] ENDIF
OUTCOME
NEXT Counter
ENDIF
//Average//

IF ((CONDITION 1) OR ( CONDITION 2)) AND (CONDITION 3) AND (CONDITION 4)


OUTCOME ELSE OUTCOME ENDIF

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
Total ← 0 Mark[Counter]
F
O
R

C
o
u
n
t
e
r

T
O

N
u
m
b
e
r
O
f
V
a
l
u
e
s

T
o
t
a
l

T
o
t
a
l

S
t
u
d
e
n
t

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
NEXT Counter
Average ← Total / NumberOfValues 1.4. Normal Data
In a linear search, each item in the Normal data is the test data which accepts
list is inspected sequentially until a match is found values in acceptible range of values of the
or the entire list is traversed. program
Normal data should be used to work through the
solution to find the actual result(s) and see if they
INPUT Value
are the same as the expected result(s)
Found ← FALSE
e.g. in a program where only whole number
Counter ← 1
values ranging from 0 to 100 (inclusive) are
REPEAT
accepted, normal test data will be : 23, 54, 64 , 2
IF Value =
and 100
Array[Counter] THEN
Found ← TRUE
ELSE
Abnormal Data
Counter ← Counter +
1 ENDIF Test data that would be rejected by the solution as
not suitable, if the solution is working properly is
UNTIL Found OR Counter >
called abnormal test data / erroneous test data.
NumberOfValues IF Found
e.g. in a program where only whole number
THEN
values ranging from 0 to 100 (inclusive) are
OUTPUT Value , " found at position " , Counter, " in
accepted, abnormal data will be: -1, 151, 200,
the list." ELSE
67.2, “Sixty-Two” and -520
OUTPUT Value , " not found."
ENDIF
Extreme Data
Iteratively compare and swap adjacent
elements in a list to sort them. Start from the first Extreme data are the largest and smallest values
element and continue until the second-to-last that normal data can take
element. After each pass, the last element is in e.g. in a program where only whole number
its correct place. However, other elements may still values ranging from 0 to 100 (inclusive) are
be unsorted. Repeat the process, excluding the last accepted, extreme data will be: 0 and 100
element, until only one element remains or no
swaps are needed.
Boundary Data
First ← 1
Last ← 10 This is used to establish where the largest and
REPEAT smallest values occur
Swap ← FALSE At each boundary two values are required: one
FOR Index ← First TO Last - 1 value is accepted and the other value is rejected.
IF Array[Index] > e.g. in a program where only whole number
Array[Index + 1] THEN values ranging from 0 to 100 (inclusive) are
Temp ← Temperature[Index] accepted, one example of boundary data will be:
Array[Index] ← Array[Index + 1] 100 and 101. 100 will be accepted and 101 will
Array[Index + 1] ← Temp not be accepted
Swap ← TRUE
ENDIF
NEXT Index
Trace Table
Last ← Last - 1
A trace table is utilized to document the
UNTIL (NOT Swap) OR Last = 1
outcomes of every step in an algorithm. It is
employed to record the variable's value each
Test Data time it undergoes a change.
A refers to the manual process of
Test data refers to input values used to systematically executing an algorithm by
evaluate and assess the functionality and following each step in sequence.
performance of a computer program or system. A trace table is set up with a column for each variable
and
It helps identify errors and assess how the a column for any output e.g.
program handles different scenarios

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
Test data is employed to execute a dry run of the
Trace tables can be used to trace errors in a program.
flowchart and document the outcomes in a trace
For example, if the requirement for the previous
table. During the dry run:
question would be to accept riders that are of
Whenever a variable's value changes, the new height 1.2 too, rather than rejecting them, then
value is recorded in the respective column of the the error would have been caught in the trace
trace table. table as when 1.2 is entered, it would increment
Each time a value is outputted, it is displayed in rejected which it shouldn’t in our example
the output column.

An example of trace table is given below using a past How to write an


paper question:
Q: The flowchart below inputs the height of children
algorithm?
who want to ride on a rollercoaster. Children under
1.2 metres are rejected. The ride starts when eight
children have been accepted.

1.Make sure that the problem is clearly


understood which includes knowing the
purpose of the algorithm and the tasks to be
completed by the algorithm.
2.Break the problem into smaller problems (e.g. in a
program which outputs average values,
divide the problem into multiple ones i.e.
how to count the 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
Complete the trace table for the input data: 1.4, 1.3, can be easily read and understood by someone
1.1, 1.3, else. Take particular care with syntax e.g. when
1.0, 1.5, 1.2, 1.3, 1.4, 1.3, 0.9, 1.5, 1.6, 1.0 conditions are used for loops and selection.
6.Use several sets of test data (Normal, Abnormal
0 0 and Boundary) to dry run your algorithm and
1 1.4 check if the expected results are achieved
2 1.3 (a trace table can be used for this purpose) .
If error is found, find the point of error in the
1 1.1
trace table and fix it in the code.
3 1.3
2 1.0 The algorithms that you have looked at so far in
4 1.5 these notes were not designed with readability in mind
3 1.2 because you needed to work out what the problem
5 1.3 being solved was.
6 1.4
7 1.3 Validation and
4 0.9
8 1.5 Ready to go 4 Verification
To ensure the acceptance of reasonable and
1.5.Identifying errors: accurate data inputs, computer systems must
thoroughly examine each data item before accepting
it, and this is where Validation and Verification come

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
into play!

1.7. Validation
Validation in computer systems involves automated
checks to ensure the reasonableness of data before
accepting it. If the data is found to be invalid, the
system should provide an

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
explanatory message for rejection and allow for
A presence check checks to ensure that some data has
another chance to enter the data.
been entered and the value has not been left blank
\n
OUTPUT "Please enter the
Range check value " REPEAT
INPUT
A range check verifies that a numerical value falls Value IF
within specified upper and lower limits. Value = ""
THEN
REPEAT
INPUT Value OUTPUT
"*=Required " ENDIF
IF Value < MinimumValue OR Value >
UNTIL Value <> ""
MaximumValue THEN

Format Check
OUTPUT "The student's mark should be in the range", MinimumValue ," to ", MaximumValue
ENDIF A format check checks that the characters entered
conform
UNTIL Value >= MinimumValue AND Value <= MaximumValueto a pre-defined pattern

Length check Check Digit


This can either ensure that data consists of a precise
A check digit is the final digit included in a code;
number of characters.
it is calculated from all the other digits in the
OUTPUT "Please enter your value of ", Limit , " code.
characters " REPEAT Check digits are used for barcodes, product codes,
INPUT Value International Standard Book Numbers (ISBN) and
IF LENGTH(Value) <> Limit Vehicle Identification Numbers (VIN).
THEN
Verification
OUTPUT "Your value must be exactly" , Limit ," characters, please re-enter "
ENDIF Verification is checking that data has been accurately
UNTIL LENGTH(Value) = Limit copied from one source to another
( there
It can also check if the data entered is a reasonable are other methods during data transfer but they are
number of characters or not in paper 1)

OUTPUT "Please enter your value "


1. Double Entry \n
REPEAT
INPUT Value
Data is inputted twice, potentially by different
operators. The computer system compares both
entries, and if they
IF LENGTH(Value) > UpperLimit OR LENGTH(Value) < LowerLimit differ, an error message is displayed, prompting
for the
THEN data to be reentered.
OUTPUT "Too short or too long, please re-
enter " ENDIF 2. Screen/Visual check
UNTIL LENGTH(Value) <= UpperLimit AND LENGTH(Value) >= LowerLimit
A screen/visual check involves the user manually
Type check enter" ENDIF
UNTIL Value = DIV(Value, 1)
A type check verifies that the entered data corresponds
to a specific data type Presence check

OUTPUT "Enter the value "


REPEAT
INPUT Value
IF Value <> DIV(Value, 1)
THEN
OUTPUT "This must be a whole number, please re-

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
reviewing the entered data.
After data entry, the system displays the
data on the screen and prompts the user to
confirm its accuracy before proceeding.
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.

2. Programming
Concepts
2.1.Constructs of a program
Data use – variables, constants and
arrays Sequence – order of steps in
a task
Selection – choosing a path through a program

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
Iteration – repetition of a sequence of steps in a separated by a separator character.
program Operator use – arithmetic for
calculations, logical and
Boolean for decisions.
File Handling
Computer programs store data that will be needed
Variables and Constants
again in a file.
Data stored in RAM is volatile and will be lost when
A within a computer program refers to a
the
named storage unit that holds a value, which has the
computer is powered off.
potential to be modified throughout the program's
execution. To enhance comprehension for others, it is
advisable to assign significant names to variables.
A within a computer program represents a
named
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 assign meaningful
names to constants as well.

Data Types:
Different types of data are assigned to computer
systems for effective processing and storage.
Data types allow data to be stored appropriately,
such as numbers or characters.
Data types enable effective manipulation of
data using mathematical operators for numbers
and concatenation for characters.
Some data types provide automatic validation.
The types of datatypes are told in chapter 1
already!

Input and Output


Programs require input and output statements
to handle data.
In IGCSE Computer Science, algorithms and
programs are
designed to take input from a keyboard and
output to a screen.
Prompting the user with clear instructions for
input is necessary for the user to understand what
is expected.
Input data in programming languages must match
the
required data type of the variable where it will be
stored.
By default, inputs are treated as strings, but
commands can be used to convert input to
integer or real number data types, respectively.
In order for a program to be useful, users should
be provided with information about the
output/results.
Each output should be accompanied by a
message that explains the meaning or
significance of the result.
If an output statement has multiple parts, they can
be

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
Data saved to a file is stored permanently, systems often provide library routines that can
allowing it to be accessed by the same program be readily incorporated
at a later date or by other programs.
Stored data in a file can be transferred and used on
other
computers.
The storage of data in files is a commonly used
feature in programming.

\n There are 3 ways a file can be opened in a program


i.e. to write, to read and to append

2.2.Writing in a file
OPENFILE "filename.txt" FOR WRITE

//When opening a file to write, all the data


already existing

WRITEFILE "filename.txt" , Value

// The next command of WRITEFILE would be writen

on ne CLOSEFILE "filename.txt"

Appending a file
OPENFILE "filename.txt" FOR APPEND
//When data will be written now, the file would be
continue WRITEFILE "filename.txt" , Value
// The next command of WRITEFILE would be writen
on ne CLOSEFILE "filename.txt"

Reading a file:
OPENFILE "filename.txt" FOR
READ READFILE "filename.txt"
, Variable
// The value in the line (which is identified by the
number
CLOSEFILE "filename.txt"

Reading a file till EOF:


OPENFILE "filename.txt" FOR
READ DECLARE DataVariable :
STRING WHILE NOT
EOF("filename.txt) DO READFILE
"filename.txt", DataVariable
// here the line can be outputted or stored in an
array. Thi
//before the file ends has been
read ENDWHILE

Library routines
Programming language development

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
into programs. is an open-source, versatile programming
Library routines are pre-tested and ready for use, language that encourages quick program
making programming tasks easier. development and emphasizes code readability.
Integrated Development Environments (IDEs) The integrated
typically
include a standard library of functions and
procedures.
Standard library routines perform various tasks,
including string handling.
MOD – returns remainder of a division
DIV – returns the quotient (i.e. the whole number
part) of a division
ROUND – returns a value rounded to a given
number of decimal places
RANDOM – returns a random number.

Value1 <--- MOD(10,3) returns the remainder of


10 divided by 3
Value2 <---DIV(10,3) returns the quotient of 10
divided by
3
Value3 <- -ROUND(6.97354, 2) returns the value
rounded
to 2 decimal places
Value4 <- -RANDOM() returns a random number
between
0 and 1 inclusive

Creating a maintainable
program
A maintainable program should:

always use meaningful identifier names for variables


, constants , arrays, procedures and functions
be divided into modules for each task using
procedures and functions
be fully commented using your programming
language’s commenting feature

// Now the text written is commented and thus

ignored ""
This method can also be used to
comment multiple lines but the singular
line method
is more widely accepted and
reccomended too ""

Languages

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
development environment (IDE) showcased in maximum number of characters allowed is
this chapter is referred to as IDLE. specified by the programming language.
is a popular programming language Characters in a string can be identified by their
extensively used for Windows development. position number, starting from either zero or
The integrated development environment (IDE) one depending on the programming language.
featured in this chapter is known as Visual String handling is an important aspect of
Studio, which is utilized for capturing programming.
screenshots.
is a widely adopted programming language
utilized by numerous developers. The
integrated development environment (IDE)
employed for capturing screenshots in this
chapter is known as BlueJ.

Basic Concepts
When writing the steps required to solve a problem,
the following concepts need to be used and
understood:

Sequen
ce
Selectio
n
Iteration
Counting and
totalling String
handling
Use of operators.

2.6. Sequence
The ordering of the steps in an algorithm is very
important. An incorrect order can lead to incorrect
results and/or extra steps that are not required
by the task.

Selection
Selection is a very useful technique, allowing
different routes through the steps of a program.
The code of this is explained in the notes of
previous chapters

Iteration
Explained in the previous chapter already

Totalling and Counting


Explained in the previous chapter already

String Handling
Strings are used to store text and can contain
a varying number of characters.
An empty string has no characters, while the

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
In IGCSE Computer Science, you will need to write
any moment within a program to accomplish a
algorithms and programs for the following
particular task. Unlike a procedure, a function also
string methods:
has the capability to return a value back to the main
Length: Determines the number of
program.
characters in a
Parameters refer to variables that store the values of
string, including spaces.
arguments passed to a procedure or function. While not
Substring: Extracts a portion of a string.
all procedures and functions require parameters,
Upper: Converts all letters in a string to
some do utilize them to facilitate their operations.
uppercase. Lower: Converts all letters in a
string to lowercase.
These string manipulation methods are PROCEDURE ProcedureName ()
commonly
[Commands]
provided in programming languages through
ENDPROCEDURE
library routines.
//Calling/running the procedure
CALL ProcedureName()
LENGTH("Text Here")

LENGTH(Variable)
PROCEDURE ProcedureName (ParameterName :
Paramete [Commands]
ENDPROCEDURE
//Calling/running the procedure
SUBSTRING("Computer Science", 10, 7) CALL ProecdureName (ParameterValue)

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
// returns the next 7 values starting from the 10th value of t h e the string "Computer Science" i.e. "Science"
SUBSTRING(Variable, Position, Length)

FUNCTION FunctionName (ParameterName :


UCASE("Text here")
ParameterDa [Commands]
RETURN ValueToBeReturned
UCASE(Variable) ENDFUNCTION

When defining procedures and functions, the


LCASE("Text Here") is the first statement in the definition.
The header includes:
LCASE(Variable) The name of the procedure or function.
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,
Explained in the previous chapter already typically on the right-hand side.

Use of nested statements Local and Global Variable:

Selection and iteration statements can be nested, A global variable can be used by any part of a
meaning one statement can be placed inside program – its scope covers the whole program
another. A local variable can only be used by the part of the
program it
Nested statements help reduce code duplication and
has been declared in – its scope is restricted to that
simplify testing of programs.
part of the program.
Different types of constructs can be nested within
each other, such as selection statements within
condition- controlled loops, or loops within other
loops.

Procedures and functions DECLARE [VariableName] : DataType AS GLOBAL

A refers to a collection of programming


statements organized together under a single name,
Arrays
which can be invoked at any given point in a program
to execute a specific task. An array is a data structure containing several
A function is a compilation of programming elements of the same data type; these elements
statements consolidated under a singular name, which can be accessed
can be invoked at

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
using the same identifier name.
The position of each element in an array is NOT gate: an inverter, A
identified using the array’s index.
There are two types of arrays
0 1
1 0
2.7. One-Dimensional Array
Explained in previous chapter in detail

Two-Dimensional Array
AND gate: A.B
A two-dimensional array can be referred to as a
table, with rows and columns
0 0 0
0 1 0
1 0 0
1 1 1

OR gate: A + B

When a two-dimensional array is declared in


pseudocode, the first and last index value for rows
and the first and last index value for columns
alongside the data type are included.

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE

0 0 0
0 1 1
1 0 1
1 1 1

DECLARE Name:
ARRAY[RowLower:RowUpper,ColumnLower:ColumnUpper] NAND A.B
OF DATATYPE

0 0 1
0 1 1
FOR ColumnCounter ← 0 TO 2
1 0 1
FOR RowCounter ← 0 TO 9
1 1 0
OUTPUT "Enter next value "
INPUT ArrayName [RowCounter,
ColumnCounter] NEXT RowCounter
NEXT ColumnCounter

3. Boolean Logic
3.1.Logic Gates and their NOR gate: A + B
functions
Six types of logic gates

NOT
Gate
AND Gate
OR Gate
NAND Gate
NOR Gate
XOR Gate

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE

0 0 1
0 1 0
1 0 0
1 1 0

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE

XOR gate: A
ⒸB

0 0 0
0 1 1
1 0 1
1 1 0

is the logic statement for

Writing Logic
Statements
Logic Statements is a way of showing all the logics that
are in place for a logic circuit.

3.2.Writing from a logic circuit


1. Look at the ciruit and go around the logic gates
used in the circuit
2. Go from the one output that is being given
towards the input
3. Write the last gate ( the first gate you walk
through ) in the middle and then, for each of
the value coming into the gate, leave space at
the side
4. If the value coming into the gate is coming
from another gate, use a bracket for the
gate’s logic
5. Repeat process 3-4 till you are able to reach
the input values fully

Writing from a truth table


1. Create logic circuit fom the truth table (shown
later)
2. Write the logic statement using the ciruit

Writing from a Problem


statement
1. See what logics go in place in the statement
to take place
2. Go from the logic of any 2 inputs at the start,
and then keep on going until you are able to
reach the final gate which gives the output
3. When writing the statement, make sure you
show the
logic statement where the output is 1

Example of a LOGIC STATEMENT

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
Creating Truth Tables
3.3.From Logic Circuits
1.Create a truth table with each input possible,
creating
every possible combination of inputs .

2.Run through the circuit with the inputs


and get the output that will be reached
and write it accordingly

For logic statements, and problem


statements, convert them to logic
circuits first and then do the rest

Example
This is the example of a truth table of a logic circuit

The circuit:

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
the following Logic Circuit

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE

Logic Statements from according to their specific requirements. The data


contained within a database

Truth Tables

1. Given the truth table above, take the rows


where the output (x) is 1 (Rows 1, 2, 4, 5, 6,
7)
2. Create a logic expression from these rows
(example,
row 1 will be (NOT A AND NOT B AND NOT C) = X
3. Create logic expressions for all the rows with
output 1 and connect them with OR gate

Exam-Style Question

1. The Conditions are given so make logic


statements using the conditions and the table.
(NOT S AND T) OR (S AND W) OR (NOT T AND W)
2. Make the logic circuit from the given equation
3. Make the truth table

4. Databases
A database is a well-organized compilation of data
that enables individuals to retrieve information

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
can encompass various forms such as text, numerical table to ensure data input is a valid
values, images, or any other type of digital content date. \n
that can be stored on a computer system.
4.2.Basic Data Types
4.1.Why do we need a
database?
To store data about people, things, and events.
Any modifications or additions need to be
made only once, ensuring data consistency.
All users access and utilize the same set of data,
promoting uniformity.
Relational databases store data in a non-repetitive
manner, eliminating duplication.

What makes a database?


Data is stored in in databases. Each table
consists of a specific type of data e.g. cars.
These tables HAVE to be named according to
what they contain e.g. a table containing
patient information will be
These tables consist of (rows).
Each record consists of data about a
single entity (a single item, person or
event ) e.g. a single car
These tables also have columns that are knows an
.
These consist of specific information
regarding the entities that are written later in
records e.g. car name, car manufacturer etc.

You have to be able to


define a single-table database from given data
storage requirements, choose a suitable primary
key for a database table and also be able to read,
complete and understand SQL scripts.

Source: Cambridge IGCSE and O Level Computer Science


by Hodder Education

Validation in databases
Database management software
automatically provides some validation checks,
while others need to be set up by the developer
during construction.
For example; The software automatically
validates fields like "DateOfAdmission" in the

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
Each field will require a data type to be selected. A
SELECT (fieldsname)
data type classifies how the data is stored,
FROM (tablesname)
displayed and the operations that can be
WHERE (condition)
performed on the stored value.
ORDER BY (sortingcondition) ;
The datatypes for database are quite similar to
original
datatypes, however, there are a few differences.
SELECT SUM ( fieldsname
) FROM (tablesname)
WHERE (condition)
ORDER BY (sortingcondition) ;

is necessary.

4.3.Primary Key
Each record in a table represents a unique item,
person, or event.
To ensure reliable identification of these items, a
field
called the primary key is necessary.
The primary key is a unique field that
distinguishes each item within the data.
In order to serve as a primary key, a field must
have values that are never repeated within the
table.
An existing field can serve as a primary key if it is
unique, such as the ISBN in the book table.
In cases where all existing fields may contain
repeated data, an additional field, such as
"HospitalNumber," can be added to each record
to serve as the primary key.

4.4.Structured Query Language -


SQL
Structured Query Language (SQL) is the standard
language for writing scripts to retrieve
valuable information from databases.
By using SQL, we can learn how to retrieve and
display specific information needed from a
database.
For instance, someone visiting a patient may only
require
the ward number and bed number to locate
them in the hospital, while a consultant may
need a list of the names of all the patients under
their care. This can be done using SQL

SQL Scripts

An SQL script is a collection of SQL commands that


are used to perform a specific task, often stored in
a file for reusability.
To comprehend SQL and interpret the output of an
SQL
script, practical experience in writing SQL scripts

WWW.ZNOTES.O
CAIE IGCSE COMPUTER
SCIENCE
SELECT COUNT ( fieldsname )
FROM (tablesname)
WHERE (condition)
ORDER BY (sortingcondition) ;

==ORDER BY Field1, Field2, etc. – this specifies a sort in


ascending or alphabetical order starting with the first field.==
==ORDER BY Field1, Field2 DESC – this specifies a sort
in descending or reverse alphabetical order starting with
the first field.==
Note: ORDER BY is not necessary to add. It has to be only
added if required!

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.O
CAIE IGCSE
Computer Science

Copyright 2023 by ZNotes


These notes have been created by Abdullah Aamir and Abhiram Mydi for the 2023-2025 syllabus
This website and its content is copyright of ZNotes Foundation - © ZNotes Foundation 2023. All
rights reserved. 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 without the express,
written permission of the copyright owner. Under no conditions may this document be distributed
under the name of false author(s) or sold for financial gain; the document is solely meant for
educational purposes and it is to remain a property available to all at no cost. It is current freely
available from the website www.znotes.org
This work is licensed under a Creative Commons Attribution-NonCommerical-ShareAlike 4.0
International License.

You might also like