• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Graph Data Strcuture with Answers

Question 21

In the following graph, discovery time stamps and finishing time stamps of Depth First Search (DFS) are shown as x/y, where x is discovery time stamp and y is finishing time stamp. "36
It shows which of the following depth first forest?
  • {a, b, e} {c, d, f, g, h}
  • {a, b, e} {c, d, h} {f, g}
  • {a, b, e} {f, g} {c, d} {h}
  • {a, b, c, d} {e, f, g} {h}

Question 22

Consider a segment tree built on an array of N elements. What is the minimum number of node updates required to rebuild the entire tree if the original array is reversed?

  • N

  • N - 1

  • 2N - 1

  • N log N

Question 23

Which of the following according to you is incorrect?

  • Trie is also known as prefix tree

  • Trie requires less storage space than hashing

  • Trie allows listing of all the words with same prefix

  • Tries are collision free

Question 24

Which of the following statements about disjoint-set forests is false?

  • Disjoint-set forests can be used to efficiently detect cycles in a graph.

  • Disjoint-set forests can handle disconnected components efficiently.

  • The union operation in disjoint-set forests can be performed in constant time.

  • Disjoint-set forests are commonly used in minimum spanning tree algorithms.

Question 25

In an undirected connected planar graph G, there are eight vertices and five faces. The number of edges in G is _________.
  • 10
  • 11
  • 12
  • 6

Question 26

Consider the following undirected graph with edge weights as shown: The number of minimum-weight spanning trees of the graph is ___________.
  • 3
  • 4
  • 5
  • 2

Question 27

The cyclomatic complexity of the flow graph of a program provides  

  • an upper bound for the number of tests that must be conducted to ensure that all statements have been executed at most once

  • a lower bound for the number of tests that must be conducted to ensure that all statements have been executed at most once

  • an upper bound for the number of tests that must be conducted to ensure that all statements have been executed at least once

  • a lower bound for the number of tests that must be conducted to ensure that all statements have been executed at least once

Question 28

What is the largest integer m such that every simple connected graph with n vertices and n edges contains at least m different spanning trees?
  • 1
  • 2
  • 3
  • n

Question 29

Which of the following is an advantage of adjacency list representation over adjacency matrix representation of a graph?
  • In adjacency list representation, space is saved for sparse graphs.
  • DFS and BSF can be done in O(V + E) time for adjacency list representation. These operations take O(V^2) time in adjacency matrix representation. Here is V and E are number of vertices and edges respectively.
  • Adding a vertex in adjacency list representation is easier than adjacency matrix representation.
  • All of the above

Question 30

What is the worst case efficiency for a path compression algorithm?
  • O(M log N)
  • O(N log N)
  • O(log N)
  • O(N)

There are 38 questions to complete.

Last Updated :
Take a part in the ongoing discussion