You are on page 1of 16

5.

10 Worksheets

5.10 Worksheets
Worksheet 1

Multiple Choice Questions


1. In a time-space tradeoff, time is .............. proportional to space?
A. Directly
B. Indirectly
C. Equal
D. None of above
2. Which of the following is non-liner data structure?
A. Stacks
B. List
C. Strings
D. Trees
3. The operation of processing each element in the list is known as ............
A. sorting
B. merging
C. inserting
D. traversal
4. The elements of a linked list are stored?
A. In a structure
B. In an array
C. Anywhere the computer has space for them
D. In contiguous memory locations
5. The number K in A[k] is called ..........?
A. Integer
B. Subscript
C. Superscript
D. Array
6. Which of following data structure is more appropriate for implementing quick sort iteratively?
A. Deque
B. Queue
C. Stack
D. Priority queue
7. Finding the location of a given item in a collection of items is called ..........
A. Discovering
B. Finding
C. Searching
D. Mining
8. The time complexity of quicksort is .........
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)

198
5.10 Worksheets

9. .......... sorting is good to use when alphabetizing a large list of names.


A. Merge
B. Heap
C. Radix
D. Bubble
10. ......... form of access is used to add and remove nodes from a queue.
A. LIFO, Last In First Out
B. FIFO, First In First Out
C. Both a and b
D. None of these

Subjective Questions
1. Define data structure and various types of data structures.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
2. What are the various types of searching used in Data Structures? Explain with one example?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
3. What is algorithm and complexity? What are the types of algorithm analysis?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................

199
5.10 Worksheets

....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
4. Explain about Linked List Data Structure. What is doubly linked list?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
5. What are the advantages of Binary search over linear search?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
6. What is a difference between graph and tree?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................

200
5.10 Worksheets

Worksheet 2

Multiple Choice Questions


1: The linear relationship between the elements represented by means of pointers is called .............
A. Arrays
B. Linked list
C. Both
D. None
2: Which of the following data structure is required to convert arithmetic expression in infix to its equivalent postfix
notation?
A. Queue
B. Linked list
C. Binary search tree
D. Stack
3: The number of edges in a complete graph of n vertices is
A. n(n+1)
2
B. n(n−1)
2
2
C. n2
D. n
4: If two trees have same structure and but different node content, then they are called ........
A. Synonyms trees
B. Joint trees
C. Equivalent trees
D. Similar trees
5: Quick sort is also known as ..........
A. merge sort
B. tree sort
C. shell sort
D. partition and exchange sort
6: The total number of comparisons in a bubble sort is
A. O(n log n)

B. O(2n)

C. O(n2 )

D. O(n)
7: New nodes are added to the ........... of the queue.
A. Front
B. Back
C. Middle
D. Both A and B
8: The term push and pop is related to
A. Array
B. Lists

201
5.10 Worksheets

C. Stacks
D. Trees
9: Which of the following is an application of stack?
A. finding factorial
B. tower of Hanoi
C. infix to postfix
D. all of the above
10: The situation when in a linked list START=NULL is .........
A. Underflow
B. Overflow
C. Houseful
D. Saturated

Subjective Questions
1. What are the types of queues in Data Structures?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
2. Explain quick sort with an example.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
3. What do you understand by Tower of Hanoi? Explain with one example.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................

202
5.10 Worksheets

....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
4. What is the difference between PUSH and POP with example.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
5. In which condition linked list is better than array and vice versa?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
6. How can AVL Tree be useful in all the operations as compared to Binary search tree.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................

203
5.10 Worksheets

Worksheet 3

Multiple Choice Questions


1: Identify the data structure which allows deletions at both ends of the list but insertion at only one end.
A. Input restricted dequeue
B. Output restricted qequeue
C. Priority queues
D. Stack
2: To represent hierarchical relationship between elements, which data structure is suitable?
A. Deque
B. Priority
C. Tree
D. Graph
3: Minimum number of fields in each node of a doubly linked list is ..............?
A. 2
B. 3
C. 4
D. None of above
4: Which of the following data structure can’t store the non-homogeneous data elements?
A. Arrays
B. Records
C. Pointers
D. Stacks
5: Which is the pointer associated with the availability list?
A. FIRST
B. AVAIL
C. TOP
D. REAR
6: Which of the following are two-way lists?
A. Grounded header list
B. Circular header list
C. Linked list with header and trailer nodes
D. List traversed in two directions
7: A parentheses checker program would be best implemented using
A. List
B. Queue
C. Stack
D. Any of the above
8: If two trees have same structure and node content, then they are called ..........
A. Synonyms trees
B. Joint trees
C. Equivalent trees
D. Similar trees
9: The worst-case time required to search a given element in a sorted linked list of length n is
A. O(1)

205
5.10 Worksheets

B. O(log2 n)
C. O(n)
D. O(n log2 n)
10: Traversing a binary tree first root and then left and right subtrees called ......... traversal.
A. Postorder
B. Preorder
C. Inorder
D. None of these

Subjective Questions
1. What is the prefix and post fix notation of (a + b) * (c + d) ?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
2. How insertion sort and selection sorts are different?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
3. Explain the types of algorithm with examples.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................

206
5.10 Worksheets

....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
4. Explain the rate of growth. Which is commonly used with the help of table?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
5. Which data structure is used to perform recursion?.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
6. What is merge sort and how it works?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................

207
5.10 Worksheets

Worksheet 4

Multiple Choice Questions


1: A graph is a tree if and only if graph is
A. Directed graph
B. Contains no cycles
C. Planar
D. Completely connected
2: A binary tree in which all its levels except the last, have maximum numbers of nodes, and all the nodes in the
last level have only one child it will be its left child. Name the tree.
A. Threaded tree
B. Complete binary tree
C. M-way search tree
D. Full binary tree
3: A full binary tree with n non-leaf nodes contains
A. log(n) nodes
B. n + 1 nodes
C. 2n − 1 nodes
D. 2n + 1 nodes
4: ............. deque is a deque which allows deletions at only one end of the list.
A. input-restricted
B. output-restricted
C. Queue
D. Heap
5: Which of the following statements is True?
A. Preorder- Process the root, Traverse the left subtree, traverse the right subtree.
B. Preorder- Traverse the left subtree, process the root, traverse the right subtree.
C. Preorder- Traverse the left subtree, traverse the right subtree, process the root.
D. None of above.
6: The data structure required to evaluate a postfix expression is
A. Queue
B. Stack
C. Tree
D. linked-list
7: Reverse polish notation is ..........
A. Prefix
B. Infix
C. Postfix
D. None
8: The time complexity of linear search algorithm over an array of n elements is
A. O(log2 n)
B. O(n)
C. O(n log2 n)
D. O(n2 )
9: Which of the following sorting algorithms does not have a worst case running time of O(n2 )?

208
5.10 Worksheets

A. Insertion sort
B. Merge sort
C. Quick sort
D. Bubble sort
10: A search begins the search with the element that is located in the middle of the array
A. serial
B. random
C. parallel
D. binary

Subjective Questions
1. What is hashing? Explain different hashing techniques in detail.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
2. What is a postfix expression?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
3. What is Graph? What are the types of graph?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................

209
5.10 Worksheets

....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
4. Which data structures are used in BFS and DFS algorithm?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
5. Explain the terms: null tree, left and right successor, terminal nodes, similar and copy tree.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
6. What are the differences between BST and AVL tree?
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................

210
5.10 Worksheets

Worksheet 5

Multiple Choice Questions


1: The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19. Which one of the following is the
postorder traversal of the tree?
A. 10, 11, 12, 15, 16, 18, 19, 20
B. 11, 12, 10, 16, 19, 18, 20, 15
C. 20, 19, 18, 16, 15, 12, 11, 10
D. 19, 16, 18, 20, 11, 12, 10, 15
2: A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed effi-
ciently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)?
A. Both operations can be performed in O(1) time.
B. At most one operation can be performed in O(1) time, but the worst-case time for the other operation will
be Ω(n).
C. The worst-case time complexity for both operations will be Ω(n).
D. Worst-case time complexity for both operations will be Ω(log n).
3: The result of evaluating the postfix expression 10 5 + 60 6/ ∗ 8 − is
A. 284
B. 213
C. 142
D. 71
4: A program P reads in 500 integers in the range [0, 100], representing the scores of 500 students. It then prints
the frequency of each score above 50. What would be the best way for P to store the frequencies?
A. An array of 50 numbers
B. An array of 100 numbers
C. An array of 500 numbers
D. A dynamically allocated array of 550 numbers
5: Consider the following statements:
(i) First-in-first-out types of computations are efficiently supported by STACKS.
(ii) Implementing LISTS on linked lists is more efficient than implementing LISTS on an array for almost all
the basic LIST operations.
(iii) Implementing QUEUES on a circular array is more efficient than implementing QUEUES on a linear array
with two indices.
(iv) Last-in-first-out type of computations are efficiently supported by QUEUES.
Which of the following statements is/are true?
A. (ii) and (iii) are true
B. (i) and (ii) are true
C. (iii) and (iv) are true
D. (ii) and (iv) are true
6: The postorder traversal of a binary tree is 8, 9, 6, 7, 4, 5, 2, 3, 1. The inorder traversal of the same tree is 8, 6, 9, 4, 7, 2, 5, 1, 3.
The height of a tree is the length of the longest path from the root to any leaf. Then the height of the binary tree
is _________.
A. 5
B. 4
C. 10

211
5.10 Worksheets

Figure 5.1: Binary Tree

D. 1
7: Following are pass outputs of a program for an algorithm: 22, 14, 56, 7, 25, 8
Pass 1: 7, 14, 56, 22, 25, 8
Pass 2: 7, 8, 56, 22, 25, 14
And so on...
Final: 7, 8, 14, 22, 25, 56
Choose the name of the associated algorithm for the above results.
A. Selection sort
B. Insertion sort
C. Bubble Sort
D. Merge Sort
8: Following are the pass outputs of a program for an algorithm: 22, 14, 56, 7, 25, 8
Pass 1: 14, 22, 56, 7, 25, 8
Pass 2: 14, 22, 56, 7, 25, 8
Pass 3: 7, 14, 22, 56, 25, 8
And so on...
Final: 7, 8, 14, 22, 25, 56
Choose the name of the associated algorithm for the above results.
A. Selection sort
B. Insertion sort
C. Bubble Sort
D. Merge Sort
9: Following are the pass outputs of a program for an algorithm: 22, 14, 56, 7, 25, 8
Pass 1: 14, 22, 7, 25, 8, 56
Pass 2: 14, 7, 22, 8, 25, 56
And so on...
Final: 7, 8, 14, 22, 25, 56
Choose the name of the associated algorithm for the above results.
(A) Selection sort
(B) Insertion sort
(C) Bubble Sort
(D) Merge Sort
10: Array representation of Binary tree
0 1 2 3 4 5 6
A.
7 11 2 7 1 11 9

212
5.10 Worksheets

0 1 2 3 4 5 6
B.
7 11 7 1 2 11 9
0 1 2 3 4 5 6
C.
7 1 11 11 9 2 7
D. Any of the above

Subjective Questions
1. Define the properties of recursion. Explain factorial.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
2. Explain the all-possible complexities (best, worst and average case) in a table.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
3. What are records? Explain record structure with one example.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................

213
5.10 Worksheets

....................................................................................................
4. Create a BST tree with the following data by inserting the elements in order of their occurrence: 200, 150, 350,
100, 70, 110, 250, 500, 400, 550, 450
Delete the following nodes in sequential order: 150, 500, 450, 200, 110
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
5. Consider the graph given below. Find out its Breadth-First Traversal and show each steps.

Figure 5.2: Graph

Note: consider starting node as r


....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
6. What do you mean by collision in hashing. Explain different techniques of collision resolution.
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................
....................................................................................................

214

You might also like