DBIT305  DIT 307  DATA STRUCTURES  ALGORITHMS.

UNIVERSITY EXAMINATIONS: 2016/2017
EXAMINATION FOR THE DIPLOMA IN BUSINESS INFORMATION
TECHNOLOGY & DIPLOMA IN INFORMATION TECHNOLOGY
DBIT305 & DIT 307 DATA STRUCTURES & ALGORITHMS
DATE: AUGUST, 2017 TIME: 2 HOURS
INSTRUCTIONS: Answer Question One & ANY OTHER TWO questions.

QUESTION ONE [30 MARKS] – COMPULSORY
(a)Distinguish between the following terms: – [4 Marks]
(i) Array & structure
(ii) Structure & union
(b) (i)Declare a structure named Lecturer which stores the following data items: [5 Marks]

(ii) From the declared lecturer structure, give the syntax of creating an object named newlecturer
[3 Marks]
(c) Define the following terms as used in programming: – [5 Marks]
(i) Algorithm
(ii) Data structure
(iii)Inbuilt data structure
(iv)Control structure
(v) Greedy algorithm
(d) With the aid of diagrams, describe the following data structures:-
(i) Tree [4 Marks]
(ii) Linked list [4 Marks]
(e) Outline four examples of algorithm designing tools [4 Marks]
QUESTION TWO [20 MARKS]
(a) Write a C++ program that will read six numbers entered by a user and store them in array of
type float. The program should then calculate the sum and average from the numbers stored in
the array and prints the average results. Use for loop statement [7 Marks]
(b)With the aid of an example, describe the sequence control structure [3 Marks]
(c) List and explain four operations supported by a queue data structure [4 Marks]
(d)write a C++ program that adds five data elements into a stack named numbers and displays
the top most element in the stack [6 Marks]
QUESTION THREE [20 MARKS]
(a) (i) Design a flowchart algorithm for a program that calculates the discounted amount on
a product price then displays the calculated discount using the discounting criteria
provided below:- [8 Marks]

Required:
(ii) Implement the program design using C++ [9 Marks]
(iii)Outline three advantages of flowcharts over pseudo code [3 Marks]
QUESTION FOUR [20 MARKS]
(iv) (a)Study the pseudocode provided below and answer the question that follows:-
1. START
2. Declare score1,score2, score3, score4, average, total
3. INPUT score1
4. INPUT score2
5. INPUT score3
6. INPUT score4
7. CALCULATE total=score1+score2+score3+score4
8. CALCULATE average =total/4
9. IF average IS EQUAL OR ABOVE 80 THEN
10. PRINT “Proceed to next stage”
11. ELSE IF average IS EQUAL OR ABOVE 50 BUT LESS THAN 80 THEN
12. PRINT “Try Again”
13. ELSE
14. PRINT “Disqualified
Page 4 of 5
15. ENDIF
16. STOP
Required: convert the above pseudo code into a flowchart [7 Marks]
(b)List and briefly describe two algorithm testing techniques [4 Marks]
(c)Dummy data and live data are often used during system testing. State the circumstances under
which each type of test data is used. [2 Marks]
(d)Describe the following sorting techniques:-
(i) Bubble sort [2 Marks]
(ii) Selection sort [2 Marks]
(e) Janet, a data structures and algorithm 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 answer [3 Marks]
QUESTION FIVE [20 MARKS]
(a) Explain the term ‘linear data structure’ giving three examples of linear data structures [4
Marks]
(b) Explain four guidelines for designing algorithms using a pseudo code [4 Marks]
(c) Convert the following infix expressions into postfix expressions:-
(i) 2*(4+5) /2-7 [2 Marks]
(ii) A*(X+Y/Z) [2 Marks]
(d) Briefly explain the following concepts with regard to a tree data structure: – [5 Marks]
(i) Root
(ii) Leaf
Page 5 of 5
(iii)Path
(iv)Edge
(v) Length
(e) Explain three applications of linked lists [3 Marks]

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

Written by