
MCQs on Graph Representation and Traversal
Authored by mohammed ahmed
Engineering
University
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to initialize an adjacency list for 5 vertices?
ArrayList
int[] graph = new int[5];
ArrayList
LinkedList
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does this code create? graph[0].add(1); graph[1].add(0);
Directed edge from 0 to 1
Undirected edge between 0 and 1
Weighted edge
Cycle
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why do we initialize each element of the graph? for(int i = 0; i < graph.length; i++) graph[i] = new ArrayList<>();
To make a deep copy
To avoid null pointer exception
To create adjacency matrix
To sort the vertices
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is NOT a correct way to represent an undirected edge between two nodes?
graph[a].add(b); graph[b].add(a);
graph[a].add(b);
graph[b].add(a); graph[a].add(b);
Both A and C
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of using ArrayList
To store edge weights
To track edge types
To reduce memory
To make the graph connected
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which data structure does DFS use internally (recursion)?
Queue
Stack
Array
Heap
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the DFS output for this graph starting at 0? 0 - 1 | 2 Code: dfs(graph, 0, visited);
0 1 2
0 2 1
0
2 0 1
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
25 questions
Exhaust gas rectification 2
Quiz
•
University
25 questions
Mediciones eléctrica
Quiz
•
University
25 questions
Автомобильдердің пайдалану қасиеттерінің теориясы
Quiz
•
University
25 questions
GPIO - Quiz
Quiz
•
University
25 questions
precio2do parcial estatica
Quiz
•
University
30 questions
ByteBattle 2.0(3)
Quiz
•
University
35 questions
Aplicaciones web html/css
Quiz
•
University
25 questions
Pre_UPS1
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
29 questions
Alg. 1 Section 5.1 Coordinate Plane
Quiz
•
9th Grade
22 questions
fractions
Quiz
•
3rd Grade
11 questions
FOREST Effective communication
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Engineering
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
7 questions
Fragments, Run-ons, and Complete Sentences
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
10 questions
DNA Structure and Replication: Crash Course Biology
Interactive video
•
11th Grade - University
5 questions
Inherited and Acquired Traits of Animals
Interactive video
•
4th Grade - University
5 questions
Examining Theme
Interactive video
•
4th Grade - University
20 questions
Implicit vs. Explicit
Quiz
•
6th Grade - University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University