# DIT 307DBIT305  DATA STRUCTURES  ALGORITHMS.

UNIVERSITY EXAMINATIONS: 2017/2018
EXAMINATION FOR THE DIPLOMA IN BUSINESS INFORMATION
TECHNOLOGY & DIPLOMA IN INFORMATION TECHNOLOGY
DIT 307&DBIT305 DATA STRUCTURES & ALGORITHMS
FULLTIME/PARTIME
DATE: AUGUST, 2018 TIME: 1 ½ HOURS
INSTRUCTIONS: Answer question One and ANY other two questions.

QUESTION ONE [30 MARKS]
(a) Outline the steps of designing an algorithm [5 Marks]
(b)Explain the following attributes of a tree data structure: – [4 Marks]
(i) Root node
(ii) Path
(iii)Edge
(iv)Leaf
(c) Explain the following terms:-
(i) Data structure
(ii) Algorithm
(iv)Variable
(v) Data type [5 Marks]
(c) Figure 1 shows a flowchart for computing tax in Mickmart’s Company Ltd. Study it and

(i) Convert the above flowchart into pseudo code [6 Marks]
(ii) Write a C++ or C program that will implement the flowchart in figure 1.
Note: Use the if-else statement. [8 Marks]
(iii) State two limitations of flowcharts [2 Marks]
QUESTION TWO [20 MARKS]
(a) With the aid of diagrams, describe the following data structures:-
(i) Queues [4 Marks]
(ii) Stacks [4 Marks]
(b) Write a C or C++ program that would read a list of 10 numbers in an array and calculate and
output the sum of the entered numbers [7 Marks]
(c) The following data provides details of employees in a particular company:

Name-at least 20 characters
Sex-M or F
Age-integer
Status-Married or Single
Required:-State and declare a data structure in C++/ C programming language that could be
used to store the employee details [5 Marks]
QUESTION THREE [20 MARKS]
(a) Mickmart Company Ltd deals with computer accessories. The validity of the order details
keyed-in are verified using data from accessory details and data on the credit status of the
customer from the customer file stored on a disk. A valid order is then kept in a pending
orders file on a disk, otherwise an error report is generated.
The accessories that must be obtained from the suppliers are then assembled using the order
details from the pending orders file and the suppliers details from the suppliers file stored on
a tape. A purchase requisition is then raised which is sent to the supplier while the
requisition details are kept in the purchase orders file on disk. The customer order is then
processed and an invoice printed.

Required:-Draw a system flow chart to represent the above information [8 Marks]
(b) Compare a single linked list and a double linked list [4 Marks]
(c) Outline four data operations supported by an array data structure [4 Marks]
(d) Describe the following sorting techniques:- [4 Marks]
(i) Bubble sort
(ii) Selection sort
QUESTION FOUR [20 MARKS]
(a) Explain six features of a good algorithm [6 Marks]
(b) Highlight six different tools that can be used for developing an algorithm [6 Marks]
(c) Outline four operations that can be performed on a linked list [4 Marks]
(d) Distinguish between the following terms:- [4 Marks]
(i) Static array and dynamic array
(ii) One dimensional and two dimensional arrays
QUESTION FIVE [20 MARKS]
(a) A Queue contains the following elements: 4, 13, and 60 with 77 being the first element.
Explain the effect of the following operations on the contents of the queue: – [6 Marks]
(i) Front()
(ii) Deque()
(iii) Pop()
(b)Explain any two computing resources that are likely to impact on the efficiency of a computer
program [4 Marks]
(c) With the aid of an example, describe the sequence control structure [5 Marks]
(d) Njeri, a programming student intends to create a program to generate a multiplication table.
Suggest the most appropriate data structure she could use to achieve her objective justifying your