Get premium membership and access revision papers, questions with answers as well as video lessons.

Comp 123 Question Paper

Comp 123 

Course:Bachelor Of Computer Science

Institution: Kabarak University question papers

Exam Year:2011



COURSE CODE: COMP 123
COURSE TITLE: DATA STRUCTURE
STREAM: Y1S2

INSTRUCTIONS:
1. This question paper has four questions
2. QUESTION ONE IS COMPULSORY AND HAS 30 MARKS
3. Answer any other two questions worth 20 marks

QUESTION ONE (30 marks)
(a) Explain two types of lists with examples in each (2mks)
(b) If we have a list of alphabets from A to F in a table of two columns and three
rows. Show how to declare these elements as array and show their respective
index position(choose any name of the array) (5mks)
(c) What are the respective names of both ends in a queue? (2mks)
(d) What is an algorithm? Give two forms of complexity analysis with examples.
(5mks)
(e) Explain how you can use linked list in stack representation (3mks)
(f) What are the operations in stack? Explain any two (2mks)
(g) What is a hash table? Explain the problem of collision and give its solution.
(4mks)
(h) Explain the structure of a linked list. (2mks)
(i) What is a tree? Explain with the aid of a diagram father, sons, ancestors,
descendants and brothers in binary tree (5mks)

QUESTION TWO (20 marks)
(a) Explain the Tower of Hanoi problem. How many moves will four disks
take(show it mathematically) (5mks)
(b) Write a program in C to store and display integers from 10 to 20 in a one
dimensional array (4mks)
(c) Why is stack considered a dynamic data structure? (2mks)
(d) Explain the two applications of a graph (2mks)
(e) Differentiate between height of a tree and depth of a node (2mks)
(f) What is recursion? Give an example of two mathematical functions which can be
implemented recursively showing the base case and recursive case (5mks)

QUESTION THREE (20 marks)
(a) List three examples; one each for one dimensional array, two dimensional array
and three dimensional array (3mks)
(b) Explain any two examples of linked list. (2mks)
(c) What is a binary tree? Explain breadth first order in binary tree? (5mks)
(d) Why linear queue is considered a limited data structure? What is the solution to
this? (3mks)
(e) Explain underflow and overflow in stack and how to test these conditions in C
language (4mks)
(j) Define graph. What is indegree and outdegree in a graph (3mks)

QUESTION FOUR (20 marks)
(a) Explain the three types of binary tree giving example in each. (3mks)
(b) Explain how you can implement a stack using array. (2mks)
(c) Define binary search tree. Explain searching in binary search tree. (5mks)
(d) Give the distinction between linear probing and quadratic probing (2mks)
(e) Explain best, worst and average analysis of an algorithm. (3mks)
(f) Write an algorithm for inserting in a binary search tree (5mks)






More Question Papers


Popular Exams



Return to Question Papers