0% found this document useful (0 votes)
2 views3 pages

Cit 3102 Fundamentals of Comp Programming

Good

Uploaded by

Joseph Wambui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Cit 3102 Fundamentals of Comp Programming

Good

Uploaded by

Joseph Wambui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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 2019/2020

SECOND YEAR SECOND SEMESTER EXAMINATION FOR BACHELOR OF INFORMATION


SCIENCE

CIT 3102: FUNDAMENTALS OF COMPUTER PROGRAMMING

DATE: APRIL 2020 TIME: 2 HOURS

INSTRUCTIONS: Answer question one and any other two questions

QUESTION ONE (30 MARKS)

a) Differentiate between the following (4marks)


i. Assembly language and Machine language
ii. Compiler and interpreter
b) Differentiate float and double data types (2marks)
c) Write a program to allow input of a number then use a function to calculate the cube of the number
entered. (4marks)
d) Write a program to display numbers 10,8,6,4,2,0 (4marks)
e) i. Design a flow chart of a program to input student name, Maths, English and Kiswahili marks then
calculate the total and average marks. The flowchart should display “pass” when average is greater
than 50 otherwise it should display “fail”. (4marks)
ii. Write a C program to implement the flow chart in 1e) i. above (4marks)
f) Differentiate between an identifier and keyword giving two examples in each case (4marks)
g) Briefly describe the purpose of the following sections of a C program. (4marks)
i. Linker section
ii. Definition

Meru University of Science & Technology is ISO 9001:2015 Certified


Foundation of Innovations Page 1
QUESTION TWO (20 MARKS)

a) Design a C program to input product name, quantity and price then calculate the total price, tax and
net price. Where tax=10% of total prince and net=total price-tax. (4marks)
b) Write a program to enter two numbers then use a function to calculate their sum (4marks)
c) Write a program to input six integers into an array the n display the biggest and the smallest elements
in the array (4marks)
d) A Banks classify its customers depending on period of operation and outstanding balance to issue
loan. Customers are classified as show below:

Classification Loan amount


A Above 1000000
B 50000 - 100000
C 20000 - 500000
D Below 200000

e) Write a program to input customer name, classification and determine loan amount using switch
(6marks)
f) Briefly explain the importance of using comments in a program. (4marks)

QUESTION THREE (20 MARKS)

a) Briefly explain the purpose of the following statements used in C. (4marks)


i. #include<stdio.h>
ii. Int main()
b) Write a C program to input two numbers then use a function to give the smallest and largest number
between the two numbers (6marks)
c) ABC is an organization dealing with sales of motor vehicle. If a salesman sells a vehicle that is new,
he/she receives 20% commission, unless the vehicles is reconditioned in which case a 10%
commission is earned for vehicles costing over 2 million, for reconditioned vehicles costing between
1-2 million, a 5% commission is earned. Otherwise Ksh. 10,000 is earned for a vehicle costing less
that 1 million.

Meru University of Science & Technology is ISO 9001:2015 Certified


Foundation of Innovations Page 2
i. Design a flow chart to use the above statement and input salesman name, motor vehicle type
(new/refurbished) and price then calculate commission and display result (5marks)
ii. Design a program to implement the above flow chart in 2a). Using nested if. (5marks)

QUESTION FOUR (20 MARKS)

a) Write a program to enter integer values to a 3 by 4 array then display the result (4marks)
b) Briefly explain he purpose of the following statements in C program (4marks)
i. Continue
ii. Break
c) Write a C program that accepts two numbers and operator (+,-,/,*) computes the result depending on
the operator entered, and then output the numbers, operator and the result. (6marks)
d) Write a program to input dimension of a cylinder then use a function to calculate volume of the
cylinder. Where volume = ℎ (4marks)

QUESTION FIVE (20 MARKS)

a) Give four advantages of using functions in a program (4marks)


b) Use an example to briefly explain the meaning of the following terms (4marks)
i. Function declaration
ii. Function call
c) Design a C program to input employee name, hours worked and rate per hour the calculate the
basic pay=hours worked* rate per hour, tax is charged according to basic pay. If basic is greater
that 20000, a tax of 10% of basic pay is charged, otherwise a tax of 5% is charged. Net salary
=basic-tax. The program should display employee name, basic salary, tax and net salary
(6marks)
d) Write a C program to display numbers as shown below (6marks)

54321
4321
321
21
1

Meru University of Science & Technology is ISO 9001:2015 Certified


Foundation of Innovations Page 3

You might also like