April
1999 QUESTION 1 Total Marks: 20 Marks |
Click here to access other
questions
Click to access
|
(a) | Name two type modifiers other than signed.
|
[2] |
(b) | Name two storage class modifiers other
than const.
|
[2] |
(c) | Create appropriate declarations for each of the following variables: | |
(i) digits, an array of 15 short integers. | [1] | |
(ii) decimals, an array of 5 floats which may have their value implicitly changed, and therefore should not be optimized. | [1] | |
(iii) apc, an array of 20 pointers to characters.
|
[1] | |
(d) | Trace the following code segment and write down
the output produced: void main(void) {
|
[4] |
(e) | Trace the following code segment and write down
the output produced: void main(void) { printf("b+c*a = %d\n", b+c*a); }
|
[4] |
(f) | Informatics requires a function which will
calculate the average mark for a group of students in an exam. Marks are all whole numbers
in the range 0..60, and are stored in integer arrays. Write a function, which builds on the prototype given below, which takes two parameters - the integer array and a specifier representing the size of an array - and will return the average mark of all those stored in the array. Note that although the marks which are passed into the array are all whole numbers, this will not necessarily be the case for the average. double averageMark(int marks[], int size); |
[5] |