# DBIT305 DIT307  DATA STRUCTURES  ALGORITHMS.

UNIVERSITY EXAMINATIONS: 2018/2019
EXAMINATION FOR THE DIPLOMA IN BUSINESS INFORMATION
TECHNOLOGY/ DIPLOMA IN INFORMATION TECHNOLOGY
DBIT305 DIT307 DATA STRUCTURES & ALGORITHMS
FULLTIME/PARTTIME
DATE: NOVEMBER, 2018 TIME: 2 HOURS
INSTRUCTIONS: Answer Question One & ANY OTHER TWO questions.

QUESTION ONE [30 MARKS]
(a) Explain the following programming terms:- [4 Marks]
(i) Data structure
(ii) Algorithm
(iii)Control structure
(iv)Compiler
(b) Explain five qualities of a good algorithm [5 Marks]
(c) Design an algorithm using a flowchart that gets an integer value from the keyboard and then
displays remarks depending on the criteria shown below:- [7 Marks]

(e) With the aid of a diagram, describe the binary tree data structure [5 Marks]
(f) Differentiate between the following terms used to classify arrays:-
(i) Static and dynamic arrays [2 Marks]
(ii) One dimensional & multidimensional array [2 Marks]
QUESTION TWO [20 MARKS]
(a) Explain why programmers need to spend more time analyzing their program designs than the
actual code [3 Marks]
(b) Discuss any three techniques of traversing a binary search tree [6 Marks]
(c) Explain the memory size allocated to the following array declarations if the machine
allocates the memory sizes to data types as follows: 4 bytes for integer and 8 bytes for
double:
(i) Int scores[3][4] [2 Marks]
(ii) Double studentHeight[5] [2 Marks]
(d) A linked list is a data structure that consists of nodes, where each node stores at least two
values: the data and address to the next node. With reference to this:-
Required:
(i) Explain three operations supported by a linked list [3 Marks]
(ii) Describe any two applications of a linked list [4 Marks]
QUESTION THREE [20 MARKS]
(a) With the aid of an example, describe the selection control structure [4 Marks]
(b) Design al algorithm using pseudo code for a program that will read and examines the value
of a character variable called colour. The program then prints one of the following messages
depending on the character entered by the user:-
RED, if either r or R is entered
GREEN, if either g or G is entered
BLUE, if either b or B is entered
BLACK, if any other character is entered [6 Marks]
(c) KCA University keeps the following details about a lecturer: lecturerNumber, age,
telephoneNumber, gender.
Required:
(i) Explain the most appropriate data structure that can be used to store the lecturer
details [3 Marks]
(ii) Using C or C++ programming language, declare the data structure identified in (c)i
above [5 Marks]
(d) Outline two tools of designing algorithms [2 Marks]
QUESTION FOUR [20 MARKS]
(a) Explain the following standard library header in C++:
(i) <iostream> [2 Marks]
(b) Explain the purpose of the following operations as used in a stack:- [3 Marks]
(i) Pop()
(ii) Top()
(iii)Size()
(c) Write a C or C++ program segment that adds the following data elements 20, 60, 45, 60 into
a stack named numbers and reads and returns the top element. [6 Marks]
(d) With the aid of appropriate symbols, describe the elements of a flow chart diagram [5
Marks]
(e) Explain two uses of program documentation [4 Marks]
QUESTION FIVE [20 MARKS]
(a) With the aid of a diagram, describe the queue data structure [4 Marks]
(b) Outline the steps of designing an algorithm [5 Marks]
(c) Design an algorithm using pseudo code for an array data structure program that calculate
and outputs the sum of six student mark scores keyed in by the user via the keyboard.
Use For loop. [5 Marks]
(d) Present the infix expression given below into prefix format:- [4 Marks]
X=A + B – C/ D*E
(e) Outline two differences between structures and unions [2 Marks]

(Visited 91 times, 1 visits today)