August
1997 QUESTION 1 (Compulsory) Total Marks: 20 Marks |
Click here to access other
questions
Click to access |
1. | (a) Briefly explain the following terms: | ||
(i) recursive procedure | [2] | ||
(ii) queue | [2] | ||
(iii) abstraction | [2] | ||
(iv) black box testing | [2] | ||
(v) binary search | [2] | ||
(b) Write a Pascal type definition that models the following data-structure: | [3] | ||
(c) Pascal does not contain a power operator (i.e., xy). Write a function power that takes two parameters x and y and calculate xy. You need not use recursion in the definition of power. | [3] | ||
(d) Use the function power in the definition of a recursive function addPower that takes a single positive integer value n as a parameter, and returns an integer that is the sum of the following series: | [4] | ||
f(n) = 11 + 22 + 33 + . . . + nn |