

MCQOPTIONS
Saved Bookmarks
This section includes 13 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.
1. |
What would be the time complexity of the BFS traversal of a graph with n vertices and n1.25 edges? |
A. | O(n) |
B. | O(n1.25) |
C. | O(n2.25) |
D. | O(n*n) |
Answer» C. O(n2.25) | |
2. |
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? |
A. | O(1) |
B. | O(V) |
C. | O(V*V) |
D. | O(log V)View Answer |
Answer» B. O(V) | |
3. |
To create an adjacency list C++’s map container can be used. |
A. | True |
B. | False |
Answer» B. False | |
4. |
Complete the given snippet of code for the adjacency list representation of a weighted directed graph. |
A. | vertex, vertex |
B. | neighbor, vertex |
C. | neighbor, neighbor |
D. | vertex, neighborView Answer |
Answer» D. vertex, neighborView Answer | |
5. |
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) |
Answer» D. O(E+V) | |
6. |
For the given conditions, which of the following is in the correct order of increasing space requirement?i) Undirected, no weightii) Directed, no weightiii) Directed, weightediv) Undirected, weighted |
A. | ii iii i iv |
B. | i iii ii iv |
C. | iv iii i ii |
D. | i ii iii iv |
Answer» B. i iii ii iv | |
7. |
TO_CREATE_AN_ADJACENCY_LIST_C++‚ÄÖ√Ñ√∂‚ÀÖ√Ë‚ÀÖ¬•S_MAP_CONTAINER_CAN_BE_USED.?$# |
A. | True |
B. | False |
Answer» B. False | |
8. |
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 |
Answer» B. Sparse graph | |
9. |
vertex, vertex |
A. | neighbor, vertex |
B. | neighbor, neighbor |
C. | vertex, neighbor |
Answer» C. vertex, neighbor | |
10. |
For the given conditions, which of the following is in the correct order of increasing space requirement? |
A. | Undirected, no weight |
B. | Directed, no weight |
C. | Directed, weighted |
D. | Undirected, weighted |
Answer» B. Directed, no weight | |
11. |
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) |
Answer» B. O(E) | |
12. |
For some sparse graph an adjacency list is more space efficient against an adjacency matrix. |
A. | True |
B. | False |
Answer» B. False | |
13. |
Space complexity for an adjacency list of an undirected graph having large values of V (vertices) and E (edges) is ___________ |
A. | O(E) |
B. | O(V*V) |
C. | O(E+V) |
D. | O(V) |
Answer» D. O(V) | |