August
1997 QUESTION 1 (Compulsory) Total Marks: 20 Marks |
Click here to access other
questions
Click to access |
1. | (a) Create appropriate declarations for each of the following variables: | ||
(i) digits, an array of 10 integers. | [1] | ||
(ii) rates, an array of 6 floats. | [1] | ||
(iii) apc, an array of 20 pointers to characters. | [1] | ||
(iv) pacc, a pointer to an array of 20 characters | [2] | ||
(b) What is printed when the following program is executed? | [4] | ||
(c) The following function is supposed to find the average mark from an array of n marks in the range 0 to 100. Find, and correct the seven errors in its definition: | [7] | ||
(d) Write a function istriangle that takes three integers as its arguments, each representing the length of one of the sides of a triangle. The function should return 1 if the numbers form a valid triangle and 0 otherwise. Hint: the sum of any two sides must be greater than the third side. | [4] |