UNIVERSITY EXAMINATIONS: 2011/2012
YEAR 1 EXAMINATION FOR THE BACHELOR OF SCIENCE IN
INFORMATION TECHNOLOGY
BIT 1304 PROGRAMMING METHODOLOGY
DATE: APRIL 2012 TIME: 2 HOURS
INSTRUCTIONS: Answer Question One and Any other Two Questions
QUESTION ONE (30 MARKS)
a) Explain the following programming concepts;
i) Function (2Marks)
ii) Symbolic constant (2Marks)
iii) Intractable problems (2Marks)
iv) Pointer (2Marks)
b) Define the term ‘operator’ and name four types of operators in programming (6Marks)
c) With appropriate code illustration, differentiate between function definition and function prototype.
(4Marks)
d) i) Write a program that allows the input of marks for five units and sums these up and
displays both the sum and average (7Marks)
ii) Amend the above program to apply decision-making in displaying the grade based
on the average mark as follows;
Average Grade
100 – 70 A
69 – 50 B
49 – 40 C
39 – 0 F
(5Marks)
QUESTION TWO (20 MARKS)
a) Briefly discuss the following types of inputs that must be considered while analyzing algorithms;
i) Best Case Input (2Marks)
ii) Worst Case Input (2Marks)
iii) Average Case Input (2Marks)
b) Discuss five properties that an effective algorithm must possess (10Marks)
c) Discuss any four criteria that can be used to evaluate programming languages (4Marks)
QUESTION THREE (20 MARKS)
a) i) Define the term ‘variable’ (2Marks)
ii) Give the syntax of variable declaration in C language (3Marks)
iii) Explain the importance of data types in variable declaration (2Marks)
b) Explain the steps in program development (7Marks)
c) A compiler and an interpreter are two examples of language processors. Compare and contrast the
two (6Marks)
QUESTION FOUR (20 MARKS)
A program is required to calculate an employee’s net salary from the gross pay. The net salary is given
by gross pay less deductions. Deductions include: 25% of gross pay as tax, KSh.250 as NSSF
contribution and KSh.320 as NHIF contribution.
a)Design a flowchart for the problem. (5Marks)
b)Implement the above problem using the C program (15Marks)
QUESTION FIVE (20 MARKS)
a) Illustrate how the values in the following array manipulation statement would be contained within
the computer memory;
int values[10]
values[0] = 197;
values[2] = -100;
values[5] = 350;
values[3] = values[0] + values[5];
values[9] = values[5] / 10;
– -values[2]; (6Marks)
b) Describe the elements of the following programming approaches;
i) Divide and conquer method of solution
ii) Dynamic programming
(6Marks)
c) i) Identify any three symbols used in a standard flow-chart diagram (3Marks)
ii) Explain the features that make C language a preferred programming language. (5Marks)