CCS 2101 Computer Programming 1 Question paperEEE& BED
CCS 2101 Computer Programming 1 Question paperEEE& BED
II) What is the purpose of the literals - %s%13s\n in the program? [2 Marks]
(e) Briefly describe the difference between each of the following pairs of operators as used in
C language: [6 Marks]
I) /= and +=
II) = = and !=
III) && and | |
(f) Why is linking necessary in a C program? [2 Marks]
(g) Describe the use of the printf()and the scanf() methods used in a C program [3 Marks]
(h) Explain the meaning of each of the following function prototypes [2 Marks]
I) int f(int a);
II) void g(long a, short b);
a) Distinguish between the indirection operator (*) and the address operators (&) as used
with pointers [3 Marks]
b) Give the meaning of the following components of a C program [ 4Marks]
i) Preprocessor directive
ii) Declaration
iii) Comment
iv) Header File
d) What is the output of the following program? [3 Marks]
#include<stdio.h>
main()
{
int pica = 0, delta = 0;
While(pica <= 20)
{
if(pica % 5 == 0)
{
delta += pica;
printf(“\n %d ”, delta);
}
delta++;
}
}
e) Body Mass Index is calculated by dividing a person’s weight (in kgs) by the square of their
height (in meters). Write a program in C that asks a person for his/her weight, calculates
the body mass index and displays it. [5 Marks]