UNIVERSITY EXAMINATIONS: 2017/2018
ORDINARY EXAMINATION FOR DIPLOMA IN INFORMATION
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.
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.
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.
d) Briefly explain FIVE operators you can use in a C program.
e) Write a C program to print odd numbers between 3 and 123 using a do while loop.
f) Explain FIVE different ways of classifying programming languages.
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.
b) Explain any THREE rules followed when naming variables in a C program.
c) Write a C program to convert an integer in base 10 to its binary equivalent.
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.
b) Design an algorithm using a pseudo code to swap two numbers keyed in by the user.
c) Describe five reasons for learning programming languages
d) C is considered a strongly typed language. Explain.
QUESTION FOUR [20 MARKS]
a) Explain the difference between.
i. L-value and r-value
ii. “A” and ‘A’
iii. = and ==
b) Explain the concept of “null statement” in C program.
c) Differentiate between a symbolic and literal constants in a C program
d) Write a C program to store 10 numbers in a one-dimensional array, then display the numbers in
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
b) Explain the difference between do…while and while loops in C.
c) Differentiate between a parameter and argument in a C program.
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