Drawing a structure diagram from a scenario

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Drawing a structure diagram from a scenario

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Where do you write the name of the whole problem when drawing a structure diagram?
A In the bottom boxes
B In the top box
2. A washing machine program is the top box. Which is a sensible box on the next level down?
A Fill drum with water
B Washing machine
3. Which box name is clearer for a quiz game with scoring?
A Add 1 to score
B Do stuff
4. When do you stop splitting a box in a structure diagram?
A When the box is one simple task
B When the diagram fills the page
5. How should you build a structure diagram from a scenario?
A Start with the smallest tasks at random
B Start at the top and split level by level

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1Washing machine control program (top box) AThe whole problem is split into three sub-problems on the next level down
2Quiz game -> Ask questions, Check answers, Update score BThe whole problem is named in the top box of the structure diagram before it is split into sub-problems
3Keep splitting a box until it is one simple task, then stop CThe box names are vague, so nobody can tell what each sub-problem does. Use clear names such as Fill drum, Wash clothes and Spin dry.
4Use a clear box name that says what the box does DFill drum with water
5Washing machine -> Do things, Other stuff, Part 3 EThe diagram is split too far. Add 1 to score is already a simple task, so splitting it further adds nothing useful.
6Quiz game -> Add 1 to score -> Press the + key -> Move finger to key FUpdate score -> Add 1 to score (stop here)

Definitions

top-down design

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
PROCEDURE WashingMachine ____ FillDrum CALL Spin
2.
CALL AskQuestion CALL CheckAnswer PROCEDURE ___________
3.
PROCEDURE Spin OUTPUT "Drum spinning" ____________
4.
PROCEDURE AddScore score _ score + 10 ENDPROCEDURE
5.
_________ QuizGame CALL AskQuestion CALL AddScore

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A Program
B Ask questions
C Check answers
D Show final score
Question 2
A Washing machine program
B Fill drum with water
C Do things
D Spin and drain
Question 3
A Quiz game
B Ask questions
C score = score + 1
D Show final score
Question 4
A Washing machine program
B Rotate valve by 1 degree
C Wash clothes
D Drain and spin
Question 5
A Spin cycle
B Fill drum
C Wash clothes
D Spin dry

Answer Key

Drawing a structure diagram from a scenario
Section A: Quick Questions
Q1
B — In the top box
Q2
A — Fill drum with water
Q3
A — Add 1 to score
Q4
A — When the box is one simple task
Q5
B — Start at the top and split level by level
Section B: Match the Pairs
Q1
Washing machine control program (top box) → The whole problem is named in the top box of the structure diagram before it is split into sub-problems
Q2
Quiz game -> Ask questions, Check answers, Update score → The whole problem is split into three sub-problems on the next level down
Q3
Keep splitting a box until it is one simple task, then stop → Update score -> Add 1 to score (stop here)
Q4
Use a clear box name that says what the box does → Fill drum with water
Q5
Washing machine -> Do things, Other stuff, Part 3 → The box names are vague, so nobody can tell what each sub-problem does. Use clear names such as Fill drum, Wash clothes and Spin dry.
Q6
Quiz game -> Add 1 to score -> Press the + key -> Move finger to key → The diagram is split too far. Add 1 to score is already a simple task, so splitting it further adds nothing useful.
Section C: Definitions
Q1
top-down design — Name the whole problem in the top box, then split it into sub-problems level by level until each box is one simple task. Use clear box names.
Section D: Fill in the Blanks
Q1
PROCEDURE WashingMachine CALL FillDrum CALL Spin
Q2
CALL AskQuestion CALL CheckAnswer PROCEDURE CheckAnswer
Q3
PROCEDURE Spin OUTPUT "Drum spinning" ENDPROCEDURE
Q4
PROCEDURE AddScore score ← score + 10 ENDPROCEDURE
Q5
PROCEDURE QuizGame CALL AskQuestion CALL AddScore
Section E: Spot the Error
Q1
A — The top box must name the whole problem clearly. 'Program' is too vague. It should be something like 'Quiz game'.
Q2
C — 'Do things' is not a clear box name. A box should say exactly what the task is, such as 'Wash clothes'.
Q3
C — Box names in a structure diagram describe tasks in plain words. They are not lines of code. It should be 'Update score'.
Q4
B — This is far too detailed for a level 2 box. Split only as far as needed, so keep the box at the sub-problem level: 'Fill drum'.
Q5
A — The top box must name the whole problem, but 'Spin cycle' covers only one part. It should be 'Washing machine program'.