0% found this document useful (0 votes)
845 views7 pages

DS Utech Final May2022

This document contains the instructions and questions for a final exam on data structures. It has two sections - section A contains 20 multiple choice questions testing concepts like data structures, algorithms, complexity analysis and applications. Section B contains 3 questions requiring explanations and solutions involving graph algorithms, expression trees, stacks, binary search trees and the Towers of Hanoi problem.

Uploaded by

Aaliya Burrell
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
845 views7 pages

DS Utech Final May2022

This document contains the instructions and questions for a final exam on data structures. It has two sections - section A contains 20 multiple choice questions testing concepts like data structures, algorithms, complexity analysis and applications. Section B contains 3 questions requiring explanations and solutions involving graph algorithms, expression trees, stacks, binary search trees and the Towers of Hanoi problem.

Uploaded by

Aaliya Burrell
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Utech @ Moneague College Yr2 Time: 3 hours

Data Structures
Final Examination; May 2022

Instruction:
i. Answer all questions in both sections. Include explanation of any assumptions
you may have made in responding to section ‘b’ questions.
ii. Remember to include your name and ID#

1. A data item that can be used to distinguish between two entities (records) is
known as
(A) Alternate key
(B) Primary key
(C) Primary data item
(D) Unique data item

2. A data structure whose elements form a sequence is known as


(A) Heterogeneous data structure
(B) Homogeneous data structure
(C) Linear data structures
(D) Non- linear data structure

3. Which of the following data structure is used to represent hierarchical


relationship among its elements?
(A) Queue
(B) Hash table
(C) Tree
(D) Graph

4. Which of the following statements about a binary tree is not correct?


(A) Every binary tree has at least one node
(B) Every non-empty tree has exactly one root node
(C) Every node has at most two children
(D) Every non-root node has exactly one parent

5. A data structure in which linear sequence is maintained by pointers is known as


(A) Array
(B) Stack
(C) Linked list
(D) Pointer-based data structure
6. Which of the following data structure works on the principle of First Come First
Serve?
(A) Priority queue
(B) Heap
(C) Stack
(D) Queue

7. Which of the following algorithm does not divide the list?


(A) merge sort
(B) binary search
(C) linear search
(D) quick sort

8. The postfix form of the following infix notation is : (A + B)* (C*D − E)* F
(A) AB + CD*E − *F*
(B) AB+ CDE + − * F*
(C) AB+ CD − EF + − **
(D) ABCDEF* − + * +

9. What are the sequence of popped out values if the sequence of operations - push(1), push(2), pop,
push(1), push(2), pop, pop, pop, push(2), pop are performed on a stack.
(A) 2, 2, 1, 1, 2
(B) 2, 2, 1, 2, 2
(C) 2, 1, 2, 2, 1
(D) 2, 1, 2, 2, 2

10. Which notation is used to find the complexity of an algorithm? 


a) Symbolic Notation
b) Big oh Notation
c) Omega Notation
d) Asymptotic Notation

11. When the data structure is combined with its operation then, the data structure is known as 

a) Topology
b) Data Structure
c) Abstract Data Type
d) Multilayered

12. A function which calls itself is called 

a) Recursion
b) Iteration
c) Algorithm
d) Static
13. Linear Search is best for
a) Large arrays
b) Small arrays
c) Sorted array
d) All types of arrays

14. When new data are to be inserted into a data structure, but there is no available space, this
situation is usually called

a) Complete
b) Underflow
c) Overflow
d) Packed

15. Which of the following names does not relate to stacks?

a) LIFO lists
b) FIFO lists
c) Piles
d) Push down list

16. Which of the following is/are the levels of implementation of data structure
A) Abstract level
B) Application level
C) Implementation level
D) All of the above

17. Inserting an item into the stack when stack is not full is called …………. Operation and
deletion of item form the stack, when stack is not empty is called ………..operation

A)pop, push
B) push, pop
C) insert, delete
D) delete, insert

18. Which of the following data structure can’t store the non-homogeneous data elements?
A) Arrays
B) Records
C) Pointers
D) Stacks
19. A ……. is a data structure that organizes data similar to a line in the supermarket, where the
first one in line is the first one out.
A) Stacks linked list
B) Queue linked list
C) Both of them
D) Neither of them

20. To represent hierarchical relationship between elements, which data structure is suitable?
A) Dequeue
B) Priority
C) Tree
D) Graph

21. A directed graph is ………………. if there is a path from each vertex to every other vertex in
the digraph
A) Weakly connected
B) Strongly Connected
C) Tightly Connected
D) Linearly Connected

22. In the …………….. traversal we process all of a vertex’s descendants before we move to an
adjacent vertex.
A) Depth First
B) Breadth First
C) With First
D) Depth Limited

23. Which of the following statements is/are true?


i) Using singly linked lists and circular list, it is not possible to traverse the list backwards.
ii) To find the predecessor, it is required to traverse the list from the first node in case of singly
linked list.
A) i-only
B) ii-only
C) Both i and ii
D) None of bot

24. The property of binary tree is


A) The first subset is called left subtree
B) The second subtree is called right subtree
C) The root cannot contain NULL
D) The right subtree can be empty

25. If the elements '1', '2', '3' and '4' are inserted in a stack, what would be the order for the
removal?
a) 4321
b) 1234
c) 2314
d) 3241

SECTION B
Answer all questions

Question 1:
i. What are the properties of a digraph? [3 marks]
ii. Using vertex 1 as your source of adjacency list/matrix demonstrate the result of running
BFS and DFS on the graph in the picture below. Show the status of the data structure
used at each stage. [10 marks]

i. Outline three characteristics of an Expression tree. [3 marks]

ii. Using a sketch of your own distinguish among the 3 types of linked lists. [2 * 3 marks]

iii. We study structures because they are useful in solving real problems in computer science.
Outline any 3 applications of data structures in real life. [3 marks]
Question 2:
a. Assume stack1 and stack2 to be empty at the beginning of the following sequence of
operations. Show their contents respectively at the end of the sequence. Justify why you
think your answers are correct. [3 + 3 + 1 marks]

Stack1.push(Jesse)
Stack1.push(Ramon)
Stack2.push(Johntae)
Stack2.push(Maldini)
Stack1.pop()
Stack2.getTop(stackTop)
Stack1.push(stackTop)
Stack1.push(Chevon)
Stack2.pop(stackTop)
Stack1 Stack2
Stack2.push(Aaliya)

b. Given the edges and vertices of a directed graph as indicated below, draw a picture of the
graph by using the specified properties:
G = ( V, E)
V(G) = {1, 2, 3, 4, 5, 6}
E(G) = {(1,2), (2, 3), (3, 4), (5,1), (5, 6), (2, 6), (1, 6), (4, 6), (2, 4)} [3 marks]
For the graph you have just drawn: show the
(i) Adjacency matrix [2 marks]
(ii) Write an algorithm for binary search and explain the conditions under which sequential
search of a list is preferred over binary search? [4+4 marks]
(iii) Construct an expression tree for this arithmetic expression: 3+ (4*5-(9+6)) and show the
result at each stage. [5 marks]

Question 3:
a. Construct a BST using the following sequence of numbers in the order given. 47, 32, 87,
34, 68, 72, 15, 24, 30, 66, 11, 50, 8
i. Traverse the BST created using Pre-order technique
ii. Traverse the BST created using in-order technique
iii. Traverse the BST created using Post-order. technique [4+6 marks]

b. Computer Science uses recursion in diverse ways to solve complex problems through
divide and conquer. Let’s say you have been given a stack of three plates; Large, Medium
and Small on table ‘Red’ in the order indicated. There are two other tables; ‘Green’ and
‘Blue’. Using the Towers of Hanoi recursive technique, you are required to transfer all three
plates from table ‘Red’ to table ‘Blue’.

i. What are the rules you must observe to successfully accomplish this task?
ii. How many steps would you have gone through by the time your task is completed?
[10
marks]

You might also like