Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
24 views

Structure Chart Questions 1-5

Uploaded by

devinzhang2008
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Structure Chart Questions 1-5

Uploaded by

devinzhang2008
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

1

2
1 (a) Three modules form part of a program for a car rental company. A description of the
relationship between the modules is summarised as follows:

Module name Description


A customer will pay for each car rental either by bank card or by using their
RentCar()
account with the rental company.
Called with parameter HireCost, representing the cost of the rental.
PayByCard() Returns a BOOLEAN value to indicate whether or not the card payment was
successful.
Called with parameters HireCost, AccountNumber, CurrentBalance
and AccountLimit. sent as parameter to a function
>
-
• Checks whether HireCost plus the CurrentBalance
- would exceed
PayByAccount() the AccountLimit. If so, then the rental is not authorised. -variable is being
reference
• If the rental is authorised, then the CurrentBalance is updated. pass by -

• Returns a BOOLEAN value to indicate whether or not the rental was


authorised.
15 marks)
Draw a structure chart to show the relationship between the three modules and the
parameters passed between them.

RentCar1) show
used to
& this is
a variable is being
that
referencee.
passed by
By Card
?
True False
Current
Hire cost ,
Hire
O
>0

O
Balance

> > module


name doesn't
cost need to be written
Account
·representing
7 M
solid number it question didn't
a Account ⑳
specify
with limit

*
arow is value
circle
bodean
a
Pay ByAccount()
PayByCard()

[5]
© UCLES 2020 9608/21/M/J/20 [Turn over
2
4

3
2 (a) The module headers for five modules in a program are defined in pseudocode as follows:

Pseudocode module header


FUNCTION Mod_V(S2 : INTEGER) RETURNS BOOLEAN -

L
PROCEDURE Mod_W(P4 : INTEGER)

always PROCEDURE Mod_X(T4 : INTEGER, BYREF P3 : REAL)


returns
S

PROCEDURE Mod_Y(W3 : REAL, Z8 : INTEGER)


a value
FUNCTION Mod_Z(F3 : REAL) RETURNS INTEGER
-

S
·

An additional module Head() repeatedly calls three of the modules in sequence.


-

A structure chart has been partially completed.

(i) Complete the structure chart to include the information given about the six modules.

Do not label the parameters and do not write the module names.

A
-

ro 8 o
mach
T
~

& murth
B C D

Funder E
I

F
n
P [3]

© UCLES 2022 9618/22/M/J/22


3
5

(ii) Complete the table using the information in part 3(a) by writing each module name to
replace the labels A to F.

Label Module name

A Head 11
B Mod-W
C mod-Y
D
-~
Mod
E Mod-2
F mod -
Y
[3]

(b) The structure chart represents part of a complex problem. The process of decomposition is
used to break down the complex problem into sub-problems.

Describe three benefits of this approach.

So that multiple groups of people can solve


1 ................................................................................................................................................

different tasks
...................................................................................................................................................
·

Problems can be examined in much detailed manner


2 ................................................................................................................................................
.

...................................................................................................................................................

to
small programs are easier
program .
3 ................................................................................................................................................

...................................................................................................................................................
5 [3]

32 (a) A structure chart is often used in modular program design. One feature shown is the sequence
of module execution.

State four other features that may be shown.

Hierarchy
Feature 1 ..................................................................................................................................

...................................................................................................................................................

parameters that are passed between


Feature 2 ..................................................................................................................................

modules-
...................................................................................................................................................

Decisions
Feature 3 ..................................................................................................................................

...................................................................................................................................................

Iteration
Feature 4 ..................................................................................................................................

...................................................................................................................................................
[4]

© UCLES 2022 9618/22/M/J/22 [Turn over


4
12

54 The module headers for three modules in a program are defined in pseudocode as follows:

Pseudocode module header


PROCEDURE Lookup(P4 : INTEGER, BYREF M4 : STRING)
FUNCTION Update(T4 : INTEGER) RETURNS INTEGER
FUNCTION Validate(S2 : INTEGER, P3 : STRING) RETURNS BOOLEAN

A fourth module, Renew(), calls the three modules in the following sequence.

Validate()
Lookup()
Update()

Draw a structure chart to show the relationship between the four modules and the parameters
passed between them.

Renew ()
7


o
M4 -

--
Th

ja
p4 ~ O
P3
·

~
W

Lookup() Update() Validate()

[7]

© UCLES 2019 9608/22/O/N/19


5
8

53 The following pseudocode represents three separate modules from an algorithm design. The
module contents are not shown.

FUNCTION Search(AA : INTEGER, BB : STRING) RETURNS INTEGER

ENDFUNCTION

FUNCTION Allocate() RETURNS BOOLEAN

ENDFUNCTION

PROCEDURE Enable(CC : INTEGER, BYREF DD : INTEGER)

ENDPROCEDURE

A fourth module, Setup(), refers to the previous three modules as follows:

PROCEDURE Setup()

WHILE Authorised = TRUE

ThisValue Search(27, "Thursday")

Authorised Allocate()

CALL Enable(ThisValue, 4)

ENDWHILE

ENDPROCEDURE

© UCLES 2019 9608/23/M/J/19


6
9

(a) Draw a structure chart to show the four modules and the parameters that these pass between
them.

[6]

(b) The algorithm is implemented in a high-level language. Changes are required and the
program is given to Albert, who is an experienced programmer. He is not familiar with the
language that has been used.

Explain why Albert would be able to understand the program.

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................. [2]

© UCLES 2019 9608/23/M/J/19 [Turn over

You might also like