BIT 1304  PROGRAMMING METHODOLOGY KCA Past Paper

UNIVERSITY EXAMINATIONS: 2010/2011
FIRST YEAR EXAMINATION FOR THE DEGREE OF BACHELOR OF
SCIENCE IN INFORMATION TECHNOLOGY
BIT 1304: PROGRAMMING METHODOLOGY
DATE: AUGUST 2011 TIME: 2 HOURS
INSTRUCTIONS: Answer question ONE and any other TWO questions

Question One (30 Marks)
a) Distinguish between the following concepts used in programming;
i) Variable and data type (2 Marks)
ii) Pre-processor directive and compiler (2 Marks)
iii) Signed and unsigned integer (2 Marks)
b) Discuss the importance of working with users to identify system requirements (6 Marks)
c) Using appropriate examples identify four rules for naming variables (4 Marks)
d) i) Identify the characteristics of top-down problem solving (4 Marks)
ii) Discuss the strengths of simulation as a way of program testing (4 Marks)
e) Discuss three different types of loops stating their effects and general syntax (6 Marks)
Question Two (20 Marks)
a) Use examples to distinguish between the following arrays;
i) Automatic array (2 Marks)
ii) External array (2 Marks)
iii) Static array (2 Marks)
b) i) Explain the problems that were experienced by programmers using the go-to statements
(4 Marks)
ii) Given the following piece of program rewrite it replacing the else-if statement with the switch
statement (6 Marks)
//Computation of grades
if (average>70)
grade=’A’;
else if (average>60)
grade=’B’;
else if (average>50)
grade=’C’;
else if (average>40)
grade=’D’;
else
grade=’F’;
printf(“The student’s grade is %c\n”, grade);
}
c) Using a diagram, illustrate the major classifications of computer programs (4 Marks)
Question Three (20 Marks)
a) i) Define the term algorithm (2 Marks)
ii) Briefly discuss two categories of programming algorithms (4 Marks)
b) i) Identify four characteristics of arrays (4 Marks)
ii) Give reasons why un-sized arrays are preferred oversized arrays (2 Marks)
c) i) Explain the concept of strings and how a string is handled in C (4 Marks)
ii) Name any four standard string functions stating the result of each (4 Marks)
Question Four (20 Marks)
a) Using examples, define the following types of operators:
i) Relational operator (2 Marks)
ii) Logical operator (2 Marks)
iii) Assignment operator (2 Marks)
b) Discuss three types of language translators (6 Marks)
c) i) Identify four criteria used in evaluating programming languages (4 Marks)
ii) Give reasons why C is considered advantageous to use (4 Marks)
Question Five (20 Marks)
a) i) Discuss the use of functions in programming (3 Marks)
ii) Identify and briefly explain two major types of functions used in C (4 Marks)
b) A program prompts for the principal amount (float), and the time in years (integer) and
uses this to calculate the gross profit. The gross profit is calculated as: principal amount x rate x time
The rate is based on the time entered as follows:
1 Year = 0%
2 Years = 2%
3 Years = 3%
4 Years = 5%
5 years and above 8%
i) Draw a flowchart to illustrate this: (4 Marks)
ii) Create a program to prompt for the relevant input, calculate and display results (6 Marks)
c) Discuss three features of a pointer in C programming (3 Marks)

(Visited 91 times, 1 visits today)
Share this:

Written by