• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Graph Traversals with Answers

Question 21

In an adjacency list representation of an undirected simple graph G = (V, E), each edge (u, v) has two adjacency list entries: [v] in the adjacency list of u, and [u] in the adjacency list of v. These are called twins of each other. A twin pointer is a pointer from an adjacency list entry to its twin. If |E| = m and |V | = n, and the memory size is not a constraint, what is the time complexity of the most efficient algorithm to set the twin pointer in each entry in each adjacency list?
  • Θ(n2)
  • Θ(m+n)
  • Θ(m2)
  • Θ(n4)

Question 22

Let G = (V, G) be a weighted undirected graph and let T be a Minimum Spanning Tree (MST) of G maintained using adjacency lists. Suppose a new weighed edge (u, v) ∈ V×V is added to G. The worst case time complexity of determining if T is still an MST of the resultant graph is
  • Θ(∣E∣ + ∣V∣)
  • Θ(∣E∣.∣V∣)
  • Θ(E∣ log ∣V∣)
  • Θ(∣V∣)

Question 23

An articulation point in a connected graph is a vertex such that removing the vertex and its incident edges disconnects the graph into two or more connected components. 

Let T be a DFS tree obtained by doing DFS in a connected undirected graph G. Which of the following options is/are correct?

  • Root of T can never be an articulation point in G.

  • Root of T is an articulation point in G if and only if it has 2 or more children.

  • A leaf of T can be an articulation point in G.

  • If u is an articulation point in G such that x is an ancestor of u in T and y is a descendent of u in T, then all paths from x to y in G must pass through u.

Question 24

Consider the following directed graph: Which of the following is/are correct about the graph?
  • The graph does not have a topological order
  • A depth-first traversal starting at vertex S classifies three directed edges as back edges
  • The graph does not have a strongly connected component
  • For each pair of vertices u and v, there is a directed path from u to v

Question 25

In a directed acyclic graph with a source vertex s, the quality-score of a directed path is defined to be the product of the weights of the edges on the path. Further, for a vertex v other than s, the quality-score of v is defined to be the maximum among the quality-scores of all the paths from s to v. The quality-score of s is assumed to be 1. The sum of the quality-scores of all vertices on the graph shown above is _______ .
  • 929
  • 81
  • 729
  • 1023

Question 26

Consider a complete binary tree with 7 nodes. Let A denote the set of first 3 elements obtained by performing Breadth-First Search (BFS) starting from the root. Let B denote the set of first 3 elements obtained by performing Depth-First Search (DFS) starting from the root. The value of ∣A−B∣ is _____________ .
  • 1
  • 2
  • 3
  • 4

Question 27

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?

  • v= e-1

  • e= v-2

  • v=e+1

  • None

Question 28

Which data structure is commonly used to implement the navigation system in a mapping application, helping users find the shortest route between locations?

  • Heap

  • Stack

  • Graph

  • Queue

Question 29

Identify the following Representation of the graph.

adjacency_mat1


  • Adjacency List

  • Adjacency Matrix

  • Both

  • None

Question 30

Which of the following statement is correct?

P1: Every tree will always be a graph
P2: Every graph will always be trees.
P3: Every tree will be a graph, but every graph will not be a tree
P4: Every graph will be a tree, but every tree will not be a graph.

  • P1 and P2

  • P1

  • P2

  • P1 and P3

There are 30 questions to complete.

Last Updated :
Take a part in the ongoing discussion