Graph Theory Mcqs (2)
Graph Theory Mcqs (2)
Heap Tree:
a. A) O(1)
b. B) O(log n)
c. C) O(n)
d. D) O(n log n)
a. A) Linked List
b. B) Array
d. D) Queue
a. A) 0
b. B) 1
c. C) n-1
d. D) n
a. A) O(1)
b. B) O(log n)
c. C) O(n)
d. D) O(n log n)
element in a heap?
a. A) Heapify Up
b. B) Heapify Down
c. C) Swap
d. D) Rotate
Binary Tree:
a. A) 2
b. B) 1
c. C) 3
d. D) Any number
8. What is the time complexity of searching for an element in a binary tree
(unsorted)?
a. A) O(1)
b. B) O(n)
c. C) O(log n)
d. D) O(n log n)
9. What type of binary tree is fully filled except for the rightmost nodes?
10. Which traversal technique of a binary tree involves visiting the root node,
• A) Preorder Traversal
• B) Inorder Traversal
• C) Postorder Traversal
• A) 1
• B) -1
• C) 0
• D) Infinite
12. Which of the following is NOT a property of a binary tree?
Bubble Sorting:
13. What is the average time complexity of the bubble sort algorithm?
• A) O(n²)
• B) O(n log n)
• C) O(n)
• D) O(1)
15. How many passes are required for bubble sort to completely sort an array of
size n?
• A) n
• B) n/2
• C) n-1
• D) n²
• A) O(n²)
• B) O(n log n)
• C) O(n)
• D) O(1)
17. In bubble sort, if no elements were swapped in the last pass, the algorithm:
• B) Terminates early.
• C) Stops early.
Isomorphism:
• B) They have the same structure, i.e., there exists a one-to-one mapping
graphs?
• A) Vertex labels
• B) Vertex connectivity
• C) Edge weights
• D) Edge direction
21. Which of the following is NOT a necessary condition for two graphs to be
isomorphic?
Bipartite Graph:
• B) It contains no cycles.
23. Which of the following algorithms can be used to check if a graph is bipartite?
• A) Dijkstra’s Algorithm
• C) Kruskal’s Algorithm
• D) Bellman-Ford Algorithm
• C) It is connected.
• D) It has no loops.
• A) Tree
• C) Directed graph
• D) Weighted graph
Binary Search Tree:
26. In a binary search tree, which of the following is true about the left child of a
node?
27. What is the time complexity of searching for a node in a binary search tree (BST)
• A) O(n)
• B) O(log n)
• C) O(n log n)
• D) O(1)
28. What is the time complexity of deleting a node in a binary search tree in the
worst case?
• A) O(n)
• B) O(log n)
• C) O(n log n)
• D) O(1)
29. Which of the following is true for a binary search tree (BST)?
• A) The left subtree of a node contains only nodes with values greater than the node's
value.
• B) The right subtree of a node contains only nodes with values smaller than the
node's value.
• C) The left subtree of a node contains only nodes with values smaller than the
node's value, and the right subtree only contains nodes with greater values.
30. Which traversal method of a binary search tree gives nodes in ascending order
of their values?
• A) Inorder Traversal
• B) Preorder Traversal
• C) Postorder Traversal
31. What is the height of a perfectly balanced binary search tree with 7 nodes?
• A) 2
• B) 3
• C) 4
• D) 1
32. In a binary search tree, what happens if you delete a node with two children?
• B) All nodes in the left subtree have smaller values than the root.
• C) All nodes in the right subtree have smaller values than the root.
34. What is the maximum number of nodes at level ‘l’ in a binary search tree?
• A) 2^l
• B) 2^l - 1
• C) l^2
• D) 2l
35. Which of the following operations can be performed in a binary search tree?
• C) Deletion of an element
Additional:
36. Which sorting algorithm is best suited for nearly sorted data?
• A) Quick Sort
• B) Merge Sort
• C) Bubble Sort
• D) Selection Sort
• B) Insert an element
• C) Remove an element
39. Which of the following properties is true for a perfect binary tree?
40. In the worst case, what is the time complexity of the insertion operation in a
• A) O(log n)
• B) O(n)
• C) O(n log n)
• D) O(1)