Comp 111: Introduction To Computer Programming Question Paper
Comp 111: Introduction To Computer Programming
Course:Bachelor Of Computer Science
Institution: Kabarak University question papers
Exam Year:2011
INSTRUCTIONS:
• Section A is compulsory
• Attempt other two questions from Section B
SECTION A (30 Marks)
Question One: (30 Marks)
a) Explain the character set of C. (4 Marks)
b) Given the task to develop an application how would you manage the input as well as the output
using C (5 Marks)
c) Two numbers C and D are input through the keyboard. Write a program to interchange the
contents of C and D. (5 Marks)
d) Explain the switch – case statement in C. (4 Marks)
e) Explain what is the output of the code below point out any errors if any:
(4 Marks)
#include<stdio.h>
main()
{
int i, z;
i = 4;
z =12;
if(i =5 || z > 50)
printf (“\n Dean of students Affairs );
else
printf (“\n Student affair”);
}
f) List the various benefits of using functions. (4 Marks)
g) Differentiate between the following: (4 Marks)
i. & and *
ii. Array and structure
SECTION B: (20 Marks Each)
Question Two: (20 Marks)
a) Explain the while loop in C. (4 Marks)
b) Write a program to convert a decimal number into octal number. (6 Marks)
c) Differentiate between the following: (4 Marks)
i. Global and local variable
ii. Continue and break statement
d) Explain the output of the code below and point out errors if any: (5 Marks)
#include<stdio.h>
main()
{
int i;
printf (“Enter any Number\n”);
multiply(i);
printf(“%d”,c)
}
Page 3 of 3
multiply(int x)
{
int b,d;
b=1;
while(b<=10)
{
d=b * x;
}
}
e) How can you initialize the values of a 1 – D array? (1 Marks)
Question Three: (20 Marks)
a) Write a program to allow the user to input any number then determine what month of the year it
could represent. (6 Marks)
b) Differentiate between the following: (4 Marks)
i. Recursion and nesting
ii. While and do – while statement
c) List four benefits of using pointers. (4 Marks)
d) Write a program to find the sum and difference between two numbers input by the user using
functions. (6 Marks)
Question Four: (20 Marks)
a) What is the importance of storage classes and when can one use the static and the register storage
classes? (5 Marks)
b) Write a function that receives a float and an integer from the main function, then finds the product
of these two and returns the product which is printed through the main (). (6 Marks)
c) List the rules for constructing an integer constant. (4 Marks)
d) Define the following: - (5 Marks)
i. strcomp ()
ii. 2 – D array
iii. String
iv. # include<>
v. Control instructions
More Question Papers
Exams With Marking Schemes
Popular Exams
Mid Term Exams
End Term 1 Exams
End Term 3 Exams
Opener Exams
Full Set Exams
Return to Question Papers