December
1998 QUESTION 2 Total Marks: 20 Marks |
Click here to access other
questions
Click to access
|
(a) | Identify the differences between call-by-value
and call-by-reference parameter passing.
|
[2] |
(b) | This question is concerned with the
implementation of routines that analyses a simple examination "pass mark"
database. The database can contain at most ClassSize records. The various database types you should use in your routines are
shown below. Const ClassSize
= 20;
|
|
(i) Define a function averageMark that takes two arguments: a pass mark
database; and an integer n (you can assume that n
|
[5] | |
(ii) Define a procedure markBand that takes as its arguments a database
of marks and an integer n (you can
assume that n
|
[6] | |
(iii) The designer of the database would like to
know may many "no-shows" there were for an examination. The designer decides to
use the DatabaseType representation
of a database, and uses a pass mark of zero to represent a no-show in the examination.
Explain why this solution is problematic, and describe the effect on the two functions averageMark and markBand.
|
[3] | |
(iv) Define a representation for the DatabaseType that provides a satisfactory
solution to the no-show problem.
|
[1] | |
(v) Using your new definition of DatabaseType, define a function candidates that takes as its arguments a database of marks, and returns the number of students who attempted the examination. | [3] |