CS FundamentalsHardGATE CS (PYQ pattern)

A wait-for graph over T1..T5 has edges T1→T2, T2→T3, T3→T1, T2→T4, T4→T1, T3→T5, T5→T2, T4→T5. How many distinct simple directed cycles does it contain?

  1. A. 5
  2. B. 3
  3. C. 6
  4. D. 4

Correct answer: D. 4

Enumerating simple cycles from each smallest node gives [(1, 2, 3), (1, 2, 4), (2, 3, 5), (2, 4, 5)]; every one of them is a separate deadlock that must be broken.

More DBMS and SQL questions

Exams that ask this topic