 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

 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)

 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

 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)

 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;`````` a. vertex, vertex b. neighbor, vertex c. neighbor, neighbor d. vertex, 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

 97. To create an adjacency list C++’s map container can be used. a. True b. False c. May be d. Can't say
 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 adjacent ; vector weight; 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)