You can prepare effectively for Software Development DSA in C++ with this dedicated MCQ Practice Test (available with solutions) on the important topic of "Test: Graphs - 1". These 15 questions have been designed by the experts with the latest curriculum of Software Development 2026, to help you master the concept.
Test Highlights:
Sign up on EduRev for free to attempt this test and track your preparation progress.
Detailed Solution: Question 1
Detailed Solution: Question 2
What is the time complexity of Breadth First Search (BFS) on a graph with V vertices and E edges?
Detailed Solution: Question 3
What is the purpose of visited[] array in Depth First Search (DFS)?
Detailed Solution: Question 4
Which traversal algorithm uses a stack data structure to explore vertices?
Detailed Solution: Question 5
What will be the output of the following code?
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<vector<int>> graph = {{1, 2}, {2, 3}, {3, 1}};
cout << graph[1][1];
return 0;
}
Detailed Solution: Question 6
What will be the output of the following code?
#include <iostream>
#include <queue>
using namespace std;
int main() {
queue<int> q;
q.push(10);
q.push(20);
q.push(30);
q.pop();
cout << q.front();
return 0;
}
Detailed Solution: Question 7
What will be the output of the following code?
#include <iostream>
#include <stack>
using namespace std;
int main() {
stack<int> s;
s.push(10);
s.push(20);
s.push(30);
s.pop();
cout << s.top();
return 0;
}
Detailed Solution: Question 8
What will be the output of the following code?
#include <iostream>
#include <queue>
using namespace std;
int main() {
queue<int> q;
q.push(10);
q.push(20);
q.push(30);
cout << q.back();
return 0;
}
Detailed Solution: Question 9
What will be the output of the following code?
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> v = {1, 2, 3, 4};
cout << v[4];
return 0;
}
Detailed Solution: Question 10
Which traversal algorithm can be used to find the shortest path between two vertices in an unweighted graph?
Detailed Solution: Question 11
Which graph representation is more space-efficient when the graph has fewer edges compared to vertices?
Detailed Solution: Question 12
Which of the following statements is true regarding Depth First Search (DFS)?
Detailed Solution: Question 13
Which of the following algorithms can be used to find the longest path in a graph?
Detailed Solution: Question 14
In a directed graph, if there is a path from vertex A to vertex B and a path from vertex B to vertex A, it is called:
Detailed Solution: Question 15
152 videos|118 docs|24 tests |