A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

91. For some sparse graph an adjacency list is more space efficient against an adjacency matrix.
a. True
b. False
c. May be
d. Can't say
View Answer Report Discuss Too Difficult!
Answer: (a).True

92. Time complexity to find if there is an edge between 2 particular vertices is _________
a. O(V)
b. O(E)
c. O(1)
d. O(V+E)
View Answer Report Discuss Too Difficult!
Answer: (a).O(V)

93. For the given conditions, which of the following is in the correct order of increasing space requirement?
i) Undirected, no weight

ii) Directed, no weight

iii) Directed, weighted

iv) Undirected, weighted
a. ii iii i iv
b. i iii ii iv
c. iv iii i ii
d. i ii iii iv
View Answer Report Discuss Too Difficult!
Answer: (a).ii iii i iv

94. Space complexity for an adjacency list of an undirected graph having large values of V (vertices) and E (edges) is __________
a. O(V)
b. O(E*E)
c. O(E)
d. O(E+V)
View Answer Report Discuss Too Difficult!
Answer: (c).O(E)

95. Complete the given snippet of code for the adjacency list representation of a weighted directed graph.
class neighbor
        {
  int vertex, weight;
  ____ next;
 }
 
 class vertex
        {
  string name;
  _____ adjlist;
 }
 
 vertex adjlists[101];
a. vertex, vertex
b. neighbor, vertex
c. neighbor, neighbor
d. vertex, neighbor
View Answer Report Discuss Too Difficult!
Answer: (c).neighbor, neighbor

96. In which case adjacency list is preferred in front of an adjacency matrix?
a. Dense graph
b. Sparse graph
c. Adjacency list is always preferred
d. None of the mentioned
View Answer Report Discuss Too Difficult!
Answer: (b).Sparse graph

97. To create an adjacency list C++’s map container can be used.
a. True
b. False
c. May be
d. Can't say
View Answer Report Discuss Too Difficult!
Answer: (a).True

98. What would be the time complexity of the following function which adds an edge between two vertices i and j, with some weight ‘weigh’ to the graph having V vertices?
vector<int> adjacent[15] ;
vector<int> weight[15]; 
 
void addEdge(int i,int j,int weigh) 
{  
 adjacent[a].push_back(i); 
 adjacent[b].push_back(j); 
 weight[a].push_back(weigh); 
 weight[b].push_back(weigh); 
}
a. O(1)
b. O(V)
c. O(V*V)
d. O(log V)
View Answer Report Discuss Too Difficult!
Answer: (a).O(1)

99. Given a plane graph, G having 2 connected component, having 6 vertices, 7 edges and 4 regions. What will be the number of connected components?
a. 1
b. 2
c. 3
d. 4
View Answer Report Discuss Too Difficult!
Answer: (b).2

100. Number of vertices with odd degrees in a graph having a eulerian walk is ________
a. 0
b. Can’t be predicted
c. 2
d. either 0 or 2
View Answer Report Discuss Too Difficult!
Answer: (d).either 0 or 2