Questions: Topological Sorting and Ordering

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A project scheduler models task dependencies as a directed graph: task A depends on B and C; B and C both depend on D; D has no dependencies. Which execution order is valid?

AA, B, C, D
BD, B, C, A
CB, A, D, C
DD, A, B, C
Question 2 Multiple Choice

You run Kahn's algorithm on a directed graph. After the algorithm terminates, several vertices were never added to the output sequence. What does this imply?

AThe graph has multiple valid topological orderings
BSome vertices have no outgoing edges
CThe graph contains a directed cycle
DThe graph is disconnected
Question 3 True / False

A directed graph that contains a cycle cannot have a valid topological ordering.

TTrue
FFalse
Question 4 True / False

Most directed graph has at least one valid topological ordering.

TTrue
FFalse
Question 5 Short Answer

Why does Kahn's algorithm detect cycles as a side effect of performing topological sorting?

Think about your answer, then reveal below.