Get premium membership and access revision papers, questions with answers as well as video lessons.

Programming Methodology Question Paper

Programming Methodology 

Course:Diploma In Information Technology

Institution: Kca University question papers

Exam Year:2010



UNIVERSITY EXAMINATIONS: 2009/2010
STAGE III EXAMINATION FOR DIPLOMA IN INFORMATION
TECHNOLOGY
DIT 305: PROGRAMMING METHODOLOGY
DATE: AUGUST 2010 TIME: 1½ Hours
INSTRUCTIONS: Answer any THREE questions
QUESTION ONE
a) Define structured programming (2 Marks)
b) Explain the meaning of the following components of a C program.
i) Preprocessor directive
ii) Declaration
iii) Function
iv) Expression
v) Comment. (10 Marks)
c) Identify the errors in the following program and write a correct program:
void main( )
{
cows, legs, int;
printf(“How many cow legs did you count ? \n);
scanf(“%d”, legs);
cows = legs/4;
printf(“That implies that there are % cows. \n”, cows);
} (4 Marks)
d) Write a program that asks the user for an integer and then tells the user if that number is even or
odd. (4 Marks)
2
QUESTION TWO
a) Outline the stages of developing a working program. (8 Marks)
b) Why is linking necessary in a program? (2 Marks)
c) A program may compile successfully but fail to generate desired results. What is likely to be the
problem and how would you solve it? (2 Marks)
d) Write a program that prompts the user to enter the radius of a circle, then computes and outputs
the area and circumference of the circle (Area = p * radius2, Circumference = 2 * radius * p).
(6 Marks)
e) Explain briefly the meaning of the following escape sequence characters
i) “\a”
ii) “\t” (2 Marks)
QUESTION THREE
a) A program is required to accept two integers A and B. If the value of A is greater than that of B,
the numbers are added, otherwise the value of A is subtracted from B.
i) Write pseudo code for your solution. (4 Marks)
ii) Write a program to accomplish the above. (6 Marks)
b) Explain any two program algorithm design tools. (4 Marks)
c) Differentiate between the following pair of terms
i) Source code and object code
ii) Variable and structure
(4 Marks)
d) Explain the meaning that the following statements would have in a C program
i) int *x;
ii) return(y);
(2 Marks)
QUESTION FOUR
a) Define, with examples, the following terms as used in programming:
i) Function argument
ii) Function prototype. (4 Marks)
b) Differentiate between logical and syntax error, giving an example in each case. (4 Marks)
3
c) Using a “for” loop structure; write a program to get the sum of the first 10 numbers in the
following series.
2+4+8+16…… (6 Marks)
d) State any two categories of operators used in C language. (2 Marks)
e) Define the term “array” (2 Marks)
f) Explain the use of header files in a C program. (2 Marks)
QUESTION FIVE
a) Discuss two advantages of using functions in a program. (4 Marks)
b) Write a program that utilises two functions RECT_AREA and RECT_PERIMETER to compute
the area and perimeter of a rectangle respectively. Input of the rectangle sides as well as the
outputs of the area and perimeter should be done inside the main () function. (Area = length *
width, Perimeter = 2 *(length+width). (12 Marks)
c) Explain any two categories of control structures. (4 Marks)






More Question Papers


Popular Exams



Return to Question Papers