
Graph Quiz

Quiz
•
Information Technology (IT)
•
University
•
Medium

Chong May
Used 72+ times
FREE Resource
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is used to represent a graph efficiently when the graph is sparse?
Adjacency Matrix
Adjacency List
Edge List
Incidence Matrix
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which traversal technique uses a queue?
DFS
BFS
Dijkstra’s
Kruskal’s
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these algorithms is used to find the shortest path from a single source to all vertices?
Prim’s
Kruskal’s
Dijkstra’s
DFS
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What data structure is used in DFS?
Queue
Stack
Heap
Priority Queue
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which algorithm is used for topological sorting?
BFS
DFS
Kruskal
Either BFS or DFS
Answer explanation
Topological sorting is applicable only to Directed Acyclic Graphs (DAGs), and both DFS and BFS can be used to perform it, but with different approaches.
🔹 1. Using DFS (Depth-First Search):
This is the most common method.
Perform DFS traversal and push each node onto a stack after visiting all its neighbors.
Once all nodes are visited, pop from the stack to get the topological order.
2. Using BFS (Kahn’s Algorithm):BFS-based method using in-degrees of nodes.
Start with nodes having in-degree = 0, and repeatedly remove them while updating in-degrees of neighbors.
Works well for cycle detection too (if not all nodes are sorted, a cycle exists).
✅ Steps:
Calculate in-degrees.
Enqueue all nodes with in-degree 0.
While queue is not empty:
Dequeue node and add it to result.
Decrease in-degree of its neighbors.
If in-degree of neighbor becomes 0, enqueue it.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main difference between Kruskal’s and Prim’s algorithm?
Prim’s uses greedy approach, Kruskal doesn’t
Kruskal works on connected graphs only
Kruskal selects edges globally, Prim’s grows from a node
Prim’s is slower than Kruskal
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following best describes the output of a topological sort?
All edges in minimum weight
Nodes in a linear order with all dependencies resolved
Shortest paths from a single node
All cycles in a graph
Create a free account and access millions of resources
Similar Resources on Wayground
25 questions
FOS QUIZ 7

Quiz
•
University
25 questions
GPC_IT Networking Mar 25, 2025

Quiz
•
University
26 questions
Software Engineering Quiz

Quiz
•
University
25 questions
Hardware PC

Quiz
•
7th Grade - University
30 questions
Week 7-8

Quiz
•
University
25 questions
Google Sheets Midterm Quiz - 21/10/2024

Quiz
•
University
25 questions
Kelas 9 - Halaman 49 (PTS)

Quiz
•
9th Grade - University
25 questions
Database Management Systems Quiz

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Information Technology (IT)
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University