CIE IGCSE Computer Science 0478 Practical Section Notes
Problem-solving and Design
Every computer system is constructed from various sub-systems, which are themselves composed of further sub-systems. Top-down design is the systematic process of breaking down a computer system into these sub-systems and continuing to subdivide each until every component performs only a single, discrete action. This hierarchy of design is diagrammatically represented using a structure diagram.
Test data refers to the complete set of data items required to evaluate a solution by inputting them into a program and comparing the output against expected results. Normal test data includes values like , which should be accepted by the system. Erroneous or abnormal test data includes entries such as , which the system must reject. Extreme test data constitutes the maximum and minimum acceptable values, such as and , which are accepted. Boundary test data evaluates values at the limits of acceptability, such as , which is accepted, and , which is rejected.
Validation is an automated process performed by a program to check that data is reasonable before it is accepted as input. Various types of validation exist: Range check ensures numbers fall within a specified range; Length check ensures data has an exact number of characters or a reasonable count; Type check verifies the specific data type; Character check ensures no invalid characters are present; Format check confirms data follows a specific pattern; and Presence check ensures data has been entered. Verification is the process of checking that data has been accurately copied or transferred within a system. This can be achieved through double entry, where data is entered twice and compared, or visual/screen checks, where a user manually compares the input against the source. Sub-routines are blocks of code that can be called by a main program, and functions are a specific type of sub-routine that return a single value. Trace tables are used to test algorithms to ensure no logical errors occur during processing.
Algorithm Representation through Pseudocode and Flowcharts
Algorithms, which are processes or sets of steps, are represented verbally through pseudocode and diagrammatically through flowcharts. Input and output operations involve the use of READ and PRINT or INPUT and OUTPUT. For example, a program may use OUTPUT "ENTER NAME" followed by INPUT NAME, then OUTPUT "HELLO", NAME. Alternatively, PRINT and READ can be used to achieve the same result. Variable assignment is indicated by a left-pointing arrow, such as .
Conditional statements control the flow of a program based on criteria. The IF...THEN...ELSE...ENDIF structure handles a single condition, where IF GRADE > 100 THEN OUTPUT "INVALID" ELSE OUTPUT "VALID" ENDIF. For multiple conditions, the CASE...OF...OTHERWISE...ENDCASE structure is used. For example, a CASE OF GRADE might include options where GRADE > 80 outputs "A", GRADE > 70 outputs "B", GRADE > 60 outputs "C", and OTHERWISE outputs "FAIL".
Loop structures facilitate repetition. The FOR...TO...NEXT loop runs for a predetermined number of times, following the syntax FOR [VARIABLE] \leftarrow [VALUE] TO [VALUE] [CODE] NEXT. The REPEAT...UNTIL loop executes code at least once before checking the condition at the end. Conversely, the WHILE...DO...ENDWHILE loop performs verification before the code is run, meaning it may not execute at all if the condition is not met.
Programming Concepts and Data Types
In programming, data stores include variables, where the value changes during execution typically due to user input, and constants, where the value remains unchanged. Basic data types include Integer (), Real (), Char (), String (text like "ZNotes" or "COOL"), and Boolean (values such as True/False, Yes/No, or ). Declarations follow the format DECLARE [VAR/CONST] AS [DATA TYPE] \leftarrow [VALUE].
Key programming concepts include sequence, where statements are executed in a specific order; selection, where data items are chosen based on criteria like finding the highest or smallest value; and repetition, which involves loops. Specific repetitive tasks include totaling, where a total is continually updated using , and counting, where a counter increments by 1 using .
Data Structures and Array Implementation
A data structure like an array is declared using the format DECLARE [NAME][1:n] AS [DATA TYPE], such as . A FOR loop is commonly used to read from or write to an array. For example, FOR I \leftarrow 1 TO 18 can be used to OUTPUT "GRADE OF STUDENT", I and then INPUT or OUTPUT the value at GRADE [I].
Database Management and Query-By-Example
Databases use specific data type names, particularly in Access where Real is referred to as Number, String as Text, and Boolean as Yes/No. A Primary Key is a field that uniquely identifies each record, such as a Student code in a school database. Query-By-Example (QBE) utilizes fields like Field Name, Table Name, Sort (Ascending A-Z or Descending Z-A), and Show (Checked/Present or Empty/Absent).
Text criteria in QBE include: "Contains" written as Like ("*x*"), "Does Not Contain" as Not like ("*x*"), "Begins With" as Like ("x*"), and "Ends With" as Like ("*x"). For alphabetical ordering, "Comes After" uses and "Comes Before" uses . Numerical criteria include: "Between" written as Between "x" and "y", "Less Than" using , "Less Than or Equal To" using , "Greater Than" using , and "Greater Than or Equal To" using .
Date criteria in QBE include: "Between" formatted as Between "#mm/dd/yyyy#" and "#mm/dd/yyyy#", "Before" using < "#mm/dd/yyyy#", and "After" using > "#mm/dd/yyyy#". The current date is identified by =Date(), and criteria for finding dates a specific number of days in the past uses .