DS Bit Bank
DS Bit Bank
DS Bit Bank
a) 2, 7, 2, 6, 5, 11, 5, 9, 4
b) 2, 7, 5, 2, 6, 9, 5, 11, 4
c) 2, 5, 11, 6, 7, 4, 9, 5, 2
d) 2, 7, 5, 6, 11, 2, 5, 4, 9
30. For the tree below, write the post-order traversal. [ ]
a) 2, 7, 2, 6, 5, 11, 5, 9, 4
b) 2, 7, 5, 2, 6, 9, 5, 11, 4
c) 2, 5, 11, 6, 7, 4, 9, 5, 2
d) 2, 7, 5, 6, 11, 2, 5, 4, 9
31. To obtain a prefix expression, which of the tree traversals is used? [ ]
a) Level-order traversal b) Pre-order traversal c) Post-order traversal d) In-order traversal
32. What is an AVL tree? [ ]
a) a tree which is balanced and is a height balanced tree
b) a tree which is unbalanced and is a height balanced tree
c) a tree with three children
d) a tree with atmost 3 children
33. Why we need to a binary tree which is height balanced? [ ]
a) to avoid formation of skew trees
b) to save memory
c) to attain faster memory access
d) to simplify storing
34. What is the maximum height of an AVL tree with p nodes? [ ]
a) p b) log(p) c) log(p)/2 d) p⁄2
35. What is the special property of red-black trees and what root should always be? [ ]
a) a color which is either red or black and root should always be black color only
b) height of the tree
c) pointer to next node
d) a color which is either green or black
38. While inserting into ………………………….., insertions are done at a leaf and will replace an external node with an
internal node with two external children. [ ]
A) red-black tree B) AVL tree C) binary search tree D) binary heap tree
39. The order with which the nodes are inserted affects the running time of the ……………………. search algorithm.
A) AVL Tree B) Red-Black Tree C) Binary Search Tree D) Binary Heap Tree
40The order with which the nodes are inserted affects the running time of the ……………………. search algorithm.
A) AVL Tree [ ]
B) Red-Black Tree
C) Binary Search Tree
D) Binary Heap Tree
UNIT-IV
1.A Graph where each vertex is connected to all other vertices is called___ [ ]
A)Completely Connected B)Directed Graphs C)Cyclic Graphs D)All
2. which of the following implementation of hash table is collision free? [ ]
A)array B)linked list(chaining) C)both a&b D)none
3.secondary clustering doesn’t occur in following type of closed hashing technique? [ ]
A)Quadratic probing B)linear probing C)random probing D)both a &b
4. In which of the following,Hash table is an array of pointers
(i.e collection of memory addresses) [ ]
A)open hashing B)closed hashing C)chaining D)both a&c
5. In which of the following hash table implementations,elements(keys)
are organized as linked lists? [ ]
A)open addressing B)chaining C)closed hashing D) both a&c
6. Let us suppose ,hash table of size(n)=6.If collision occurred at index “4” then
if we use linear probing then sequence of probed indices Would be? [ ]
A)5-0-1-2-3 B)1-2-3-4-5 C)4-5-0-1-2 D)none
7. consider key=122466,hash table size(n)=100 &hash table index starts from “0”.
Identify the location of above key using “pure folding “ hashing method [ ]
A)102 B)10 C)2 D)none
8. consider key=122466,hash table size(n)=100 &hash table index starts from “0”.
Identify the location of above key using “digit analysis “ hashing method
(consider numbers at even positions from left to right) [ ]
A)246 B)642 C)266 D)none
9.Arrangement of given data in dictionary order is called [ ]
A)ascending B)descending C)lexicographic D)none
10. Hash table is a kind of ? [ ]
A)Array B)Linked list C)table D)set
11.Which of the following is associated with graph? [ ]
A)BFS B)DFS C)cycle D)all
12.shortest path finding” is an application of ? [ ]
A)tree B)graph C)binary tree D)none
13. If there is a path between any two vertices in a graph then it is called [ ]
A)simple graph B)connected graph C)complete graph D)path graph
14. A graph in which there exists a path between any two of its nodes is called [ ]
A)Complete graph B)Connected graph C) Digraph D) In-directed graph
15. Which is the most appropriate matching for the following pairs? [ ]
X: depth-first search 1: heap
Y: breadth-first search 2: queue
Z: sorting 3: stack
A)X–1, Y–2, Z–3 B)X–3, Y–1, Z–2
C)X–3, Y–2, Z–1 D)X–2, Y–3, Z–
16. Which of the following is associated with graph? [ ]
A)BFS B)DFS C)cycle D)all
17. In which of the following collision resolution techniques,an index in a hash table can
accommodate more than one key? [ ]
A)chaining B)closed hashing C)both a&b D)none
18. In which of the following hash table implementations,elements(keys)
are organized as linked lists? [ ]
A)open addressing B)chaining C)closed hashing D) both a&
19. Insert keys “2,6,10,3,40,11,46,49” into a hash table of size(n)=7 using chaining
collision resolution technique then What will be the previous element of “11”? [ ]
A)46 B)49 C)40 D)none
20. In which of the following collision resolution techniques,an index in
a hash table can accommodate more than one key? [ ]
A)chaining B)bucket hashing C)both a&b D)none
21. In Binary Search if the Search element is greater than the mid then the condition is [ ]
A)left= mid +1 B)right= mid-1 C)mid = (left+right)/2 D)None
22. The Binary Search Algorithms needs theelements to be in ________ Order [ ]
A)Ascending B)Random C)Both D)None
23. Which of the following searching is faster than others? [ ]
A)linear B)binary C)hashed search D)sentinel
24. Which of the following searching requires less time [ ]
A)sequential B)linear C)binary D)sentinel
25. The process of identifying or finding index(location of a key(element) in a given set
of numbers is called [ ]
A)searching B)finding C)identifying D)none
26. This set of Data Structure Multiple Choice Questions & Answers (MCQs) focuses on “Graph”.
26. Which of the following statements for a simple graph is correct? [ ]
a) Every path is a trail
b) Every trail is a path
c) Every trail is a path as well as every path is a trail
d) Path and trail have no relation
27. What is the number of edges present in a complete graph having n vertices? [ ]
a) (n*(n+1))/2
b) (n*(n-1))/2
c) n
d) Information given is insufficient
28. In a simple graph, the number of edges is equal to twice the sum of the degrees of the vertices[ ].
a) True
b) False
29. A connected planar graph having 6 vertices, 7 edges contains _____________ regions. [ ]
a) 15
b) 3
c) 1
d) 11
30. Which of the following properties does a simple graph not hold? [ ]
a) Must be connected
b) Must be unweighted
c) Must have no loops or multiple edges
d) Must have no multiple edges
31. What is the maximum number of edges in a bipartite graph having 10 vertices? [ ]
a) 24
b) 21
c) 25
d) 16
33. For a given graph G having v vertices and e edges which is connected and has no cycles, which of the
following statements is true? [ ]
a) v=e
b) v = e+1
c) v + 1 = e
d) v = e-1
34. A graph with all vertices having equal degree is known as a __________ [ ]
a) Multi Graph
b) Regular Graph
c) Simple Graph
d) Complete Graph
36. Dijkstra’s Algorithm will work for both negative and positive weights? [ ]
a) True
b) False
37. A graph having an edge from each vertex to every other vertex is called a ___________ [ ]
a) Tightly Connected
b) Strongly Connected
c) Weakly Connected
d) Loosely Connected
a) ABCED
b) AEDCB
c) EDCBA
d) ADECB
39. What is the maximum number of edges present in a simple directed graph with 7 vertices if there exists no
cycles in the graph? [ ]
a) 21
b) 7
c) 6
d) 49
40. All Graphs have unique representation on paper. [ ]
a) True
b) False
UNIT-V
1. Which of the following is not a stable sorting algorithm? [ ]
a) Insertion sort b) Selection sort c) Bubble sort d) Merge sort
2. Which of the following is a stable sorting algorithm? [ ]
a) Merge sort b) Typical in-place quick sort c) Heap sort d) Selection sort
3. Which of the following is not an in-place sorting algorithm [ ]
a) Selection sort b) Heap sort c) Quick sort d) Merge sort
4. Running merge sort on an array of size n which is already sorted is [ ]
a) O(n)b) O(nlogn) c) O(n2) d) None
5. The time complexity of a quick sort algorithm which makes use of median, found by an O(n)
algorithm, as pivot element is [ ]
a) O(n2) b) O(nlogn) c) O(nloglogn)d) O(n)
6. Which of the following is not a noncomparison sort? [ ]
a) Counting sort b) Bucket sort c) Radix sort d) Shell sort
7. The time complexity of heap sort in worst case is [ ]
a) O(logn) b) O(n)c) O(nlogn) d) O(n2)
8. If the given input array is sorted or nearly sorted, which of the following algorithm gives the best
performance? [ ]
a) Insertion sort b) Selection sort c) Quick sort d) Merge sort
9. Which of the following algorithm pays the least attention to the ordering of the elements in the input
list? [ ]
a) Insertion sort b) Selection sort c) Quick sort d) None
10. Consider the situation in which assignment operation is very costly. Which of the following sorting
algorithm should be performed so that the number of assignment operations is minimized in general
a) Insertion sort b) Selection sort c) Heap sort d) None [ ]
11. Time complexity of bubble sort in best case is [ ]
a) θ (n) b) θ (nlogn) c) θ (n2) d) θ (n(logn) 2)
12. Given a number of elements in the range [0….n3]. which of the following sorting algorithms can sort
them in O(n) time? [ ]
a) Counting sort b) Bucket sort c) Radix sort d) Quick sort
13. Which of the following algorithms has lowest worst case time complexity? [ ]
a) Insertion sort b) Selection sort c) Quick sort d) Heap sort
14. Which of the following sorting algorithms is/are stable [ ]
a) Counting sort b) Bucket sort c) Radix sort d) All of the above
15. Counting sort performs …………. Numbers of comparisons between input elements. [ ]
a) 0 b) n c) nlogn d) n2
16. The running time of radix sort on an array of n integers in the range [0……..n5 -1] when using base
10 representation is [ ]
a) θ (n) b) θ (nlogn) c) θ (n2) d) none
17. The running time of radix sort on an array of n integers in the range [0……..n5 -1] when using base n
representation is [ ]
a) θ (n) b) θ (nlogn) c) θ (n2) d) None
18. Which of the following sorting algorithm is in-place [ ]
a) Counting sort b) Radix sort c) Bucket sort d) None
19. The radix sort does not work correctly if each individual digit is sorted using [ ]
a) Insertion sort b) Counting sort c) Selection sort d) Bubble sort
20. Which of the following sorting algorithm has the running time that is least dependant on the initial
ordering of the input? [ ]
a) Insertion sort b) Quick sort c) Merge sort d) Selection sort
21. Time complexity to sort elements of binary search tree is [ ]
a) O(n) b) O(nlogn) c) O(n2) d) O(n2logn)
22. The lower bound on the number of comparisons performed by comparison-based sorting algorithm is
a) Ω (1) b) Ω (n) c) Ω (nlogn) d) Ω (n2) [ ]
23. Which of the following algorithm(s) can be used to sort n integers in range [1…..n3] in O(n) time?
a) Heap sort b) Quick sort c) Merge sort d) Radix sort [ ]
24. Which of the following algorithm design technique is used in the quick sort algorithm?[ ]
a) Dynamic programming b) Backtracking c) Divide-and-conquer d) Greedy method
25. Merge sort uses [ ]
a) Divide-and-conquer b) Backtracking c) Heuristic approach d) Greedy
approach
26. For merging two sorted lists of size m and n into sorted list of size m+n, we require comparisons of
a) O(m) b) O(n) c) O(m+n) d) O(logm + logn) [ ]
27. A sorting technique is called stable if it [ ]
a) Takes O(nlogn) times
b) Maintains the relative order of occurrence of non-distinct elements
c) Uses divide-and-conquer paradigm
d) Takes O(n) space
28. In a heap with n elements with the smallest element at the root, the seventh smallest element can be
found in time [ ]
a) θ (nlogn) b) θ (n) c) θ (logn) d) θ (1)
29. What would be the worst case time complexity of the insertion sort algorithm, if the inputs are
restricted to permutation of 1…..n with at most n inversion? [ ]
a) θ (n2) b) θ (nlogn) c) θ (n1.5) d) θ (n)
30. In a binary max heap containing n numbers, the smallest element can be found in time[ ]
a) θ (n) b) θ (logn) c) θ (loglogn) d) θ (1)
31.In which sorting, consecutive adjacent pairs of elements in the array are compared with each other?
[ ]
A) Bubble sort B) Selection sort C) Merge sort D) Radix sort
32. Which of the following sorting methods will be the best if the number
of swappings done is theonly measure of efficiency? [ ]
A) Bubble sort B) Selection sort C) Insertion sort D) Quick sort
33. In ordered search elements are arranged in [ ]
A)random B)descending C)ascending D)none
34. What is the worst case complexity of bubble sort? [ ]
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
36. Which of the following is not an advantage of optimised bubble sort over other sorting techniques in case
of sorted elements? [ ]
a) It is faster
b) Consumes less memory
c) Detects whether the input is already sorted
d) Consumes less time
37. What is the best case efficiency of bubble sort in the improvised version? [ ]
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)