MERU UNIVERSITY OF SCIENCE AND TECHNOLOGY
P.O. Box 972-60200 – Meru-Kenya
Tel: +254(0) 799 529 958, +254(0) 799 529 959, + 254 (0) 712 524 293,
Website:
[email protected] Email:
[email protected] University Examinations 2017/2018
FIRST YEAR SPECIAL/SUPPLEMENTARY EXAMINATION FOR THE DEGREE OF
BACHELOR OF INFORMATION TECHNOLOGY, BACHELOR OF COMPUTER
TECHNOLOGY, BACHELOR OF COMPUTER SCIENCE, BACHELOR OF
MATHEMATICS AND COMPUTER SCIENCE AND BACHELOR OF BUSINESS
INFORMATION TECHNOLOGY
CIT 3102: FUNDAMENTALS OF COMPUTER PROGRAMMING
DATE: SEPTEMBER 2018 TIME: 2 HOURS
INSTRUCTIONS: Answer question one and any other two questions.
QUESTION ONE (30 MARKS)
a) State two relational operators (2 marks)
b) Explain three reasons why end users resist development and implementation of a new
system (4 marks)
c) Explain two advantages of top down problem solving strategy in programming
(4 marks)
d) Some programmers produce rough & ready solutions at a keyboard, and continue to
amend the programs until why this is not recommended in programming (4 marks)
e) Using appropriate examples differentiate between syntax and run time errors as used in
programming (6 marks)
The program will prompt the user to enter two numbers X and Y. however, if the value of
Y is 0, the program should display an error message “Error: Division by zero” otherwise
it should be able to print the output
Required:
i. Use a flow chart (5 marks)
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations Page 1
f) Using pie as 3.142, write a program to calculate the area of a circle. The user should enter
the diameter of a circle (area = pie x raius2) (5 marks)
QUESTION TWO (20 MARKS)
a) Write the file extension for the following C file (3 marks)
i. Source code
ii. Compiled source code
iii. Linked C program
b) Using function(s) write a program that reads the length and width of a rectangle, then it
returns the area and perimeter of the rectangle in 2 decimal places each (7 marks)
c) Write a program that prompts a user to enter two integers A and B, it then tests if A is
greater than B. If the condition is not true, it advices you to enter integers where A is
greater B. Otherwise it divides A with B and returns both the dividend and the remainder.
(HINT: example if user enters A=90 and B=25, it returns 3 remainder 15) (5 marks)
d) Assuming a customer has to buy four items from a grocery whenever he shops. Using an
array, write a program that prompts the cashier to key in the cost of each item bought by
the customer. It then gives the total cost to be paid by every customer; and if the customer
has bought goods worth Ksh 500 and above it gives a total discount of Ksh 40, else it
gives a discount of Ksh 10 (5 marks)
QUESTION THREE (20 MARKS)
a) State three types of system maintenance (3 marks)
b) Write the syntax for a function declaration (2 marks)
c) Explain any three conditional control structures used in C programming (3 marks)
d) Write a C program that accepts two integer values represented by a and b. values
assigned to should be equal to zero or greater than zero. Values assigned to be should be
less or equal to five. The program should ask the user to enter the values for a and b, if
the above conditions are met, the program should sum the two values i.e a and b, divide
the sum by two and assign the results to a float variable called xmid. The program should
then display the value of xmid (6 marks)
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations Page 2
e) Assuming 2.6 centimeters = 1 inch. Using switch statement, write a program that prompts
a user to enter a number to be converted, then select either select option 1 or option 2. If a
user selects option 1 it converts the entered number from centimeters to inches, while if
the user enters option 2 it converts from inches to centimeters (6 marks)
QUESTION FOUR (20 MARKS)
a) A student came across the following programming languages. Help him identify an
object oriented language, fourth generation language and fifth generation language
(3 marks)
i. Small Talk
ii. Delphi Pascal
iii. Mercury
b) State the two ways of declaring a comment in C programming (2 marks)
c) Discuss the role of variable declaration in programming and write an example statement
that declares a variable (4 marks)
d) Fred is a programming student who has been asked by his lecturer to calculate simple
interest of three individuals. Write a C program to implement this (5 marks)
e) Assuming 2.6 centimeters = 1 inch. Using switch statement, write a program that prompts
a user to enter a number to be converted, then select either select option 1 or option2. If a
user selects option 1 it converts the entered number from centimeters to inches, while if
the user enters option 2 it converts from inches to centimeters (6 marks)
QUESTION FIVE (20 MARKS)
a) State three uses of a semicolon in C programming language (3 marks)
b) Define the following terms as used in programming (3 marks)
i. Compilation
ii. Feasibility
iii. Testing
c) Write the syntax that make up for the loop (3 marks)
d) A small tutorial college would like to computerize its records and payroll processing
application. A consultant has been hired to oversee the implementation of the project. He
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations Page 3
suggests that the college needs to perform a feasibility study which will cover hardware
and software, staffing and operating costs, impact of the new system on employment and
the level of skills required for this new system. Identify four broad types of feasibility
assessment covered in the above study (4 marks)
Figure 1 shows the playground of a certain institution. Use it to answer the question that
follows:
e) Using a function for each of the parts labeled X,Y and Z. write a C program to calculate
the total area covered by the playground take pie to be 3.14 (7 marks)
Meru University of Science & Technology is ISO 9001:2015 Certified
Foundation of Innovations Page 4