🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: DFA Minimisation (Table Filling): all 10 questions

Quiz: DFA Minimisation (Table Filling) · Question 6 of 10

What does this print? (code)

What does this print?

delta = {"p": {"0": "q", "1": "p"}, "q": {"0": "q", "1": "r"}, "r": {"0": "r", "1": "r"}}
acc = {"r"}
p, q, w = "p", "q", ""
for c in "1":
    p, q, w = delta[p][c], delta[q][c], w + c
print(w, p in acc, q in acc)
  1. A.1 True False
  2. B.1 False True
  3. C.0 False True
  4. D.1 False False
Answer & explanation

Correct answer: 1 False True

Reading 1 keeps p in p (rejecting) and moves q to r (accepting), so "1" distinguishes p and q.

Can you get the rest right without peeking?

Take the timed Quiz: DFA Minimisation (Table Filling) quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →