Browse papers
A

Section A: Long Answer Questions

Attempt all / any as specified.

4 questions
1long12 marks

(a) Define a Non-deterministic Finite Automaton (NFA) formally as a 5-tuple and explain the role of each component. State how an NFA differs from a DFA.

(b) Consider the NFA with ε\varepsilon-transitions over the alphabet Σ={a,b}\Sigma = \{a, b\} that accepts all strings containing the substring aba. Using the subset construction algorithm, convert the given NFA into an equivalent DFA. Show the transition table and draw the resulting DFA, clearly marking the start and final states.

finite-automatanfa-to-dfadfa-design
2long12 marks

(a) Consider the context-free grammar GG with productions:

SaSbSSεS \rightarrow aSb \mid SS \mid \varepsilon

Show the leftmost derivation and draw the parse tree for the string aabbab. State the language L(G)L(G) generated by this grammar.

(b) Construct a Pushdown Automaton (PDA) that accepts the language L={anbnn1}L = \{ a^n b^n \mid n \geq 1 \} by final state. Describe its transition function and trace the moves of your PDA on the input string aaabbb.

context-free-grammarspushdown-automatacfg-to-pda
3long16 marks

(a) Design a Turing Machine that accepts the language L={anbncnn1}L = \{ a^n b^n c^n \mid n \geq 1 \}. Give the formal definition (states, tape symbols, transition function) and show the sequence of configurations (instantaneous descriptions) when the machine processes the input aabbcc.

(b) State the Halting Problem and prove that it is undecidable. Explain the significance of this result in the theory of computation.

turing-machinesdecidabilityhalting-problem
4long10 marks

Explain the Chomsky hierarchy of grammars. For each of the four types (Type 0, Type 1, Type 2, Type 3), describe the form of the production rules, the class of language generated, and the corresponding accepting automaton. Illustrate each grammar type with one suitable example.

chomsky-hierarchygrammar-typesautomata-equivalence
B

Section B: Short Answer Questions

Attempt all / any as specified.

7 questions
5short6 marks

(a) Write a regular expression for the language over Σ={0,1}\Sigma = \{0, 1\} consisting of all strings that have an even number of 0's and end with 1.

(b) State Arden's theorem and use it to find the regular expression accepted by a finite automaton with states q1,q2q_1, q_2 where q1q_1 is the start state, q1aq1q_1 \xrightarrow{a} q_1, q1bq2q_1 \xrightarrow{b} q_2, and q2q_2 is the final state with q2a,bq2q_2 \xrightarrow{a,b} q_2.

regular-expressionsregular-languages
6short6 marks

State the pumping lemma for regular languages. Using the pumping lemma, prove that the language L={anbnn0}L = \{ a^n b^n \mid n \geq 0 \} is not regular.

pumping-lemmaregular-languages
7short6 marks

(a) Define an ambiguous grammar. Show that the grammar EE+EEE(E)idE \rightarrow E + E \mid E * E \mid (E) \mid id is ambiguous by giving two distinct parse trees for the string id + id * id.

(b) Briefly explain how the ambiguity in this grammar can be removed.

context-free-grammarsambiguitygrammar-simplification
8short6 marks

Convert the following context-free grammar into Chomsky Normal Form (CNF), showing each step of the conversion:

SASAaBS \rightarrow ASA \mid aB ABSA \rightarrow B \mid S BbεB \rightarrow b \mid \varepsilon

context-free-grammarschomsky-normal-form
9short5 marks

Differentiate between a Mealy machine and a Moore machine with respect to output behaviour. Design a Moore machine over Σ={0,1}\Sigma = \{0, 1\} that outputs the residue (remainder) of the input binary number when divided by 3.

finite-automatamealy-moore-machines
10short5 marks

(a) Distinguish between a recursive language and a recursively enumerable language.

(b) State Rice's theorem and give one example of a non-trivial property of recursively enumerable languages that is undecidable as a consequence of it.

decidabilityundecidabilityrices-theorem
11short6 marks

(a) Explain the difference between a deterministic PDA (DPDA) and a non-deterministic PDA (NPDA), and state which class of languages each accepts.

(b) State the pumping lemma for context-free languages and explain how it is used to show that a language is not context-free.

pushdown-automatacontext-free-languagesdpda