Teachers' Portal  /  IGCSE Computer Science 0478  /  Algorithm design and problem-solving  /  Decomposition, structure diagrams, flowcharts and pseudocode
Lesson pack · IGCSE Computer Science 0478 · 7 (1-2) · IGCSE

Decomposition, structure diagrams, flowcharts and pseudocode

Big problems, small parts. Every computer system is made of sub-systems, and each sub-system is made of smaller ones.

Student lesson Lab, full screen
At a glance

The shape of the lesson

Topic
Algorithm design and problem-solving
Syllabus reference
Cambridge IGCSE Computer Science 0478, 7 (1-2)
Level
IGCSE
Duration
45 minutes, lab-led; stretches to a 60 minute block (see the contingency notes)
Position in topic
Lesson 2 of 9 in Algorithm design and problem-solving; follows The program development life cycle; leads into Standard methods: linear search and bubble sort
Central model
Fig. 1: a structure diagram for a quiz program, decomposed into two levels of sub-systems
Cooperative structure
Assessment
Stage 1 check and the exam-style plenary from the student lesson, plus the worksheet as the exit task
Learning objectives

By the end of the lesson, learners can

Section by section
  • Systems and sub-systems: A games console is one system, but inside it are a controller sub-system, a graphics sub-system, a storage sub-system and more.
  • Flowchart symbols: A flowchart shows each step of an algorithm in order.
  • Pseudocode and an algorithm's purpose: Pseudocode writes the steps as structured code that is not tied to any one language.
Key points to leave on the board
  • Decompose: inputs, processes, outputs, storage.
  • Structure diagram: the hierarchy of sub-systems; no order or decisions.
  • Flowchart: terminator, process, input/output, decision, subroutine, flow lines.
  • Purpose: say what the algorithm is for in its context, then describe the processes.
The core visual model

One picture every idea returns to

Every computer system is made up of sub-systems, which are made up of further sub-systems. Decomposition breaks a problem into its component parts: inputs, processes, outputs and storage. A solution can be designed with a structure diagram (the hierarchy of sub-systems), a flowchart (the steps, using standard symbols) or pseudocode (the steps written as structured code).

Quiz program Set up quizAsk questionsShow result Display questionInput answer Check answerUpdate score each level breaks a task into smaller sub-tasks (sub-systems)
Fig. 1: a structure diagram for a quiz program, decomposed into two levels of sub-systems
Lesson sequence

Forty-five minutes, phase by phase

TimePhaseWhat happens in the roomGrouping
0 to 5 minHook: predictOpen with the question in the title, Big problems, small parts.. Every computer system is made of sub-systems, and each sub-system is made of smaller ones. Put the figure on the board: it is the one picture every idea in the lesson returns to.Whole class, then pairs
5 to 13 minTeach and check: Systems and sub-systemsA games console is one system, but inside it are a controller sub-system, a graphics sub-system, a storage sub-system and more. Model the worked example Decompose a problem on the board, one line at a time.Whole class, then pairs
13 to 21 minTeach and check: Flowchart symbolsA flowchart shows each step of an algorithm in order. Your turn: Which flowchart symbol would you use for each step: (a) OUTPUT "Too high"; (b) Score >= 50?; (c) Count ← Count + 1?Pairs
21 to 30 minTeach and check: Pseudocode and an algorithm's purposePseudocode writes the steps as structured code that is not tied to any one language. Project tab 1 of the lab (Run a pseudocode program) and let a student drive it while the class predicts. Model the worked example State the purpose on the board, one line at a time.Frayer Model
30 to 36 minCheckThe four Stage 1 questions from the student lesson, answered on mini whiteboards or by show of fingers. Re-teach the one most get wrong.Individual, then whole class
36 to 43 minPlenaryThe exam-style questions from Stage 2, one at a time: thirty seconds alone, then a random call. The feedback lines in the key give the examiner's wording.Individual, random call
43 to 45 minExit and homeworkSet the worksheet below (6 questions, 17 marks). Learners self-assess against the objectives before they leave.Individual
Timing and contingency

Protect the parts that carry the learning

The sequence carries about fifty minutes of material, so the lab is driven by one student while the class predicts rather than explored freely. Times are a guide.

Protected: the check at 30 minutes. It is the only individual read on whether the key idea landed, and it is not cut.

Cut first if the build overruns: the last check in Pseudocode and an algorithm's purpose, never the check or the plenary.

In a 60 minute block: run worksheet questions 1 to 3 in class as a Rally Coach set and model both the hardest worked example and its check live.

Running the cooperative task

Frayer Model

Pairs fill a four-box grid for the key term: definition, characteristics, examples and non-examples. The non-examples box is where the misconceptions surface, so give it the most time.

The full structure, with its variations and the other twelve, is on the cooperative-learning page.

Examiner traps to pre-empt

What to head off, and how

Trap learners fall intoTeaching move that pre-empts it
A structure diagram is not a flowchart.It has no decisions, loops or arrows showing order: it only shows how the system is divided into sub-systems.
Every decision diamond needs exactly two exits, and both must be labelled (Yes/No or True/False).Missing labels lose marks.
"It inputs numbers and outputs a number" is not a purpose.State what the algorithm is for, using the context: counting freezing days, finding the highest score, and so on.
Worksheet

Decomposition, structure diagrams, flowcharts and pseudocode: worksheet

6 questions, 17 marks. Written in the style of the papers; no past paper question is reproduced.

NameClassDate
Q1 · recall[4 marks]

Draw and name the flowchart symbols used for: (a) the start of a flowchart; (b) Total ← Total + Price; (c) OUTPUT Total; (d) Price > 100?

Q2 · apply[4 marks]

A smart thermostat keeps a room at a temperature chosen by the user. Identify one input, one process, one output and one item of storage.

Q3 · apply[3 marks]

A program for a school canteen lets students order lunch. Draw a structure diagram with the top-level box "Canteen ordering" and three sub-systems below it.

Q4 · explain[2 marks]

State the purpose of this algorithm.

Total ← 0
FOR Day ← 1 TO 7
    INPUT Steps
    Total ← Total + Steps
NEXT Day
OUTPUT Total
Q5 · explain[2 marks]

Explain one difference between a structure diagram and a flowchart.

Q6 · analysis[2 marks]

A student draws a flowchart in which a decision diamond Age >= 18? has only one line coming out of it. Explain the error and how to correct it.

Answer key and marking notes
Q1 · 4 marks
  • (a) Terminator: rounded rectangle.
  • (b) Process: rectangle.
  • (c) Input/output: parallelogram.
  • (d) Decision: diamond (with two labelled exits).
Q2 · 4 marks
  • Input: the temperature from the sensor (or the temperature chosen by the user).
  • Process: compare the room temperature with the chosen temperature.
  • Output: switch the heater on or off (or show the temperature on a display).
  • Storage: the chosen (target) temperature.
Q3 · 3 marks
  • Top box "Canteen ordering" joined by lines to the boxes below it.
  • Three sensible sub-systems, e.g. Log in, Choose meal, Pay.
  • Drawn as a hierarchy (boxes and lines, no arrows or decisions).
Q4 · 2 marks
  • It inputs the number of steps walked on each of 7 days.
  • It adds them up and outputs the total number of steps for the week.
Q5 · 2 marks
  • A structure diagram shows how a system is decomposed into sub-systems (a hierarchy).
  • A flowchart shows the order of the steps of an algorithm, including decisions and loops.
Q6 · 2 marks
  • A decision must have two exits, one for each outcome.
  • Add a second flow line and label the two exits Yes and No (True and False).
Quiz

6 multiple-choice questions on this lesson

From the topic question bank. Assign them in the app for a marked score in your gradebook, or run the topic as a class game.

Q11 mark

Which flowchart symbol is used for the step Total ← Total + Price?

  • Aa process (rectangle)
  • Ban input/output (parallelogram)
  • Ca decision (diamond)
  • Da terminator (rounded rectangle)
Q21 mark

A smart doorbell recognises family members' faces. Which of these is a process in the system?

  • Acomparing the visitor's face with the stored images
  • Bthe video captured by the doorbell camera
  • Can alert sent to the owner's phone
  • Dthe saved photos of each family member
Q31 mark

Which statement about a structure diagram is correct?

  • AIt shows how a system is broken down into sub-systems, level by level
  • BIt shows the order of the steps with arrows between them
  • CIt uses diamonds to show where decisions are made
  • DIt is the steps of an algorithm written as structured code
Q41 mark

What is the purpose of this algorithm?

Count ← 0
FOR Pupil ← 1 TO 30
    INPUT Mark
    IF Mark >= 40
      THEN
        Count ← Count + 1
    ENDIF
NEXT Pupil
OUTPUT Count

  • AIt counts and outputs how many of 30 pupils scored 40 or more
  • BIt adds up and outputs the marks of 30 pupils that are 40 or more
  • CIt counts and outputs how many of 30 pupils scored less than 40
  • DIt outputs each mark of 40 or more as soon as it is input
Q51 mark

What value is output by the algorithm in this flowchart?

START Total ← 0Count ← 1 Count > 4? OUTPUT Total STOP Total ← Total + Count * 2 Count ← Count + 1 YesNo
  • A20
  • B12
  • C30
  • D10
Q61 mark

A student's flowchart draws INPUT Age in a rectangle, followed by a diamond Age >= 18? whose two exits are labelled Yes and No. What should be corrected?

  • ADraw INPUT Age in a parallelogram
  • BDraw the decision in a rectangle
  • CRemove the Yes and No labels
  • DDraw INPUT Age in a terminator
Quiz key
Q1: A

A calculation or assignment goes in a process rectangle. The parallelogram is only for INPUT and OUTPUT, the diamond is for a question with two exits, and the terminator marks START and STOP.

Q2: A

Comparing the face with stored images is a process: data is worked on. The camera video is an input, the alert to the phone is an output and the saved photos are storage.

Q3: A

A structure diagram is a hierarchy of the system and its sub-systems. Arrows showing the order of steps and decision diamonds belong to flowcharts, and steps written as structured code are pseudocode.

Q4: A

Count increases by 1 (not by Mark) whenever Mark >= 40, and is output once after the loop, so the algorithm counts the pupils scoring 40 or more. Adding the marks would need Count ← Count + Mark. The condition is >= 40, not < 40. The OUTPUT is after NEXT, so individual marks are never output.

Q5: A

Count takes the values 1, 2, 3 and 4 in the loop, adding 2, 4, 6 and 8 to Total, which gives 20. When Count becomes 5, Count > 4 is Yes and Total is output. Stopping after Count = 3 gives 12; carrying on to Count = 5 gives 30; adding Count instead of Count * 2 gives 10.

Q6: A

Inputs and outputs use the parallelogram, so INPUT Age is in the wrong symbol. The decision is correctly drawn as a diamond with two labelled exits, so changing it or removing the labels would introduce errors. A terminator is only for START and STOP.

Lab and demo

What to project

The student lesson embeds these tabs. Open them full screen on the projector; every slider has a drag handle on the stage.

Slides

Slides for this lesson

A projectable deck for every pack is on the way. Until then, present the student lesson full screen: its sections, figure and lab tabs follow the same order as the plan above.

Also for this topic

Everything else you can use

Original work by the TheLucidSTEM team. The worksheet items are written in the style of the papers; no past paper question is reproduced.
Previous lessonThe program development life cycle