12.2 Program Design
AS Level · 1 question found
What this topic covers
Section titled “What this topic covers”- Structure charts: decompose into sub-tasks; show parameters between modules
- Construct a structure chart; derive pseudocode from a structure chart
- State-transition diagrams: purpose and how to use them
Past paper questions
Section titled “Past paper questions” Q7


7
Seven program modules form part of a program. A description of the relationship between the
modules is summarised below. Any return values are stated in the description.
Module name
Description
Mod-A
calls Mod-B followed by Mod-C
Mod-B
•
called with parameters Par1 and Par2
•
calls either Mod-D or Mod-E, determined when the program runs
•
returns a Boolean value
Mod-C
•
called with parameters Par1 and Par3
•
Par3 is passed by reference
•
repeatedly calls Mod-F followed by Mod-G
Mod-D
called with parameter Par2
Mod-E
•
called with parameter Par3
•
returns an integer value
Mod-F
called with parameter Par3
Mod-G
•
called with parameter Par3
•
Par3 is passed by reference
Parameters in the table are as follows:
•
Par1 and Par3 are of type string.
•
Par2 is of type integer.
(a) (i) Identify the modules that would be implemented as functions.
..................................................................................................................................... [1]
(ii) Modules Mod-F and Mod-G are both called with Par3 as a parameter.
In the case of Mod-F, the parameter is passed by value.
In the case of Mod-G, the parameter is passed by reference.
Explain the effect of the two different ways of passing the parameter Par3.
..................................................................................................................................... [2]
(b) Draw a structure chart to show the relationship between the seven modules and the
parameters passed between them.
[6]
,
,
,
,
Show mark scheme
7(a)(i) [2 marks]
Mod-B() and Mod-E()
7(a)(ii) [6 marks]
Points required:
1
any change made to the parameter value /
within
is
Par3
Mod-G()
reflected in the (subsequent) value in the calling module /
(after
Mod-C()
terminates)
Mod-G()
2
any change made to the parameter value /
within
is NOT
Par3
Mod-F()
reflected in the (subsequent) value in the calling module /
(after
Mod-C()
terminates)
Mod-F()
Mark as follows:
1 mark for a reasonable attempt to explain
2 marks for full explanation including context
1
any change made to the parameter value /
within
is
Par3
Mod-G()
reflected in the (subsequent) value in the calling module /
(after
Mod-C()
terminates)
Mod-G()
2
any change made to the parameter value /
within
is NOT
Par3
Mod-F()
reflected in the (subsequent) value in the calling module /
(after
Mod-C()
terminates)
Mod-F()
Mark as follows:
1 mark for a reasonable attempt to explain
2 marks for full explanation including context
7(b) [7 marks]
One mark per bullet:
1
All modules correctly labelled and interconnected
2
Parameters between Mod-A and Mod-B and return value from Mod-B
3
Parameters between Mod-A and Mod-C
4
Diamond applied to Mod-B only
5
Iteration arrow applied to Mod-C only
6
All parameters at lower level and return value
1
All modules correctly labelled and interconnected
2
Parameters between Mod-A and Mod-B and return value from Mod-B
3
Parameters between Mod-A and Mod-C
4
Diamond applied to Mod-B only
5
Iteration arrow applied to Mod-C only
6
All parameters at lower level and return value