All mock tests are FREE till 31 December — register to save your progress
Unit 8 · Theory of Computation and Compilers Paper 2 CS · December 2024

Directions (Q91–95): A machine is represented by states Q, input alphabet Σ, transition function δ, initial state q0 and final states F. The machine accepts all strings over Σ = {a, b} which start and end with any combination of the alphabet symbols, and in which abb occurs as a substring (i.e. the language of all strings over {a, b} containing abb).

For the above-mentioned passage, which of the following automata is correct? Each option is described by its transitions (start state 1).

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. States 1–4, final {4}: 1 –a,b→ 1, 1 –a→ 2, 2 –b→ 3, 3 –b→ 4, 4 –a,b→ 4

Explanation

Option A accepts strings ending with abb and option B accepts strings starting with abb. Option C loops on any symbols before abb (state 1) and after it (state 4), so it accepts exactly the strings containing abb. Option D also accepts ε and strings without abb.

More Theory of Computation and Compilers questions