Data Structure MCQ - Graph
This section focuses on the "Graph" of the Data Structure. These Multiple Choice Questions (mcq) should be practiced to improve the Data Structure skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. Which of the following statements for a simple graph is correct?
Explanation: In a walk if the vertices are distinct it is called a path, whereas if the edges are distinct it is called a trail.
2. What is the maximum number of possible non zero values in an adjacency matrix of a simple graph with n vertices?
Explanation: Out of n*n possible values for a simple graph the diagonal values will always be zero.
3. Which of the following is an advantage of adjacency list representation over adjacency matrix representation of a graph?
Explanation: No explanation.
4.A connected planar graph having 6 vertices, 7 edges contains _____________ regions.
Explanation: By euler’s formula the relation between vertices(n), edges(q) and regions(r) is given by n-q+r=2.
5.On which of the following statements does the time complexity of checking if an edge exists between two particular vertices is not, depends?
Explanation:To check if there is an edge between to vertices i and j, it is enough to see if the value of A[i][j] is 1 or 0, here A is the adjacency matrix.
6. The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in decreasing order. Which of the following sequences can not be the degree sequence of any graph?
I. 7, 6, 5, 4, 4, 3, 2, 1
II. 6, 6, 6, 6, 3, 3, 2, 2
III. 7, 6, 6, 4, 4, 3, 2, 2
IV. 8, 7, 7, 6, 4, 2, 1, 1
Explanation: No explanation
7. What is the maximum number of edges in a bipartite graph having 10 vertices?
Explanation: Let one set have n vertices another set would contain 10-n vertices.
Total number of edges would be n*(10-n), differentiating with respect to n, would yield the answer.
8. Possible number of labelled simple Directed, Pseudo and Multigarphs exist having 2 vertices?
Explanation: MultiGraphs and PseudoGraphs may have infinite number of edges, while 4 possible simple graphs exist.
9.The most efficient algorithm for finding the number of connected components in an undirected graph on n vertices and m edges has time complexity.
(C) \theta(m + n)
Explanation: Connected components can be found in O(m + n) using Tarjan's algorithm. Once we have connected components, we can count them.
10. What is time complexity to check if a string(length S1) is a substring of another string(length S2) stored in a Directed Acyclic Word Graph, given S2 is greater than S1?
Explanation:For each check of a word of length S1, we need to follow at most S1 edges.
Also Check :