Teachers' Portal  /  A-Level Computer Science 9618  /  Software development  /  Structure charts
Lesson pack · A-Level Computer Science 9618 · 12.2 · AS Level

Structure charts

Draw the modules. A structure chart is the map of a modular program.

Student lesson Lab, full screen
At a glance

The shape of the lesson

Topic
Software development
Syllabus reference
Cambridge International AS and A Level Computer Science 9618, 12.2
Level
AS Level
Duration
45 minutes, lab-led; stretches to a 60 minute block (see the contingency notes)
Position in topic
Lesson 2 of 5 in Software development; follows Program development life cycles; leads into State-transition diagrams
Central model
Fig. 1: a structure chart for a program that reads and validates 30 marks, totals them and outputs the average
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
  • Reading a structure chart: Read Fig. 1 from the top down and from left to right.
  • Building a chart: Start with one box for the whole problem.
  • Into pseudocode: Each box becomes a module header, and the arrows tell you its parameters.
Key points to leave on the board
  • Box: a module; a line down means "calls".
  • Hollow circle: data; filled circle: flag (Boolean).
  • Diamond: selection; curved arrow: iteration.
  • Pseudocode: one value up = FUNCTION; down and back up = BYREF; down only = BYVAL.
The core visual model

One picture every idea returns to

A structure chart is a top-down design diagram. Each rectangle is a module (a procedure or function); a line from a module to one below it means the upper module calls the lower one. Short arrows beside the lines show the parameters passed: an arrow with a hollow circle is data; an arrow with a filled circle is a flag (a Boolean). A diamond shows selection (only one of the modules below is called) and a curved arrow shows iteration (the modules are called repeatedly). It shows what each module does and what it needs, not how it does it.

ProcessMarks GetMarkUpdateTotalOutputAverage ValidateMark MarkMark, TotalTotal TotalMarkIsValid data parameter (data couple) flag (a Boolean value) iteration: called repeatedly
Fig. 1: a structure chart for a program that reads and validates 30 marks, totals them and outputs the average
Lesson sequence

Forty-five minutes, phase by phase

TimePhaseWhat happens in the roomGrouping
0 to 5 minHook: predictOpen with the question in the title, Draw the modules.. A structure chart is the map of a modular program. 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: Reading a structure chartRead Fig. 1 from the top down and from left to right.Whole class, then pairs
13 to 21 minTeach and check: Building a chartStart with one box for the whole problem. Model the worked example Decompose a problem on the board, one line at a time. Your turn: In Fig. 1, why does the arrow labelled Total pass both down to and up from UpdateTotal?Pairs
21 to 30 minTeach and check: Into pseudocodeEach box becomes a module header, and the arrows tell you its parameters. Project tab 5 of the lab (Procedures and functions in pseudocode) and let a student drive it while the class predicts. Your turn: On a chart, Length and Width pass down to a module CalcArea and Area passes up. Write the module header.Connect-Extend-Challenge
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, 16 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 Into pseudocode, 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

Connect-Extend-Challenge

After the new idea, each student writes three lines: how it connects to what they knew, how it extends their thinking, and what still challenges them. Pairs compare, then the challenges become the plenary.

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 chart does not show the detailed steps inside a module, and it is not a flowchart.If a question asks for a structure chart, draw boxes, lines and parameter arrows, not decision boxes and loops of code.
Every parameter arrow needs a label and a direction.An unlabelled arrow, or one with no circle to show data or flag, will not earn the mark.
A function is called inside an expression, never with CALL: write Mark ← GetMark(), not CALL GetMark().Procedures are called with CALL.
Worksheet

Structure charts: worksheet

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

NameClassDate
Q1 · recall[2 marks]

State the purpose of a structure chart.

Q2 · explain[2 marks]

Explain the difference between the two kinds of parameter arrow on a structure chart.

Q3 · apply[4 marks]

A program inputs a temperature in Celsius, converts it to Fahrenheit and outputs both. The main module is TempConvert. Describe a structure chart with modules InputTemp, Convert and OutputTemps, giving every parameter and its direction.

Q4 · write[4 marks]

On a structure chart, module ReadScores passes the array Scores up to the main module. Scores then passes down to module FindHighest, which passes Highest (an INTEGER) back up. Scores is ARRAY[1:50] OF INTEGER. Write pseudocode for FindHighest.

Q5 · analysis[2 marks]

In a structure chart, a curved arrow crosses the lines from module Main to modules GetItem and AddToBasket. Explain what this shows and how it appears in the pseudocode for Main.

Q6 · explain[2 marks]

Give two benefits of designing a program with a structure chart before coding it.

Answer key and marking notes
Q1 · 2 marks
  • To show how a problem is decomposed into modules / sub-tasks and the hierarchy of the modules (which module calls which).
  • To show the parameters (data and flags) passed between the modules.
Q2 · 2 marks
  • An arrow with a hollow circle is a data couple: a data value passed between modules.
  • An arrow with a filled circle is a flag: a Boolean value that tells the receiving module about a condition / controls what it does.
Q3 · 4 marks
  • TempConvert at the top, calling InputTemp, Convert and OutputTemps (left to right) below it.
  • Celsius passes up from InputTemp to TempConvert.
  • Celsius passes down to Convert; Fahrenheit passes up from Convert.
  • Celsius and Fahrenheit pass down to OutputTemps; all are data couples (hollow circles).
Q4 · 4 marks
  • Header: FUNCTION FindHighest(Scores : ARRAY[1:50] OF INTEGER) RETURNS INTEGER (accept an equivalent array parameter).
  • Initialise Highest ← Scores[1].
  • FOR Index ← 2 TO 50 with IF Scores[Index] > Highest THEN Highest ← Scores[Index] ENDIF, NEXT Index.
  • RETURN Highest, ENDFUNCTION.
Q5 · 2 marks
  • It shows iteration: GetItem and AddToBasket are called repeatedly (in that order).
  • In Main, the calls to GetItem and AddToBasket are inside a loop (e.g. WHILE / REPEAT / FOR).
Q6 · 2 marks
  • The problem is decomposed into modules that can be written and tested independently, possibly by different programmers.
  • The interfaces (parameters) between modules are agreed in advance, so the modules fit together / modules can be reused.
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

On a structure chart, a line joins module A to module B, which is drawn directly below it. What does this show?

  • AModule A calls module B
  • BModule B calls module A
  • CModules A and B run at the same time
  • DModule B must be written before module A
Q21 mark

Which of these is not shown on a structure chart?

  • AThe detailed steps and decisions carried out inside each module
  • BWhich modules are called by which other modules
  • CThe data and flags that are passed between the modules
  • DWhether some of the modules are called repeatedly
Q31 mark

Which statement about the structure chart in the figure is correct?

ProcessOrder GetItemsCalcTotalChooseDelivery StandardPostCourierPost ExpressTotalExpress
  • AGetItems and CalcTotal are called repeatedly; ChooseDelivery calls either StandardPost or CourierPost
  • BGetItems and CalcTotal are called repeatedly; ChooseDelivery calls StandardPost and then CourierPost
  • CStandardPost and CourierPost are called repeatedly; GetItems and CalcTotal are each called only once
  • DCalcTotal calls GetItems repeatedly; ProcessOrder chooses between ChooseDelivery and CalcTotal
Q41 mark

On a structure chart, Price (a data couple) and Member (a flag) pass down to module CalcDiscount, and Discount (a data couple) passes back up. Which pseudocode header matches?

  • AFUNCTION CalcDiscount(Price : REAL, Member : BOOLEAN) RETURNS REAL
  • BPROCEDURE CalcDiscount(BYVAL Price : REAL, Member : BOOLEAN)
  • CFUNCTION CalcDiscount(Discount : REAL) RETURNS BOOLEAN
  • DFUNCTION CalcDiscount(BYREF Price : REAL, Member : BOOLEAN) RETURNS REAL
Q51 mark

In the structure chart in the figure, Express passes down from ProcessOrder to ChooseDelivery and nothing passes back. Which header for ChooseDelivery matches the chart?

ProcessOrder GetItemsCalcTotalChooseDelivery StandardPostCourierPost ExpressTotalExpress
  • APROCEDURE ChooseDelivery(Express : BOOLEAN)
  • BFUNCTION ChooseDelivery() RETURNS BOOLEAN
  • CPROCEDURE ChooseDelivery(Express : STRING)
  • DFUNCTION ChooseDelivery(Express : BOOLEAN) RETURNS REAL
Q61 mark

This is the pseudocode for module Main.

PROCEDURE Main()
    DECLARE Choice : INTEGER
    REPEAT
        Choice ← GetChoice()
        IF Choice = 1 THEN
            CALL AddRecord()
        ELSE
            IF Choice = 2 THEN
                CALL DeleteRecord()
            ENDIF
        ENDIF
    UNTIL Choice = 0
ENDPROCEDURE
Which symbols must appear below Main on its structure chart?

  • AA curved arrow across the lines to all three modules, and a diamond where the lines to AddRecord and DeleteRecord leave Main
  • BOnly a diamond where the lines to AddRecord and DeleteRecord leave Main, because IF chooses which module runs
  • COnly a curved arrow across the lines to all three modules, because every call is inside the loop
  • DA flag with a filled circle for Choice coming up from GetChoice, and no other symbols at all
Quiz key
Q1: A

A line from a module down to a module below it means the upper module calls the lower one, so A calls B. The lower module never calls the one above it on the chart. The chart says nothing about running modules at the same time, and modules can be written in any order (stubs can stand in for those not yet written).

Q2: A

A structure chart shows the hierarchy of calls, the parameters (data couples and flags) passed between modules, and selection and iteration of calls. The detailed steps inside a module belong in pseudocode or a flowchart.

Q3: A

The curved arrow crosses the lines to GetItems and CalcTotal, so ProcessOrder calls them repeatedly. The diamond below ChooseDelivery shows selection: only one of StandardPost and CourierPost is called each time. Calling both ignores the diamond. The curved arrow is under ProcessOrder, not under the post modules. GetItems is drawn beside CalcTotal, not below it, so CalcTotal does not call it.

Q4: A

Two values go down (a REAL and a BOOLEAN flag) and exactly one value comes up, so it is a function with those parameters returning a REAL. A procedure with only BYVAL parameters cannot pass Discount back. The third header confuses what goes down with what comes up. The guide says parameters should not be passed by reference to a function.

Q5: A

The arrow points down and has a filled circle, so it is a flag (a BOOLEAN) passed in, and nothing comes back: a procedure with one BOOLEAN parameter (BYVAL by default). A function returning BOOLEAN would mean the flag passes up. A STRING ignores the filled circle, which marks a flag. Returning a REAL would need a data couple passing back up, and there is none.

Q6: A

All three calls are inside the REPEAT loop, so a curved arrow (iteration) crosses all three lines, and the IF means only one of AddRecord and DeleteRecord is called each pass, so a diamond (selection) is needed too. A diamond alone or a curved arrow alone misses one of the two constructs. Choice is an INTEGER, so it is a data couple (hollow circle), not a flag, and the other symbols would still be missing.

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 lessonProgram development life cycles