DIT305  PROGRAMMING METHODOLOGYa.

UNIVERSITY EXAMINATIONS: 2018/2019
EXAMINATION FOR THE DIPLOMA IN INFORMATION
TECHNOLOGY
DIT305 PROGRAMMING METHODOLOGY
MODE: FULL TIME/PART TIME
ORDINARY EXAMINATIONS
DAY: MARCH, 2019 DURATION 2 HOURS
INSTRUCTION: Answer question ONE and any other TWO questions.

QUESTION ONE [30 MARKS]
a) Explain the role of each of the following syntactic symbols used in C programming.
i. ,
ii. []
iii. {}
iv. ;
4 Marks
b) Differentiate between syntax and run time error as used in programming.
4 Marks
c) Jane intends to develop a program using a C language, explain the steps she will need to
follow.
6 Marks
d) Explain any TWO advantages of assembly language over machine language.
4 Marks
e) Write a pseudo code for a program that reads two numbers then swaps their values and
display the result.
8 Marks
f) State and explain any FOUR programming tools
4 Marks
QUESTION TWO [20 MARKS]
a) Write and explain any TWO preprocessor directives in C.
4 Marks
b) Using an example, explain the use of break statement in a while loop.
4 Marks
c) Explain the difference between post-increment and pre-increment operator in C.
4 Marks
d) Explain the use of the following built-in functions in C.
i. Scanf()
ii. Puts()
iii. Printf()
iv. Gets()
8 Marks
QUESTION THREE [20 MARKS]
a) The table below shows the rate of taxation of basic salary used in a certain organization.
Write a C program that accepts an employee’s name and basic salary. The program should
then compute and output the employee’s name and net salary. Use if …else if…else control
structure. The net salary is calculated as a difference between basic salary and tax.
Basic salary scale Rate of taxation

8 Marks
b) State any FOUR conventions for naming variables in C programming.
4 Marks
c) Define an array type as used in a C program.
2 Marks
d) Explain the declaration and initialization of one dimensional arrays with example.
6 Marks
QUESTION FOUR [20 MARKS]
a) Differentiate argument and parameters as used in C functions.
4 Marks
b) Write a C program to receive ten integers, store them in an array then sort the elements in an
ascending order then display the sorted elements onscreen.
8 Marks
c) Explain FOUR features of the C language.
4 Marks
d) Differentiate between while loop and do loop as used in C programming.
4 Marks
QUESTION FIVE [20 MARKS]
a) Write a program in C to find the area and perimeter of a circle. Assume 𝜋 = 3.142.
9 Marks
b) Define a pointer.
3 Marks
c) Explain how the pointer variable declared and initialized.
4 Marks
d) Describe any two operators used when working with pointers in C.
4 Marks

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

Written by