IGCSE
IGCSE2.1.2Paper 2 — Algorithms, Programming and Logic
Sub-systems and Decomposition
Breaking a big problem into smaller pieces that can each be solved on their own.
TRACE TABLE
Total ← 0
FOR Count ← 1 TO N
Total ← Total + Count
NEXT Count
OUTPUT TotalSTARTN = 5
| Count | Total | OUTPUT |
|---|---|---|
One row per pass through the loop. Leave a cell blank if it does not change on that pass.
//Decomposing a problem
For any scenario, list four things: what goes IN, what must be DONE with it, what must be STORED, and what comes OUT. Doing this first turns a vague question into a plan you can code.
Problem: work out an average exam mark for a class
INPUT : each student's mark
PROCESS : total the marks, count them, divide
STORAGE : an array of marks
OUTPUT : the average, to 1 decimal place//Flowchart symbols
Learn the shapes — the wrong shape loses marks. Oval = start/stop. Parallelogram = input/output. Rectangle = process. Diamond = decision, with labelled Yes/No branches. Arrows show the flow.
CHECK YOURSELF
1.Which flowchart shape is used for a decision?
2.Decomposing a problem means splitting it into which four parts?