Skills101
← All practice quizzes

Quiz: Closures and Warshall's Algorithm

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Represent a relation as a 0/1 matrix, compose relations with the Boolean product, and build the reflexive, symmetric and transitive closures. Then run Warshall's algorithm step by step — the exam favourite for transitive closure — with every matrix checked in Python.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    In a relation matrix, how can you tell at a glance that the relation is reflexive?

  2. Question 2

    On A = {1, 2, 3}, what is the symmetric closure of R = {(1, 2), (2, 3)}?

  3. Question 3

    For R = {(1, 2), (2, 1), (2, 3), (3, 4)}, why does the transitive closure contain (1, 1)?

  4. Question 4

    What does this print?

    R = {(1, 2), (2, 3), (3, 1)}
    RR = {(a, c) for (a, b) in R for (b2, c) in R if b == b2}
    print(sorted(RR))
    
  5. Question 5

    In the Boolean product of relation matrices, what replaces ordinary multiplication and addition?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →