Week 0
Week 0
4. Which of the following is useful in traversing a given graph by breadth first search?
A. Set
B. List
C. Stacks
D. Queue
Ans: D
5. What is the maximum number of possible non-zero values in an adjacency matrix of a simple
graph with n vertices?
A. (n*(n-1))/2
B. (n*(n+1))/2
C. n*(n-1)
D. n*(n+1)
Ans: C
(Out of n*n possible values for a simple graph the diagonal values will always be zero.)
6. On which of the following statements does the time complexity of checking if an edge exists
between two particular vertices or not depends?
A. Depends on the number of edges
B. Depends on the number of vertices
C. Is independent of both the number of edges and vertices
D. It depends on both the number of edges and vertices
Ans: C
(To check if there is an edge between two 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.)
7. Which type of graph has all the vertices of the first set connected to all the vertices of the
second set?
A. Bipartite
B. Complete Bipartite
C. Cartesian
D. Pie
Ans: B
(The graph is known as Bipartite if the graph does not contain any odd length cycle in it. The
complete bipartite graph has all the vertices of first set connected to all the vertices of the
second set.)
8. In a complete graph with n nodes, how many different triangles are present?
A. 3n
B. n^3
C. (n^3−3n^2+2n)/6
D. None of the above
Ans: C
(In a complete graph having n nodes, there will be ‘n Choose 3’ triangles.)
9. In an undirected graph G with n vertices and e edges, the sum of the degrees of each vertex
is:
A. n*e
B. 2n
C. 2e
D. e^n
Ans: C
10. The number of edges in a regular graph of degree d and n vertices is (Assume n and d to be
even):
A. nd
B. n+d
C. (nd)/2
D. Maximum of n,d
Ans: (nd)/2