IGCSE Computer Science Study Guide
Unit 7: Algorithm Design and Problem-Solving | Unit 9: Databases
How to use this guide: Learn the vocabulary, understand the examples, then practise explaining answers in full
sentences. Paper 2 rewards both correct technical knowledge and the ability to apply it to a given scenario.
Unit 7: Algorithm Design and Problem-Solving
1. Key Vocabulary
Term Meaning
Algorithm A step-by-step method for solving a problem.
Program development life The stages used to develop a program: analysis, design, coding and testing.
cycle (PDLC)
Analysis Understanding the problem, users, inputs, outputs, processes and storage needed.
Design Planning the solution using tools such as structure diagrams, flowcharts and
pseudocode.
Coding Writing the program in a programming language.
Testing Running the solution with test data to find errors and check it meets the requirements.
Decomposition Breaking a large problem into smaller sub-problems.
Abstraction Focusing on the important details and ignoring unnecessary details.
Structure diagram A diagram showing how a problem can be broken down into smaller sections.
Flowchart A diagram that uses standard symbols to show the steps in an algorithm.
Pseudocode A structured way of writing an algorithm that is similar to programming code but not
tied to one language.
Trace table A table used to dry-run an algorithm and record how variable values change.
Validation Checking that input data is sensible or allowed before it is accepted.
Verification Checking that data has been entered or copied correctly.
2. The Program Development Life Cycle
Stage What happens Typical exam focus
Analysis Identify the problem, users, requirements, inputs, State what data is needed and what
outputs, processes and storage. the system must do.
Design Plan the solution before coding. Use structure Create or interpret an algorithm.
diagrams, flowcharts, pseudocode and test plans.
Coding Translate the design into a high-level programming Understand how code follows the
language such as Python, Java or [Link]. algorithm.
Testing Use test data to check the program works and find logic Choose normal, abnormal, extreme
or syntax errors. and boundary test data.
3. Decomposition: Inputs, Processes, Outputs and Storage
When analysing a problem, separate it into four useful parts:
Part Question to ask Example: school canteen order system
Inputs What data must be entered? Student ID, item code, quantity.
Processes What calculations or decisions are Calculate total cost, check stock, apply discount.
needed?
Outputs What information must be shown or Receipt, error message, order total.
printed?
Storage What data must be saved? Menu items, prices, stock levels, orders.
4. Standard Algorithm Methods
Method Purpose Typical pattern
Totalling Add many values together. Start total at 0, then add each value to total.
Counting Count how many items meet a condition. Start count at 0, then add 1 when the
condition is true.
Finding maximum Find the largest value. Set max to the first value, then update it when
a larger value is found.
Finding minimum Find the smallest value. Set min to the first value, then update it when
a smaller value is found.
Average Calculate the mean. Total the values, count the values, then divide
total by count.
Linear search Find a value by checking items one by Compare each item with the search value
one. until found or the list ends.
Bubble sort Sort data by repeatedly comparing Compare pairs, swap if out of order, repeat
neighbouring items and swapping if passes.
needed.
Example: totalling and counting
total <- 0
count <- 0
FOR i <- 1 TO 10
INPUT mark
total <- total + mark
IF mark >= 50 THEN
count <- count + 1
ENDIF
NEXT i
OUTPUT total
OUTPUT count
Example: finding the maximum value
INPUT firstNumber
highest <- firstNumber
FOR i <- 2 TO 10
INPUT number
IF number > highest THEN
highest <- number
ENDIF
NEXT i
OUTPUT highest
5. Linear Search
A linear search checks each item in order until the target value is found or the list ends. It works on sorted or unsorted
data, but it can be slow for very large lists.
found <- FALSE
position <- 0
index <- 1
WHILE index <= 10 AND found = FALSE
IF names[index] = searchName THEN
found <- TRUE
position <- index
ELSE
index <- index + 1
ENDIF
ENDWHILE
IF found = TRUE THEN
OUTPUT "Found at position ", position
ELSE
OUTPUT "Not found"
ENDIF
6. Bubble Sort
A bubble sort compares neighbouring values and swaps them if they are in the wrong order. After each full pass, a
large value has moved towards the end of the list.
FOR pass <- 1 TO n - 1
Swapped <- FALSE
FOR index <- 1 TO n - pass
IF numbers[index] > numbers[index + 1] THEN
temp <- numbers[index]
numbers[index] <- numbers[index + 1]
numbers[index + 1] <- temp
swapped <- TRUE
ENDIF
NEXT index
IF (NOT swapped)THEN
EXIT FOR
NEXT pass
7. Validation and Verification
Check Meaning Example
Range check Checks a value is within allowed limits. A mark must be from 0 to 100.
Type check Checks data is the correct type. Age must be an integer.
Length check Checks the number of characters. A student ID must be 6 characters.
Presence check Checks data has been entered. Name cannot be blank.
Format check Checks data follows a pattern. A date must be DD/MM/YYYY.
Check digit Uses an extra digit to detect common input errors. Barcode or ISBN number.
Verification Checks data was copied or entered correctly. Double entry or visual check.
8. Test Data
Type of test data Meaning Example for age 11 to 16
inclusive
Normal Data that should be accepted and is not near a 13
boundary.
Abnormal Data that should be rejected. text, -2, 20
Extreme Valid data at the edge of the allowed range. 11 and 16
Boundary Values just below, at and just above the boundary. 10, 11, 16, 17
9. Trace Tables
A trace table is used to dry-run an algorithm. Write down the value of each variable every time it changes. This helps
you find logic errors and predict outputs.
total <- 0
FOR x <- 1 TO 4
total <- total + x
NEXT x
OUTPUT total
Step x total Output
Start - 0
1st loop 1 1
2nd loop 2 3
3rd loop 3 6
4th loop 4 10
End - 10 10
10. Common Exam Question Types for Unit 7
Question type What to do in your answer
State the purpose of an algorithm Describe the overall task, not every line.
Complete pseudocode Follow the pattern already given and use correct conditions, loops and
variables.
Complete a trace table Update variables carefully line by line.
Identify an error Say what is wrong and how to correct it.
Choose test data Include normal, abnormal, extreme and boundary data where suitable.
Explain validation or verification Name the check and link it to the scenario.
11. Unit 7 Practice Questions
1. List the four stages of the program development life cycle in order.
2. Explain the difference between analysis and design.
3. A ticket system needs name, age and ticket type. Identify two inputs, one process and one output.
4. Explain why decomposition is useful when designing a solution.
5. Write pseudocode to input 10 numbers and output the total.
6. Write pseudocode to count how many of 20 entered marks are greater than or equal to 50.
7. Explain how a linear search works.
8. Explain why a bubble sort needs repeated passes through the data.
9. Give normal, abnormal, extreme and boundary test data for a score from 0 to 100 inclusive.
10. Complete a trace table for a loop that adds the numbers 1 to 5.
12. Unit 7 Quick Exam Tips
When the question asks... A strong answer should...
Explain the purpose of an algorithm State the overall job of the algorithm and refer to the context.
Describe a process Mention the important variables, decisions and loops, but do not just
copy every line.
Identify a logic error Say what result the error causes and give a corrected line or condition.
Suggest test data Give actual values and say whether each value should be accepted or
rejected.
Complete pseudocode Use the same variable names and style already used in the question.
Use a trace table Work slowly, update one line at a time, and do not skip loop counter
changes.
Useful sentence starters: “This algorithm is used to ...”, “The condition checks whether ...”, “This validation check is
suitable because ...”, “The boundary values are ... because ...”.
Unit 9: Databases
1. Key Vocabulary
Term Meaning
Database An organised collection of related data.
Table Data arranged in rows and columns.
Record One complete row in a table.
Field One category of data, shown as a column.
Primary key A field that uniquely identifies each record in a table.
Foreign key A field in one table that refers to the primary key in another table.
Data type The kind of data stored in a field, such as integer, real, text, character, Boolean or
date/time.
Query A command used to search, filter, sort or process data in a database.
Selection Choosing records that match criteria.
Projection Choosing which fields/columns to display.
Sort Arranging records into order.
Validation Checking input data is sensible or allowed.
2. Tables, Records and Fields
A database table stores related data. Each row is a record and each column is a field.
StudentID FirstName Class House
S001 Mina 10A Red
S002 Ken 10B Blue
S003 Anya 10A Green
In this table, StudentID is a suitable primary key because it should be unique for every student. FirstName is not
suitable because more than one student may have the same first name.
3. Data Types
Data type Used for Example
Integer Whole numbers. 42
Real Numbers with decimals. 12.75
Text/String Words, names or codes that may include letters and S001, Chiang Mai
numbers.
Character A single character. M, F, Y
Boolean Only two possible values. TRUE/FALSE, Yes/No
Date/Time Dates and times. 01/06/2026, 08:30
4. Designing a Single-Table Database
For IGCSE, you should be able to design a simple database table for a given scenario. Your design should include
sensible field names, data types and a primary key.
Field name Data type Reason
BookID Text Primary key. It can include letters and numbers, such as
B001.
Title Text Book titles contain words.
Author Text Author names contain words.
YearPublished Integer The year is a whole number.
Available Boolean The book is either available or not available.
5. Primary Keys and Foreign Keys
A primary key uniquely identifies a record. A foreign key links one table to another table by storing a value from the
other table's primary key.
Students table Borrowing table
StudentID (primary key) BorrowID (primary key)
FirstName StudentID (foreign key)
Class BookID
The StudentID in the Borrowing table links each borrowing record back to one student in the Students table.
6. Validation in Databases
Validation check Database example
Presence check StudentID must not be left blank.
Range check A score must be between 0 and 100.
Type check Quantity must be an integer.
Length check A product code must be exactly 5 characters.
Format check A date must follow DD/MM/YYYY.
List check House must be Red, Blue, Green or Yellow.
7. Query Concepts
Concept Meaning Example
Projection Choose which fields to display. Show only Name and Price.
Selection Choose records matching a condition. Show only items where Type = "Fruit".
Sorting Arrange records into order. Order prices from highest to lowest.
Criteria The condition used in a query. Price < 1.00
8. SQL-Style Query Keywords
Keyword Purpose
SELECT Choose which fields/columns to show.
FROM Choose which table to use.
WHERE Filter records using a condition.
AND Both conditions must be true.
OR At least one condition must be true.
ORDER BY Sort the results.
ASC Ascending order: A-Z or low-high.
DESC Descending order: Z-A or high-low.
LIMIT Limits the number of rows displayed in the result
JOIN Combines two tables - useful when columns from different tables are needed
9. Example Table and Queries
ProductID Item Type Price Stock
P001 Apple Fruit 0.80 30
P002 Banana Fruit 0.50 60
P003 Carrot Vegetable 0.40 80
P004 Broccoli Vegetable 1.20 20
P005 Mango Fruit 1.50 15
Show all fruit items:
SELECT Item, Price
FROM Products
WHERE Type = "Fruit"
Show items with low stock, sorted from lowest stock to highest stock:
SELECT Item, Stock
FROM Products
WHERE Stock < 25
ORDER BY Stock ASC
Show fruit that costs less than 1.00:
SELECT Item, Price
FROM Products
WHERE Type = "Fruit" AND Price < 1.00
10. Common Query Mistakes
Mistake Why it is wrong Better approach
Using AND when OR is AND only returns records where both Use OR when either condition is
needed conditions are true. acceptable.
Sorting in the wrong ASC and DESC give different orders. Use ASC for low-high/A-Z, DESC for
direction high-low/Z-A.
Choosing the wrong field The answer may display unnecessary or Check which fields the question asks to
missing information. output.
Comparing text incorrectly Text values usually need quotation marks. Use Type = "Fruit" rather than Type =
Fruit.
11. Common Exam Question Types for Unit 9
Question type What to do in your answer
Identify fields and records Remember: fields are columns; records are rows.
Choose a primary key Pick a unique field that is not normally repeated or blank.
Suggest data types Match the data type to the values that need to be stored.
Design a table Include field names, data types and a primary key.
Explain validation Name a suitable check and link it to the field.
Write or interpret a query Identify the table, fields, criteria and sorting.
12. Unit 9 Practice Questions
11. Explain the difference between a field and a record.
12. Why is StudentID a better primary key than FirstName?
13. Suggest suitable data types for ProductID, Price, Stock and Available.
14. A library database stores books. Suggest five fields and identify a primary key.
15. Give a suitable validation check for a test score from 0 to 100.
16. Explain the difference between selection and projection in a query.
17. Write a query to show item and price for all vegetables.
18. Write a query to show item and stock for products with stock below 25, sorted by stock ascending.
19. Explain what a foreign key is used for.
20. Explain one reason why validation does not prove that data is correct.
Final Revision Checklist
Unit 7: Algorithm Design Unit 9: Databases
Know the four PDLC stages and what happens in each. Define database, table, field and record.
Break problems into inputs, processes, outputs and Choose suitable primary keys and explain why.
storage.
Interpret and write pseudocode and flowcharts. Choose suitable field names and data types.
Use standard methods: total, count, average, max, min, Explain validation checks for database fields.
linear search and bubble sort.
Complete trace tables accurately. Understand selection, projection, criteria and sorting.
Choose normal, abnormal, extreme and boundary test Write and interpret SQL-style queries using SELECT,
data. FROM, WHERE, AND, OR and ORDER BY.