Comp 113 - Introduction to Programming
Comp 113 - Introduction to Programming
UNIVERSITY EXAMINATIONS
INSTRUCTIONS
Answer ALL questions in section A and any TWO questions in section B
All questions in section B carry equal marks
delta++;
}
}
SECTION B: Each question is worth 20 Marks. Answer any TWO questions in this section
void main()
int mark;
scanf(“%d”, &mark);
else
a) C Language statements, labels, arrays e.t.c. are separated by special characters known as
delimiters. Enumerate the use of the following delimiters in C language construct.
(4 Marks)
(i) #
(ii) []
(iii) {}
(iv) ;
b) What is the difference between passing arguments to a function by value and passing by
reference? (4 Marks)
c) Write a C program that requests a user to key in the bonga points that they have
accumulated and the displays the reward they have qualified for (use the table below as a
guide) (7 Marks)
Bonga points Reward
0 -199 null
main()
char grade;
scanf(“%c”, &grade);
if(grade == ‘A’)
printf(“Excellent !\n”);
printf(“Good !\n”);
printf(“Fair !\n”);
printf(“Poor !\n”);
else
b) Distinguish between the indirection operator (*) and the address operators (&) as used
with pointers. (2 Marks)
c) Discuss about declaring, initializing and accessing a one-dimensional array in C. Use
examples to illustrate each concept. (8 Marks)
d) Write the output of the following program. (4 Marks)
#include <stdio.h>
int main( )
{
int x;
for(x=10; x >=3; x--)
printf("%d ", x);
return 0;
}