MERU UNIVERSITY OF SCIENCE AND TECHNOLOGY
P.O. Box 972-60200 – Meru-Kenya.
Tel: +254 (0)799529958, +254 (0)799529959, +254 (0)712524293
Website: www.must.ac.ke Email: info@must.ac.ke
University Examinations 2021/20222
FIRST YEAR, FIRST SEMESTER EXAMINATION FOR DIPLOMA IN
INFORMATION TECHNOLOGY
CIT 2112 – INTRODUCTION TO PROGRAMMING
DATE: JANUARY 2022 TIME: 1½ HOURS
INSTRUCTIONS: Answer question one and any other two questions.
QUESTION ONE (30 MARKS)
a) Name three primitive datatypes in C programming language 3 marks
b) List four types of errors that are likely to be encountered in a c program 4 marks
c) Outline three advantages of low-level programming languages 3 marks
d) Define the following terms as used in program design: 5 marks
i. Flowchart
ii. Pseudocode
iii. Algorithm
iv. Input
v. Documentation
e) What is stepwise refinement 2 marks
f) Highlight four features of C that make it a popular programming language 4 marks
g) Give three constructs likely to be found in a C program structure 3 marks
h) Outline two types of utility programs used in program translation 2 marks
i) Distinguish between source and object codes 4 marks
QUESTION TWO (15 MARKS)
a) A student created the following C program during a practical lesson. Use it to answer the
question that follows
#include<stdio.h>
int main()
{
int num1, num2;
num1=25;
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations Page 1
num2=num1-(3*4)+6*(2+3)+(1+5);
printf(“num2 =%d\n”,num2);
return 0;
}
Write the output produced when the program is executed. 4 marks
b) Tegemeo SACCO registers an applicant upon payment of registration fee. A registered member
may apply for a loan after making monthly contributions for atleast six consecutive months.
Draw a flowchart to represent this logic. 5 marks
c) Write a C program that stores five elements in an array. The program initializes the value of
each element to be the product of its index and 5. The program then outputs the elements in
reverse order of initialization. 6 marks
QUESTION THREE (15 MARKS)
a) Write the function of each of the following escape sequences in C programming language.
5 marks
i. \t
ii. \v
iii. \n
iv. \”
v. \0
b) Explain the term parameter passing as used in programming 2 marks
c) Explain two similarities between third and fourth generations programming languages 4 marks
d) Explain two differences between sequential and random file as used in programming 4 marks
QUESTION FOUR (15 MARKS)
a) Write a C program that could be used to generate the following output 5 marks
10 15 20
10 15
10
b) Distinguish between strlen() and strcpy() functions as used in C programming language 4 marks
c) The following types of errors were identified by a student while executing a programming they
had written in a structured programming language:
i. A non-terminating loop
ii. Erroneous result
iii. The program terminating prematurely
Explain the type of error that could have led to each of these observations. 6 marks
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations Page 2