UNIVERSITY EXAMINATIONS: 2016/2017
EXAMINATION FOR THE DIPLOMA IN INFORMATION
TECHNOLOGY
DIT305 PROGRAMMING METHODOLOGY
MODE: FULL TIME/PART TIME
ORDINARY EXAMINATIONS
DATE: AUGUST, 2017 DURATION: 2 HOURS
INSTRUCTIONS: Answer Question One & ANY OTHER TWO questions.
QUESTION ONE [30 MARKS] – COMPULSORY
a) Briefly explain the problem-solving steps with respect to programming.
[6 Marks]
b) Differentiate between debugging and profiling as used program testing.
[4 Marks]
c) Differentiate between compiled programming language and interpreted programming language.
[4 Marks]
d) Briefly explain the use of a pre-processor in programming.
[2 Marks]
e) Design a program using a flow chart to prompt the user to enter a score, then return a grade based on
the following criteria.
[10 Marks]
f) Discuss the four calculation operations in C. [4 Marks]
QUESTION TWO [20 MARKS]
a) Briefly describe four properties of a good program.
[4 Marks]
b) Briefly outline three types of information provided whenever a variable is declared in C.
[3 Marks]
c) Differentiate between a fatal and non-fatal error in a program. Give one example for each.
[4 Marks]
d) It is recommended that programmers should indent program statements properly, explain why this
necessary.
[3 Marks]
e) Write a C program to prompt the user to enter his user name and password then validate the values
and return the appropriate message using the criteria below.
[6 Marks]
QUESTION THREE [20 MARKS]
a) Briefly describe the three program control structures in structured programming.
[6 Marks]
b) Briefly explain the difference between a do while loop and a while loop.
[4 Marks]
c) Describe the difference between break and continue statements in a loop.
[4 Marks]
d) Write a C program to print odd numbers greater than 0 but less than 100.
[6 Marks]
QUESTION FOUR [20 MARKS]
a) Discuss the following user defined data types in C
i. Enumeration
ii. Typedef
iii. Union
iv. Array
[8 Marks]
b) Write a C program to store twenty floating numbers in an array, then display them in reverse order.
[4 Marks]
c) Explain the difference between order of precedence and associativity with respect to operators in C.
[2 Marks]
d) Explain the output of the following statements in C. Assume x=100 and y=23 that use bitwise
operators.
i. printf (“%d \n”, x>>2);
ii. printf (“%d \n”, y<<2);
iii. printf (“%d \n”, x&y);
[6 Marks]
QUESTION FIVE [20 MARKS]
a) Briefly explain three advantages of modularization in C.
[3 Marks]
b) Write a C program to prompt the user to key in a natural number, then calculate and display its
factorial.
[5 Marks]
c) Explain the user of formal parameters in a function.
[4 Marks]
d) A C program function be user defined or built-in. Explain the use of the following built-in functions
in C.
a. printf ()
i. strcat ()
ii. pow ()
iii. sqrt ()
[8 Marks]