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

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

The document provides a comprehensive overview of the CAIE IGCSE Computer Science practical syllabus, focusing on the Program Development Life Cycle (PDLC) which includes analysis, design, coding, and testing. It covers essential programming concepts such as algorithm design, data types, variable declaration, and testing methodologies, including normal, abnormal, extreme, and boundary data. Additionally, it emphasizes the importance of validation and verification processes to ensure data accuracy and integrity in computer systems.

Uploaded by

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

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

The document provides a comprehensive overview of the CAIE IGCSE Computer Science practical syllabus, focusing on the Program Development Life Cycle (PDLC) which includes analysis, design, coding, and testing. It covers essential programming concepts such as algorithm design, data types, variable declaration, and testing methodologies, including normal, abnormal, extreme, and boundary data. Additionally, it emphasizes the importance of validation and verification processes to ensure data accuracy and integrity in computer systems.

Uploaded by

olarteromelita
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

ZNOTES.

ORG

UPDATED TO 2023-2025 SYLLABUS

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.

Coding and iterative testing

The program or set of programs is developed based on


the design.
Each module of the program is written using a suitable
programming language.
Testing is conducted to ensure that each module
functions correctly.
Iterative testing is performed, which involves conducting
modular tests, making code amendments if necessary,
and repeating tests until the module meets the required
functionality.

WWW.ZNOTES.ORG
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
Input & Output (READ & PRINT) – Used to receive and
display data to the user respectively. (It is recommended
to use input and output commands)

Declaration of variable - A variable/constant can be


declared by the following manner

DECLARE [Variable Name] : [DATATYPE OF VARIABLE]

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

Assignment - 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!
CASE…OF…

Pseudocode OTHERWISE…ENDCASE – Multiple conditions and

Declaration & Usage of Variables & Constants


Variable – Store of data which changes during
execution of the program (due to user input)
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.ORG
CAIE IGCSE COMPUTER SCIENCE

corresponding consequences \n

Standard methods used in algorithm:


Totalling :Totalling means keeping a total that values are
added to
Loop Structures:

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 is PassCount ← 0


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 running code ENDIF
NEXT Counter

Maximum, minimum and average : Finding the largest


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

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

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.

Test data refers to input values used to evaluate and


assess the functionality and performance of a computer
program or system.
It helps identify errors and assess how the program
handles different scenarios

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.

An example of trace table is given below using a past paper


How to write an algorithm?
question:
The ability to write an algorithm is very important for this
Q: The flowchart below inputs the height of children who want
syllabus and paper. Some key steps/points to be known in-
to ride on a rollercoaster. Children under 1.2 metres are
order to write the perfect algorithm are as follows:
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 can be
easily read and understood by someone else. Take
particular care with syntax e.g. when conditions are
used for loops and selection.
6. Use several sets of test data (Normal, Abnormal and
Complete the trace table for the input data: 1.4, 1.3, 1.1, 1.3, Boundary) to dry run your algorithm and check if the
1.0, 1.5, 1.2, 1.3, 1.4, 1.3, 0.9, 1.5, 1.6, 1.0 expected results are achieved (a trace table can be
Riders Reject Height OUTPUT used for this purpose) . If error is found, find the point
0 0 of error in the trace table and fix it in the code.

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 <> ""

THEN Format Check


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

Length check Check Digit

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

Different types of data are assigned to computer systems


for effective processing and storage.
WRITEFILE "filename.txt" , Value
Data types allow data to be stored appropriately, such as
numbers or characters.
// The next command of WRITEFILE would be writen on nex
Data types enable effective manipulation of data using
mathematical operators for numbers and concatenation
CLOSEFILE "filename.txt"
for characters.
Some data types provide automatic validation.
The types of datatypes are told in chapter 1 already! Appending a file
OPENFILE "filename.txt" FOR APPEND
Input and Output //When data will be written now, the file would be continue
WRITEFILE "filename.txt" , Value
Programs require input and output statements to handle
// The next command of WRITEFILE would be writen on nex
data.
CLOSEFILE "filename.txt"
In IGCSE Computer Science, algorithms and programs are
designed to take input from a keyboard and output to a
screen. Reading a file:
Prompting the user with clear instructions for input is
necessary for the user to understand what is expected. OPENFILE "filename.txt" FOR READ
Input data in programming languages must match the READFILE "filename.txt" , Variable
required data type of the variable where it will be stored. // The value in the line (which is identified by the number o
By default, inputs are treated as strings, but commands CLOSEFILE "filename.txt"
can be used to convert input to integer or real number
data types, respectively. Reading a file till EOF:
In order for a program to be useful, users should be
provided with information about the output/results. OPENFILE "filename.txt" FOR READ
Each output should be accompanied by a message that DECLARE DataVariable : STRING
explains the meaning or significance of the result. WHILE NOT EOF("filename.txt) DO
If an output statement has multiple parts, they can be READFILE "filename.txt", DataVariable
separated by a separator character. // here the line can be outputted or stored in an array. This
//before the file ends has been read
ENDWHILE
File Handling
Computer programs store data that will be needed again Library routines
in a file.
Data stored in RAM is volatile and will be lost when the Programming language development systems often
computer is powered off. provide library routines that can be readily incorporated

WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE

into programs. development environment (IDE) showcased in this


Library routines are pre-tested and ready for use, making chapter is referred to as IDLE.
programming tasks easier. Visual Basic is a popular programming language
Integrated Development Environments (IDEs) typically extensively used for Windows development. The
include a standard library of functions and procedures. integrated development environment (IDE) featured in
Standard library routines perform various tasks, including this chapter is known as Visual Studio, which is utilized for
string handling. capturing screenshots.
MOD – returns remainder of a division Java is a widely adopted programming language utilized
DIV – returns the quotient (i.e. the whole number part) of a by numerous developers. The integrated development
division environment (IDE) employed for capturing screenshots in
ROUND – returns a value rounded to a given number of this chapter is known as BlueJ.
decimal places
RANDOM – returns a random number.
Basic Concepts
Examples:
When writing the steps required to solve a problem, the
Value1 <--- MOD(10,3) returns the remainder of 10
following concepts need to be used and understood:
divided by 3
Value2 <---- DIV(10,3) returns the quotient of 10 divided by Sequence
3 Selection
Value3 <--- ROUND(6.97354, 2) returns the value rounded Iteration
to 2 decimal places Counting and totalling
Value4 <--- RANDOM() returns a random number between String handling
0 and 1 inclusive Use of operators.

Creating a maintainable 2.6. Sequence

program 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.
A maintainable program should:

always use meaningful identifier names for variables , Selection


constants , arrays, procedures and functions
be divided into modules for each task using procedures Selection is a very useful technique, allowing different routes
and functions through the steps of a program. The code of this is explained
be fully commented using your programming language’s in the notes of previous chapters
commenting feature

Commenting in pseudocode: Iteration


// Now the text written is commented and thus ignored Explained in the previous chapter already

"" Totalling and Counting


This method can also be used to comment
multiple lines but the singular line method Explained in the previous chapter already
is more widely accepted and reccomended too
""
String Handling

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

SUBSTRING(Variable, Position, Length)


Function:
Converting a string to upper case
FUNCTION FunctionName (ParameterName : ParameterDat
UCASE("Text here") [Commands]
RETURN ValueToBeReturned
UCASE(Variable) ENDFUNCTION

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.

Local and Global Variable:


Use of nested statements
A global variable can be used by any part of a program – its
Selection and iteration statements can be nested, scope covers the whole program
meaning one statement can be placed inside 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 part of
simplify testing of programs. the program.
Different types of constructs can be nested within each
Note: Any variables/arrays made in these procedure and
other, such as selection statements within condition-
functions will be local and cannot be used out of these. To be
controlled loops, or loops within other loops.
made available all over the program, they have to be
declared globally in the following way
Procedures and functions
DECLARE [VariableName] : DataType AS GLOBAL
A procedure refers to a collection of programming
statements organized together under a single name, which
can be invoked at any given point in a program to execute a
Arrays
specific task.
A function is a compilation of programming statements An array is a data structure containing several elements
consolidated under a singular name, which can be invoked at of the same data type; these elements can be accessed

WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE

using the same identifier name. NOT gate: an inverter, A


The position of each element in an array is identified
using the array’s index. A Output
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 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:

NAND gate: A.B


Filling a 2-D array using loop:
A B Output
FOR ColumnCounter ← 0 TO 2 0 0 1
FOR RowCounter ← 0 TO 9 0 1 1
OUTPUT "Enter next value "
1 0 1
INPUT ArrayName [RowCounter, ColumnCounter]
NEXT RowCounter 1 1 0
NEXT ColumnCounter

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

Creating Truth Tables


3.3. From Logic Circuits
Writing Logic Statements
1. Create a truth table with each input possible, creating
Logic Statements is a way of showing all the logics that are in every possible combination of inputs . Tip: For the first
place for a logic circuit. input, write it in the combination of 1,0,1,0 and so on.
For the second, go 1,1,0,0 and so on, and for the third
one, go 1,1,1,1,0,0,0,0 going by the powers of 2 for
3.2. Writing from a logic circuit
each input. This would guarantee each possible
combination
1. Look at the ciruit and go around the logic gates used in
2. Run through the circuit with the inputs and get the
the circuit
output that will be reached and write it accordingly
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
For logic statements, and problem statements,
the middle and then, for each of the value coming into convert them to logic circuits first and then do the
the gate, leave space at the side rest
4. If the value coming into the gate is coming from
another gate, use a bracket for the gate’s logic Example
5. Repeat process 3-4 till you are able to reach the input
values fully This is the example of a truth table of a logic circuit

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 The circuit:
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


(B AND C) OR (A NOR (A NAND C)) is the logic statement for
the following Logic Circuit

WWW.ZNOTES.ORG
CAIE IGCSE COMPUTER SCIENCE

can encompass various forms such as text, numerical values,


Logic Statements from Truth images, or any other type of digital content that can be stored
on a computer system.
Tables
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 tables in databases. Each table consists
of a specific type of data e.g. cars. These tables HAVE to
1. Given the truth table above, take the rows where the
be named according to what they contain e.g. a table
output (x) is 1 (Rows 1, 2, 4, 5, 6, 7)
containing patient information will be PATIENT
2. Create a logic expression from these rows (example,
These tables consist of records (rows). Each record
row 1 will be (NOT A AND NOT B AND NOT C) = X
consists of data about a single entity (a single item,
3. Create logic expressions for all the rows with output 1
person or event ) e.g. a single car
and connect them with OR gate
These tables also have columns that are knows an fields.
These consist of specific information regarding the
Exam-Style Question entities that are written later in records e.g. car name, car
manufacturer etc.

Note: In this chapter, skills of dealing with a database are also


required so working with Microsoft Access is needed to
understand this chapter better. 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
1. The Conditions are given so make logic statements
using the conditions and the table. (NOT S AND T) OR Validation in databases
(S AND W) OR (NOT T AND W)
2. Make the logic circuit from the given equation Database management software automatically provides
3. Make the truth table some validation checks, while others need to be set up by
the developer during construction.
For example; The software automatically validates fields
4. Databases like "DateOfAdmission" in the PATIENT table to ensure
data input is a valid date. \n
A database is a well-organized compilation of data that
enables individuals to retrieve information according to their
4.2. Basic Data Types
specific requirements. The data contained within a database

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:

SELECT SUM ( fieldsname )


FROM (tablesname)
WHERE (condition)
ORDER BY (sortingcondition) ;

Counting the number of records where the field matches a


Note: Access datatype refers to the software Microsoft
specified condition
Access which is a DBMS (DataBase Management System).
Here, databases could be worked upon in practical form SELECT COUNT ( fieldsname )
FROM (tablesname)
4.3. Primary Key WHERE (condition)
ORDER BY (sortingcondition) ;
Each record in a table represents a unique item, person,
==ORDER BY Field1, Field2, etc. – this specifies a sort in
or event.
To ensure reliable identification of these items, a field
ascending or alphabetical order starting with the first field.==
called the primary key is necessary. ==ORDER BY Field1, Field2 DESC – this specifies a sort in
descending or reverse alphabetical order starting with the
The primary key is a unique field that distinguishes each
first field.==
item within the data.
Note: ORDER BY is not necessary to add. It has to be only
In order to serve as a primary key, a field must have
values that are never repeated within the table.
added if required!
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 Operators
the ward number and bed number to locate them in the
hospital, while a consultant may need a list of the names Just like pseudocode, the operators used there can also be
of all the patients under their care. This can be done using used here for conditions, however, a few more are also used
SQL in databases

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 is
necessary.

Select Statements:

WWW.ZNOTES.ORG
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