0% found this document useful (0 votes)
9 views

Computer Science IGCSE paper 2

The document provides a comprehensive overview of computer science topics, focusing on databases, programming concepts, and algorithm design. It covers database structures, data types, programming principles, and methods for data validation and verification. Additionally, it discusses pseudocode, flowcharts, and error types, offering insights into effective problem-solving and program design.

Uploaded by

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

Computer Science IGCSE paper 2

The document provides a comprehensive overview of computer science topics, focusing on databases, programming concepts, and algorithm design. It covers database structures, data types, programming principles, and methods for data validation and verification. Additionally, it discusses pseudocode, flowcharts, and error types, offering insights into effective problem-solving and program design.

Uploaded by

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

Computer Science Revision:

● Databases: Collection of data that is stored in a logical and organised manner.

Can be used for: medical records; search engines store data about websites; online
shops store product data; in schools data stored about students; libraries store book
data.

Advantages: electronically:
- Data easily stored in a specific way.
- Data found quickly.
- Data Filtered to retrieve only required.
- Data easily shared over internet or portable storage device.
- Data can be validated.
- Back-up copy can be made.
- Saves space compared to paper database.

- Database structure:
Table- structure in which data is stored
Flat file database- records stored in single table.
Record- collection of data about one single item (line).
Field- piece of data about an item (column).

- Data types: format of data in a field.


Text (alphanumeric)- characters or symbols.
Real- number that has decimal places.
Data/time- dates and times.
String (str): series of characters and symbols (text).
Character (char): single letter.
Integer (int): a whole number.
Real or Float: numbers that contain a decimal point or fractions.
Boolean: hold two possible values only (true/false, yes/no).

- Primary keys: a unique identifier for each record in a field, inside a database.
- Flat file database: all data is stored in one large table.
- Relational databases: a database that has several tables linked by primary key fields.
- Index: a list of values or items.
- Foreign key: a primary key that appears in another table in a relational database.

- Performing searches: a search in a database is known as a query.


Query: a method of searching a database.
SQL (Structured Query Language): a specialised programming language for
maintaining databases and generating queries.
Query by example: a method of searching a database by stating the criteria to
be searched.

- Data Validation: process of automatically checking whether the data entered is


possible realistic and sensible, does not make sure that the data is correct or not, it
eliminates the data that is unrealistic, this is done by making sure the data follows
certain rules (validation rules).
Eg: student scores 9.1 in exam, validation rule states a number between 0-10,
numbered entered is 1.9 which is incorrect but follows the rules.

● Programming Concepts:

- Variable: a storage location of a named value that contains data that can be changed
throughout a running program, can be used repeatedly throughout a program.
- Constant: a storage location of a named value that does not change during the
running of a program.
- Basic principles:
Algorithm: a set of instructions to solve a problem.
Sequence: instructions that occur one after another in a particular order.
Executed: a program that is run.
Selection: making a choice or decision in a program.
Interaction: repeating instructions in a program.
Condition loop: a state in a program where instructions will be met or not met.
Counting loop: a set of instructions set for a number of times.
Totalling: creates a total of something for a variable that can be updated.
Counting: a variable is counted when values are added to the count.

- Using predefined routines:


Predefined function: a pre-programmed set of instructions that return a value.
Library: a store of pre-programmed instructions that can be imported into a program.
Predefined procedure: a pre-programmed set of instructions that do not return a value.

- Array: a way of storing data that is all related and of the same type. Can be accessed
by referring to its location within it, each individual element has a location that can be
pointed to (these start at 0).
To create an array u need a variable that will store the array name, set the number of
elements the array will hold (specifying dimensions; once designed cannot be
changed) and define the type the array will hold.
- .append() = adds element.
- .clear() = clears the list.
- .copy() = returns a copy of the list.
- .count() = returns number of values in list.
- .extend() = extend list with other values.
- .index() = returns the index of the first element.
- .pop() = removes value at specific position.
- .remove() = removes item with specific value.
- .reverse() = reverses order of list.
- sort() = sorts the list.
- .update() = adds several items to the list.

Read: outputting data from an array so we can see it.


Write: inputting data into an array to store it.
Using loops: use of the FOR...TO...NEXT loop will read from or write values to an
array for a set number of times.

● Pseudocode and Flowcharts: are tools that a programmer may use to help design a
program or understand one.

- Pseudocode: a way of describing what happens in a computer program, a list of


instructions that show how the program will work, set out the same way as a
programming language but it isn’t one. There is no standard syntax (rules of a
language) in pseudocode, but covers a few (comments, variables, arrays, selection,
iteration, input and output, procedures and functions).

Comments: are written to state what a particular line or section of code is for. (#)

Variables: is a named location in memory that holds a data value (may change).

Arrays: a data structure that holds a collection of values of the same data type,
can be one dimensional or two dimensional (table). (between
parentheses). Tuple (ordered, unchangeable), sets (unordered, unindexed {}),
dictionaries (unordered, changeable, indexed {}).
- .fromkeys () = returns dictionary with specified keys and values.
- .get () = returns value of specifies key.
- .items () / .keys () = returns the key of item specified.

Counting: method to keep a record of how many times something has happened, variable
used to hold value of count that may be added or subtracted.

Totalling: process of keeping a running total of certain values in a program, value used to
hold the value of the total.
Selection: a statement that represents choice in an algorithm.
> greater than
< smaller than
Is a program that allows a program to follow different paths, the choice >= greater than or
of path is determined with conditions, whether they’re met or not. equal to
Condition- a state in a program that will be met or not <= smaller than or
equal to
IF...THEN...ELSE...ENDIF != not equal to
CASE...OF...OTHERWISE...ENDCASE (more specific than IF). == equal to
% what remains of

Number_of_Pets = input ('How many pets do you


own?')

CASE Number_of_Pets

CASE 0: print ("You should get a


pet.")
CASE 1: print ("What type of pet
do you have?")

Iteration: where a section of code is run repeatedly (3 different types of loops).


Count controlled loops- preformed a stated number of times.
FOR (...TO...NEXT) count = 1
DO
Condition controlled loops- continues until or
PRINT
while a condition is met. count
WHILE (...DO...ENDWHILE) WHILE Number
REPEAT (...UNTIL) > 9 DO FOR a = 1 TO 10
PRINT
'I am looping'
Input and Output:
USERINPUT- instruction waits for user to input something in and
then assigns that data to the named variable.
OUTPUT- shows something to the user.
READLINE- data can be input from a file, need to remember to specify the filename
WRITELINE- data can be output into a file, writeline overwrites a line in a file, if no line exists
one is created.

Procedures: a small section of code that can be run repeatedly from different parts of the
program, they do not return a value, all run using the CALL statement.
PROCEDURE...ENDPROCEDURE

Functions: a procedure that returns a value.


FUNCTION...RETURN...ENDFUNCTION

● Algorithm design and Problem-solving:

Subroutine: a short selection of code within a program.


Library routine: a collection of small commonly used programs and
subroutines that can be used in another program. Eg: can create
random numbers.
Top down design: a design process where an overall task is broken
down into smaller tasks. These subproblems can be broken down
even further into smaller sub-problems, this is called
decomposition.
Structure diagram: a diagram that shows tasks that have been
broken down and how they relate to each other.
Module: an individual section of code that can be used by other programs.
Abstraction: to examine a problem and identify the main details and the move the not
important.
Pattern recognition: being aware in any repetition in solving a task.

- Test data:
Normal (typical) - data that the code would be expected to expect. (If an integer
between 1-100 is expected, a number is expected to be entered.
Extreme data - also expected to expect, but within the boundary set.
Invalid (erroneous) - data that the code should not accept. (Entering a letter when a
number is expected, then an error message should appear).

- Verification: a check to see if the data entered is correct.


- Validation: an automatic check to make sure data is sensible and responsible.

Range check - specifies bounds that the data entered must be in (numerical).
Val:
Presence check - makes sure the field has data in.
Type check - specifies that only a certain type of data can be entered.
Lookup - Provides the user with a drop-down list to select data.
Length check - specifies that data entered has to have a certain number of
characters.
Ver: Double entry - the user enters the data twice. Computer checks if they both
match, if not they ask for the user to re-enter the data (passwords).
Twin entry - two users enter the same data separately. Computer checks to
see that both entries match, if not computer asks use to re-enter the data.
Proofreading - one user enters the data and the second user reads it, if okay
the data is accepted, otherwise the second user amends the data and then
submits it.

- Trace tables: a table used to trace the values of variables through the execution of the
program.
- Dry run: paper based run through an algorithm or program.
- Syntax error: an error occurs because the programmer does not use the correct
language structure in a program.
- Logic error: an error that causes a program to do something unexpected.

You might also like