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/2022
FIRST YEAR, FIRST SEMESTER EXAMINATION FOR THE DIPLOMA IN INFORMATION
TECHNOLOGY
CIT 2112: FUNDAMENTALS OF COMPUTER PROGRAMMING
DATE: MAY 2022 TIME: 1 HR 30 MINS
INSTRUCTIONS: Answer question one and any other two questions
QUESTION ONE (30 MARKS)
a) List four rules for naming identifiers in C 4 marks
b) State two examples of each of the following as used in C programming: 4 marks
i. Logical operators
ii. Relational operators
c) Outline four characteristics of assembly language 4 marks
d) List three properties of array data structure 3 marks
e) Differentiate between runtime and logical errors 4 marks
f) Define the following programming terms: 5 marks
i. Control structure
ii. String
iii. Runtime error
iv. Syntax
v. Array
g) List three examples of structured programming languages 3 marks
h) Name three parts of a loop 3 marks
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations Page 1
QUESTION TWO (15 MARKS)
a) Write a C program code that prompts a user to enter an integer value. The program should
then determine whether the value entered is even or odd 5 marks
b) With the aid of a diagram in each case, describe the following as used in flowcharts:6 marks
i. Inputs/Outputs
ii. Processes
iii. Decisions
c) Differentiate between scanf() and printf() functions as used in C programming 4 marks
QUESTION THREE (15 MARKS)
a) Describe three types of control structures used in C programming 6 marks
b) The following is a C program that has errors. Use it to answer the questions that follow:
#include<stdio.h>
int main()
{
int x,y;
printf(“enter the value of x\n”)
scanf(“%d”,x);
if(x>20)
printf(“the value is greater than 20 and it is:”,x);
return 0;
}
Identify the errors and rewrite the correct program code 5 marks
c) Explain the difference between logical errors and syntax errors as used in programming
4 marks
QUESTION FOUR (15 MARKS)
a) Brenda intends to buy 4 loaves of bread and 5 packets of milk. If each loaf of bread cost
KShs 50 and a packet of milk costs KShs 45, write a C program that could be used to
calculate and display the amount of money she will spend. 6 marks
b) Explain the term function stating its syntax 4 marks
c) Describe the bottom-up approach to system design 5 marks
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations Page 2