0% found this document useful (0 votes)
3 views12 pages

Graph Theory Mcqs (2)

Uploaded by

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

Graph Theory Mcqs (2)

Uploaded by

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

Graph Theory Mcqs

Heap Tree:

1. What is the time complexity of inserting an element into a heap?

a. A) O(1)

b. B) O(log n)

c. C) O(n)

d. D) O(n log n)

2. Which of the following is true for a max heap?

a. A) The parent node is greater than its children.

b. B) The parent node is smaller than its children.

c. C) Both children must be equal to the parent node.

d. D) There is no ordering between parent and children nodes.

3. Which data structure is typically used for implementing a heap?

a. A) Linked List

b. B) Array

c. C) Binary Search Tree

d. D) Queue

4. In a binary heap, the position of the root node is always at index:

a. A) 0

b. B) 1
c. C) n-1

d. D) n

5. What is the space complexity of a binary heap?

a. A) O(1)

b. B) O(log n)

c. C) O(n)

d. D) O(n log n)

6. Which operation is performed to maintain the heap property after inserting an

element in a heap?

a. A) Heapify Up

b. B) Heapify Down

c. C) Swap

d. D) Rotate

Binary Tree:

7. How many children can each node have in a 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?

a. A) Complete Binary Tree

b. B) Complete Binary Tree

c. C) Full Binary Tree

d. D) Perfect Binary Tree

10. Which traversal technique of a binary tree involves visiting the root node,

followed by the left subtree, then the right subtree?

• A) Preorder Traversal

• B) Inorder Traversal

• C) Postorder Traversal

• D) Level Order Traversal

11. What is the height of an empty binary tree?

• A) 1

• B) -1

• C) 0

• D) Infinite
12. Which of the following is NOT a property of a binary tree?

• A) Each node has at most two children.

• B) The left and right subtrees are of equal size.

• C) The root node has no parent node.

• D) It can have leaf nodes.

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)

14. Which of the following is true about bubble sort?

• A) It is very efficient for large datasets.

• B) It repeatedly swaps adjacent elements if they are in the wrong order.

• C) It only compares adjacent elements once.

• D) It sorts in O(n log n) time.

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²

16. What is the worst-case time complexity of bubble sort?

• 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:

• A) Continues sorting further.

• B) Terminates early.

• C) Stops early.

• D) Sorts in reverse order.

Isomorphism:

18. Two graphs are isomorphic if:

• A) They are connected.

• B) They have the same structure, i.e., there exists a one-to-one mapping

between their vertices.

• C) They have the same number of edges.

• D) They have the same weight on edges.


19. Which of the following properties is preserved in an isomorphism between two

graphs?

• A) Vertex labels

• B) Vertex connectivity

• C) Edge weights

• D) Edge direction

20. How do you determine if two graphs are isomorphic?

• A) By checking if they have the same number of edges.

• B) By finding a one-to-one correspondence between vertices and edges.

• C) By comparing their adjacency matrices.

• D) By checking if they have the same number of vertices.

21. Which of the following is NOT a necessary condition for two graphs to be

isomorphic?

• A) Same number of vertices

• B) Same number of edges

• C) Same degree sequence

• D) Same edge weights

Bipartite Graph:

22. What is the defining characteristic of a bipartite graph?


• A) The graph can be divided into two disjoint sets such that no two vertices

within the same set are adjacent.

• B) It contains no cycles.

• C) All vertices have the same degree.

• D) All edges are directed.

23. Which of the following algorithms can be used to check if a graph is bipartite?

• A) Dijkstra’s Algorithm

• B) Breadth-First Search (BFS)

• C) Kruskal’s Algorithm

• D) Bellman-Ford Algorithm

24. A graph is bipartite if and only if:

• A) It contains an even cycle.

• B) It does not contain any odd-length cycles.

• C) It is connected.

• D) It has no loops.

25. Which of the following types of graphs is always bipartite?

• A) Tree

• B) Complete bipartite graph

• 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?

• A) It must have a value smaller than its parent node.

• B) It must have a value greater than its parent node.

• C) It can have any value.

• D) It must be the leaf node.

27. What is the time complexity of searching for a node in a binary search tree (BST)

in the worst case?

• 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.

• D) The tree can have any structure as long as it's binary.

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

• D) Level Order 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?

• A) The tree becomes unbalanced.

• B) The node is simply removed.

• C) The node is replaced by its in-order successor or predecessor.


• D) The node is replaced by the left child.

33. Which of the following is NOT a property of a binary search tree?

• A) Every node has at most 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.

• D) Inorder traversal gives nodes in descending order.

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?

• A) Searching for an element

• B) Insertion of a new element

• C) Deletion of an element

• D) All of the above

Additional:

36. Which sorting algorithm is best suited for nearly sorted data?

• A) Quick Sort

• B) Merge Sort
• C) Bubble Sort

• D) Selection Sort

37. A binary tree is called a full binary tree if:

• A) Every node has two children except for the leaves.

• B) Every node has exactly two children.

• C) Every node has either 0 or 2 children.

• D) It has only one root.

38. Which of the following operations can be performed on a heap?

• A) Find the minimum or maximum element

• B) Insert an element

• C) Remove an element

• D) All of the above

39. Which of the following properties is true for a perfect binary tree?

• A) All levels except the last are completely filled.

• B) All leaf nodes are at the same level.

• C) It has a height of log(n).

• D) The tree is always balanced.

40. In the worst case, what is the time complexity of the insertion operation in a

binary search tree?

• A) O(log n)

• B) O(n)

• C) O(n log n)
• D) O(1)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy