If you’re looking to test and improve your understanding of graphs and heaps, Graph and Heap data structure mcqs are a great way to practice. Graphs are widely used in networking, pathfinding, and social media connections, while heaps are essential for priority queues and efficient sorting. These MCQs cover key topics such as graph traversal, shortest path algorithms, heaps in priority queues, and time complexities. Whether you’re a student preparing for exams or a programmer revising core concepts, solving these mcqs will help you strengthen your problem-solving skills and gain a deeper understanding of these important data structures
Graph and Heap Data Structure MCQs
- What data structure is used for depth first traversal of a graph?
(a) Queue
(b) Stack
(c) List
(d) Tree
(b) Stack
- Graph traversal is different froma tree traversal, because:
(a) Trees are not connected
(b) Graphs may have loops
(c) Trees have root
(d) None of these
(c) Trees have root
- Graphs are represented using ____________.
(a) Adjacency tree
(b) Adjacency linked list and Matrices
(c) Both a and b
(d) Adjacency queue
(c) Both a and b
- Which of the following is true?
(a) Prim’s algorithm initialises with a vertex
(b) Prim’s algorithm initialises with a edge
(c) Prim’s algorithm initialises with a vertex which has smallest edge
(d) Prim’s algorithm initialises with a forest
(a) Prim’s algorithm initialises with a vertex
- Prim’s & Kruskal algorithm are ________.
(a) Divide and conquer algorithm
(b) Greedy algorithm
(c) Dynamic Programming
(d) Approximation algorithm
(b) Greedy algorithm
- What is the time complexity of Kruskal’s algorithm?
(a) O(log V)
(b) O(E log V)
(c) O(E2)
(d) O(V log E)
(b) O(E log V)
- 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
(a) a tree which is balanced and is a height balanced tree
- Why to prefer AVL trees?*
(a) AVL Tree is easiest to implement.
(b) AVL tree store balance factor in every node which costs space
(c) AVL tree fails at scale
(d) AVL Tree is not efficient
(b) AVL tree store balance factor in every node which costs space
- In a max-heap, element with the greatest key is always in the which node?
(a) Leaf node
(b) First node of left sub tree
(c) Root node
(d) First node of right sub tree
(c) Root node
- Heap Data Structure can be used as _______.
(a) Priority queue
(b) Stack
(c) A decreasing order array
(d) Normal Array
(a) Priority queue
- Depth First Search is equivalent to which of the traversal in the Binary Trees?
(a) Pre-order Traversal
(b) Post-order Traversal
(c) Level-order Traversal
(d) In-order Traversal
(a) Pre-order Traversal
- Time Complexity of Breadth First Search is? (V – number of vertices, E – number of edges)
(a) O(V+E)
(b) o(v)
(c) o(E)
(d) None of the mentioned
(a) O(V+E)
- Symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier (or symbol) in a program’s source code is associated with information relating to its declaration or appearance in the source.
(a) True
(b) False
(a) True
- heap can be used as
(a) Priority queue
(b) Stack
(c) A decreasing order array
(d) Normal Array
(a) Priority queue
- what is the complexity of adding an element to the heap _______.
(a) O(log n)
(b) O(log h)
(c) O(h)
(d) Both A and C
(d) Both A and C
- In a max-heap, element with the greatest key is always in the which node?
(a) Leaf node
(b) First node of left sub tree
(c) Root node
(d) First node of right sub tree
(c) Root node
- what is the complexity of adding an element to the heap
(a) O(log n)
(b) O(nlog n)
(c) nlog
(d) logn
(a) O(log n)
- the worst case complexity of deleting any arbitrary node value element from heap is
(a) O(logn)
(b) O(n)
(c) O(nlogn)
(d) O(n^2)
(a) O(logn)
- A connected planar graph having 6 vertices, 7 edges contains _____________ regions.
(a) 15
(b) 3
(c) 1
(d) 11
(b) 3
- 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
(a) Must be connected
- 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
(b) v = e+1
- A graph with all vertices having equal degree is known as a __________.
(a) Multi Graph
(b) Regular Graph
(c) Simple Graph
(d) Complete Graph
(b) Regular Graph
- 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
(a) Every path is a trail
- 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) r
(d) Information given is insufficient
(b) (n*(n-1)/2)
Related Topics
“Graph and Heap Data Structure MCQs“,”graph data structure mcqs”,”heap data structure mcqs”,”mcq on data structure with answers pdf”,”data structure multiple choice questions and answers doc”,”mcq on graph in dsa”,”Heap Data Structure”,”heap data structure mcqs”