W1-2-60-1-6
JOMO KENYATTA UNIVERSITY
OF
AGRICULTURE AND TECHNOLOGY
University Examinations 2014/2015
STAGE II END OF SEMESTER EXAMINATION FOR
THE DIPLOMA IN BUSINESS INFORMATION TECHNOLOGY
HCT 0103: INTRODUCTION TO COMPUTER PROGRAMMING
DATE: AUGUST 2014 TIME: 1½ HOURS
INSTRUCTIONS: ANSWER THREE QUESTIONS.
Question One (20 Marks)
a) Differentiate between the following:
(i) Assembler and compiler (2 Marks)
(ii) Procedural language and object oriented language (2 Marks)
(iii) Source code and object code (2 Marks)
b) Define four rules that are used while developing identifiers in programming. (4 Marks)
c) Write a program that reads three integers input by user via keyboard and outputs the greatest among them. (4 Marks)
d) In a certain company, if an employee earns 20,000 or more he/she is given a house allowance of 20% and transport allowance of 15% of the basic salary. Otherwise an employee gets 12% house allowance and 10% transport allowance of the basic salary. Write a program that accepts basic salary and computer and displays the following on the screen: (6 Marks)
(i) Gross salary
(ii) House allowance
(iii) Transport allowance
(iv) Net salary
Question Two (20 Marks)
a) Explain four datatypes in C programming language. (4 Marks)
b) Explain the following parts of a C program:
(i) # include (2 Marks)
(ii) Main ( ) (2 Marks)
(iii) return O (2 Marks)
c) Differentiate between a pseudocode and flowchart giving an advantage of each. (4 Marks)
d) A number is said to be evenly divisible by 9 if it’s even at the same time divisible by 9 e.g. 36 is evenly divisible by 9 and 27. Write a program that allows you to enter a number and check the above conditions. (6 Marks)
Question Three (20 Marks)
a) Discuss three errors encountered in a program. In each case give a scenario which can lead to the occurrence. (6 Marks)
b) Discuss control structures under the following categories:
(i) Decision/Branching (3 Marks)
(ii) Looping/Alteration (3 Marks)
c) A program is required that grades a student using marks attained in four subjects using the grading system below:
MARKS GRADE
80 – 100 A
70 – 79 B
60 – 69 C
50 – 59 D
40 – 49 E
0 – 39 F
Write a program that accepts marks a student attained in four subjects compute its average and use the grading system above to award the overall grade. The system should output in the following order: (8 Marks)
(i) Name of student
(ii) Registration number
(iii) Grade
Question Four (20 Marks)
a) Define the following terms:
(i) Linker (2 Marks)
(ii) Interpreter (2 Marks)
b) Rehema Limited requires a program to compute income tax and net salaries for its employees. The company offers tax relief of Kshs. 650 for single employee and Kshs. 1,110 tax relief for employees earning > = 5,000. The relief will be deducted from the gross salary to give the taxable income. This will then be computed at the following rates:
TAXABLE INCOME RATES (%)
< 5, 000 0
5,000 – 10,000 6
10,001 – 19,999 9
20,000 – 29,999 12
30,000 – 36,999 14
37,000 and above 16
The tax charged is then deducted from gross income to give net salary. Write a program that will input employee’s Name, PF. Number, martial status and gross income.
The program will then compute the tax and net salary then printout the employee payslip.
The payslip should contain Income tax, Net salary, Gross income, Employee Name, PF. Number, Marital Status and Gross income. (10 Marks)
c) Describe the steps a program has to follow in program development life cycle. (6 Marks)