← Quiz: DFA: all 10 questions
Quiz: DFA · Question 8 of 10
What does this print? (code)
What does this print?
delta = {("q0", "0"): "q1", ("q0", "1"): "q0", ("q1", "0"): "q1",
("q1", "1"): "q2", ("q2", "0"): "q1", ("q2", "1"): "q0"}
state = "q0"
for ch in "0110":
state = delta[(state, ch)]
print(state)
- A.q0
- B.q1
- C.q2
- D.q3
Answer & explanation
Correct answer: q1
The run is q0 → q1 → q2 → q0 → q1; 0110 does not end in 01, so q1 is not accepting.
Can you get the rest right without peeking?
Take the timed Quiz: DFA quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →