# DIT305  PROGRAMMING METHODOLOGY.

UNIVERSITY EXAMINATIONS: 2017/2018
ORDINARY EXAMINATION FOR DIPLOMA IN INFORMATION
TECHNOLOGY
DIT305 PROGRAMMING METHODOLOGY
FULL TIME/PART TIME
DATE: APRIL, 2018 TIME: 2 HOURS
INSTRUCTIONS: Answer question ONE and any other TWO.

QUESTION ONE [30 Marks]
a) Describe the steps involved in program development life cycle.
6 Marks
b) In a programming class, the lecturer divided the class into three groups for discussions. The
learners were required to identify five qualities of a good program. Assuming you are a member in
one of the groups and have been selected by the group to make a presentation about the topic given by
the lecturer. Explain the five possible qualities identified by your group.
5 Marks
c) You are writing a C program and intends to declare three variables: studentname, score and
grade. Identify and explain the possible data types for each variable.
3 Marks
d) Briefly explain FIVE operators you can use in a C program.
5 Marks
e) Write a C program to print odd numbers between 3 and 123 using a do while loop.
6 Marks
f) Explain FIVE different ways of classifying programming languages.
5 Marks
QUESTION TWO [20 MARKS]
a) Write a program in C to calculate and display the speed of an object, given that
speed=distance/time. Assume speed is a local variable while time and distance are global variables.
6 Marks
b) Explain any THREE rules followed when naming variables in a C program.
6 Marks
c) Write a C program to convert an integer in base 10 to its binary equivalent.
8 Marks
QUESTION THREE [20 MARKS]
a) Type casting is a way to convert a variable from one data type to another data type. Using
examples describe TWO types of typecasting in C.
6 Marks
b) Design an algorithm using a pseudo code to swap two numbers keyed in by the user.
4 Marks
c) Describe five reasons for learning programming languages
5 Marks
d) C is considered a strongly typed language. Explain.
5 Marks
QUESTION FOUR [20 MARKS]
a) Explain the difference between.
i. L-value and r-value
ii. “A” and ‘A’
iii. = and ==
6 Marks
b) Explain the concept of “null statement” in C program.
3 Marks
c) Differentiate between a symbolic and literal constants in a C program
4 Marks
d) Write a C program to store 10 numbers in a one-dimensional array, then display the numbers in
reverse.
7 Marks
QUESTION FIVE [20 MARKS]
a) Study the following table that consists information about format specifiers. Fill in the missing
information in the values column. The first row has been completed for you.
Format specifier Type of the value
%c Character value
%d
%e
%f
%p
4 Marks
b) Explain the difference between do…while and while loops in C.
6 Marks
c) Differentiate between a parameter and argument in a C program.
4 Marks
d) Write a C program to pass two integers as arguments from main function to two formal parameters
that belong to a function called product that will calculate and display the product to the calling
function(main).
6 Marks

(Visited 88 times, 1 visits today)