Practice 20 Graphs multiple-choice questions designed for CDAC CCAT exam preparation. Click "Show Answer" to reveal the correct option with detailed explanation.
Show Answer & Explanation
Correct Answer: B — BFS
BFS finds shortest path in unweighted graphs by exploring level by level.
Show Answer & Explanation
Correct Answer: B — Shortest path from single source
Dijkstra finds shortest path from single source to all other vertices.
Show Answer & Explanation
Correct Answer: B — Stack
DFS uses stack (or recursion which uses call stack).
Show Answer & Explanation
Correct Answer: C — n(n-1)/2
Maximum edges in simple undirected graph = n(n-1)/2 (complete graph).
Show Answer & Explanation
Correct Answer: C — DAG only
Topological sort works only on Directed Acyclic Graphs (DAG).
Show Answer & Explanation
Correct Answer: B — Minimum Spanning Tree
Kruskal's finds MST using greedy approach, selecting smallest edges.
Show Answer & Explanation
Correct Answer: C — O(V+E)
BFS visits all vertices and edges once, taking O(V+E) time.
Show Answer & Explanation
Correct Answer: B — V-1
Minimum edges for connected graph is V-1 (a tree).
Show Answer & Explanation
Correct Answer: B — O(n²)
Adjacency matrix is n×n, using O(n²) space.
Show Answer & Explanation
Correct Answer: B — MST
Prim's algorithm finds Minimum Spanning Tree.
Show Answer & Explanation
Correct Answer: C — Bellman-Ford
Bellman-Ford algorithm can detect negative weight cycles in a graph.
Show Answer & Explanation
Correct Answer: B — All pairs shortest paths
Floyd-Warshall finds shortest paths between all pairs of vertices.
Show Answer & Explanation
Correct Answer: B — O(V³)
Floyd-Warshall uses three nested loops, giving O(V³) complexity.
Show Answer & Explanation
Correct Answer: B — Odd length
A graph is bipartite if and only if it contains no odd-length cycles.
Show Answer & Explanation
Correct Answer: B — Kosaraju or Tarjan algorithm
Kosaraju's and Tarjan's algorithms find strongly connected components in directed graphs.
Show Answer & Explanation
Correct Answer: B — Vertex whose removal disconnects graph
An articulation point (cut vertex) is a vertex whose removal increases connected components.
Show Answer & Explanation
Correct Answer: B — Incoming edges count
In-degree is the number of edges coming into a vertex.
Show Answer & Explanation
Correct Answer: C — Min-Heap/Priority Queue
Min-heap or priority queue gives O((V+E)log V) complexity for Dijkstra.
Show Answer & Explanation
Correct Answer: B — n-1 edges
A tree is a connected acyclic graph with exactly n-1 edges for n vertices.
Show Answer & Explanation
Correct Answer: B — Presence of cycle
A back edge (edge to ancestor) in DFS tree indicates a cycle in the graph.