Graph Quiz

Graph Quiz

University

30 Qs

quiz-placeholder

Similar activities

Form 4 - CSEC Information Technology Quiz

Form 4 - CSEC Information Technology Quiz

10th Grade - University

30 Qs

Introduction to Programming Quiz

Introduction to Programming Quiz

University

25 Qs

Kuis_2_AI Bab 3-4

Kuis_2_AI Bab 3-4

University

31 Qs

2nd Year Data Structures Quiz Qn

2nd Year Data Structures Quiz Qn

University

35 Qs

Artificial Intelligence Quiz

Artificial Intelligence Quiz

University

25 Qs

Ujian Teori Struktur Data

Ujian Teori Struktur Data

University

26 Qs

S06-S10 Big Data Analytics

S06-S10 Big Data Analytics

University

27 Qs

Kelas 9 - Halaman 49 (PTS)

Kelas 9 - Halaman 49 (PTS)

9th Grade - University

25 Qs

Graph Quiz

Graph Quiz

Assessment

Quiz

Information Technology (IT)

University

Medium

Created by

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:

    1. Calculate in-degrees.

    2. Enqueue all nodes with in-degree 0.

    3. 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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?