MCS-212 · Block 2 Unit 2

Automata and Languages

Section 5 of 8

Block 2 · Unit 2Automata and Languages12 min · Section 5 of 8

2.5Deterministic finite automata

Covers IGNOU MCS-212 §2.4.1, 2.4.2

A regular expression describes a language. A finite automaton recognises it: it is a tiny machine with a fixed, finite memory (its states) that reads a string from left to right and finally says “accept” or “reject”. Lexical analysers in compilers, vending machines, traffic lights and protocol handlers are all finite automata.

A DFA is drawn as a transition diagram: circles for states, an arrow labelled “start” into q0q_0, double circles for final states, and an arrow labelled aa from pp to qq when δ(p,a)=q\delta(p, a) = q. Every state has exactly one outgoing arrow for each symbol. It can also be given as a transition table.

Running a DFA on a string

The extended transition function δ∗\delta^* handles whole strings: δ∗(q,λ)=q\delta^*(q, \lambda) = q and δ∗(q,wa)=δ(δ∗(q,w),a)\delta^*(q, wa) = \delta(\delta^*(q, w), a). The DFA accepts ww if δ∗(q0,w)∈F\delta^*(q_0, w) \in F, and the language of MM is L(M)={w∈Σ∗∣δ∗(q0,w)∈F}L(M) = \{w \in \Sigma^* \mid \delta^*(q_0, w) \in F\}.

Key takeaways

  • DFA = (Q,Σ,δ,q0,F)(Q, \Sigma, \delta, q_0, F) with δ:Q×Σ→Q\delta: Q \times \Sigma \to Q (exactly one next state).
  • Diagrams: start arrow, double circles for final states, one arrow per symbol from each state.
  • ww is accepted iff δ∗(q0,w)∈F\delta^*(q_0, w) \in F.
  • A dead state collects all strings that can never be accepted.

Practice questions

Answer on paper first, then check. The explanation matters more than the letter you chose.

Question 1 · multiple choice

In a DFA (Q,Σ,δ,q0,F)(Q, \Sigma, \delta, q_0, F) with ∣Q∣=4|Q| = 4 and ∣Σ∣=2|\Sigma| = 2, how many transitions must be defined?

Show answer

Answer: C. 8

One transition for each (state, symbol) pair: 4×2=84 \times 2 = 8. Option 4 would be 424^2, which has no meaning here.

Question 2 · multiple choice

For the DFA that accepts strings containing bb (states x,y,zx, y, z), which string is rejected?

Show answer

Answer: D. aaaaaaaa

Without a bb the machine never reaches zz. All other strings contain a bb.

Question 3 · multiple choice

A DFA passes through a final state while reading ww but ends in a non-final state. Then:

Show answer

Answer: A. ww is rejected

Only the state after the last symbol counts. Option 2 is the common mistake of accepting too early.

Question 4 · multiple choice

For the “exactly one 1” DFA (states 1, 2, 3), what is δ∗(1,0110)\delta^*(1, 0110)?

Show answer

Answer: C. 3

1→01→12→13→031 \xrightarrow{0} 1 \xrightarrow{1} 2 \xrightarrow{1} 3 \xrightarrow{0} 3. Option 2 is where the machine is after the first 1.

Question 5 · multiple choice

The DFA with q0→bq1→bq2q_0 \xrightarrow{b} q_1 \xrightarrow{b} q_2, q2q_2 looping on a,ba, b, and all other moves to a dead state, accepts:

Show answer

Answer: D. strings beginning with bbbb

The first two letters must both be bb; after that anything is allowed. Option 1 is the study material’s wording, but bbbbbb is accepted too.

Question 6 · short answer

Give the formal 5-tuple and transition table of a DFA over {a,b}\{a, b\} that accepts strings with an even number of aa‘s.

Show worked answer

M=({qe,qo},{a,b},δ,qe,{qe})M = (\{q_e, q_o\}, \{a, b\}, \delta, q_e, \{q_e\}), where qeq_e means “even number of aa‘s so far” and qoq_o “odd”. Table: δ(qe,a)=qo\delta(q_e, a) = q_o, δ(qe,b)=qe\delta(q_e, b) = q_e, δ(qo,a)=qe\delta(q_o, a) = q_e, δ(qo,b)=qo\delta(q_o, b) = q_o. Start in qeq_e (zero aa‘s is even); accept in qeq_e. Check: abababab has two aa‘s: qe→qo→qo→qe→qeq_e \to q_o \to q_o \to q_e \to q_e, accepted.

↑ ↓ move↵ openTab switch type