Professional Documents
Culture Documents
Q2) Classify each of the following languages to one of the following classes.
(Justify Your Answer) (2 Marks)
1. {𝑎𝑛 𝑏 𝑚 | 𝑚 = 2𝑛 + 1} A. Both Regular and Context-Free
2. {𝑎𝑖 𝑏 𝑗 𝑐 𝑘 | 𝑘 = 𝑖 + 𝑗} B. B Context-Free, but not regular
3. {𝑎𝑖 𝑏 𝑗 𝑎𝑘 | 𝑘 ≠ 𝑖 or 𝑘 ≠ 𝑗} C. Decidable but Neither context-free nor regular
D. Undecidable
Q3) Use the pumping lemma to show that the following language is not regular
(2Marks)
𝑨 = {𝒙𝒌! |𝒌 ∈ {𝟏, 𝟐, 𝟑, … . }}
Q4) Give a context-free grammar for generating the following language
(3Marks)
{𝒂𝒏 𝒃𝒎 𝒄𝒎+𝒏 |𝒏 ≥ 𝟎, 𝒎 ≥ 𝟎}
Q5) Give a formal definition for a PDA that recognizes the language
{𝒘𝒘𝑹 |𝒘 ∈ {𝟎, 𝟏}∗ }. w R is the reverse of w (3Marks)
Q7) Give a formal definition for a Turing machine with one tape that decides
the language {𝒂𝒏 𝒃𝒏 𝒄𝒏 |𝒏 ≥ 𝟎} (5 Marks)
Model D