06000CS301122001
Scheme of Valuation / Answer Key
APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY
V th SEMESTER [Link] DEGREE(S)EXAMINATION,JANUARY 2022
(2015 SCHEME)
Course Code: CS301
Course Name: THEORY OF COMPUTATION
For each questions, the answers given in this scheme is one of the many possible answers. There may be
different notations used based on the resources followed. Please check the correctness of the answers
carefully before assign marks.
PART A
Answer all questions, each carries3 marks. Marks
1 S → aS|aB , B → bB|b 2
For any correct grammar
2 . 3
For any correct DFA.
3 Mealy machine is a finite-state machine whose output values are determined both by its current 3
state and the current inputs.
4 A two-way deterministic finite automaton (2DFA) is an abstract machine, a generalized version 3
of the deterministic finite automaton (DFA) which can revisit characters already processed. As
in a DFA, there are a finite number of states with transitions between them based on the current
character, but each transition is also labelled with a value indicating whether the machine will
move its position in the input to the left, right, or stay at the same position.
PART B
Answer any two full questions, each carries9 marks.
5 a Language of DFA and NFA 2
Proof using Mathematical Induction. 4
b -closure for a given state A means a set of states which can be reached from the state A with only .
move including the state A itself. .
Definition 1
Example 2
a b
[q0 ] [q0 , q1 ] [q0 ]
∗
[q0 , q1 ] [q0 , q1 ] [q0 ]
6 a 3
Subset construction steps 3
Correct transition table/diagram
b . .
.
.
.
.
3
Correct -NFA
7 a Any regular expression involving any of the operators +, ., * 1
Thompson construction steps 3
Final NFA 1
b a(a + b)∗ 2
(a + b)(a + b)a(a + b)∗ 2
∪ can be used instead of +.
PART C
Answer all questions, each carries3 marks.
8 S → aSd|aAd , A → bAc|bc 3
For any correct grammar
9 Even length palindromes. {wwR } 1.5
Odd length palindromes. {w = wR } 1.5
1.5 marks each for any correct language
10 A pushdown automaton (PDA) is a finite state machine which has an additional stack storage. 3
The transitions a machine makes are based not only on the input and current state, but also on
the stack.
The formal definition of a PDA is this:
M = (Q, Σ, Γ, δ, q0 , Z0 , F ), where
K: finite state set
Σ: finite input alphabet
Γ: finite stack alphabet
δ: transition function
q0 ∈ Q: start state
Z0 : initial stack top
F ⊆ Q: final states
11 L1 ∪ L2 is the set of all strings over {a, b}. OR Σ∗ where Σ = {a, b} 3
PART D
Answer any two full questions, each carries9 marks.
12 For any regular language L, there exists an integer n, such that for all x ∈ L with |x| ≥ n, there .
exists u, v, w ∈ Σ∗ , such that x = uvw, and |uv| ≤ n, |v| ≥ 1, for all i ≥ 0: uv i w ∈ L .
Statement 4
Proof 5
13 . .
.
.
9
Correct transition diagram/table.
14 a Elimination of useless productions .
Elimination of productions .
Elimination of unit productions .
Listing 1.5
Explanation 3.5
b Acceptance by final state .
Acceptance by empty stack .
Listing 2
Explanation 3
PART E
Answer any four full questions, each carries 10 marks.
15 a Setting PL constant n 1
Selecting a string z with length greater than n 1
Dividing the string z as z = uvwxy 1
Ensuring |vwx| ≤ n 1
Proving both v and x never contains a, b, and c at the same time. 1
Conclusion 1
b S → aSBC|aBC, CB → BC, aB → ab, bB → bb, bC → bc, cC → cc .
OR .
S → ABSc|abc, Ba → aB, Bb → bb, A → a .
Any correct grammar 4
16 a Transitions or transition diagram/table. 6
b An instantaneous description or configuration of a Turing machine requires 4
(1) the state the Turing machine is in,
(2) the contents of the tape, and
(3) the position of the tape head on the tape. This can be summarized in a string of the form
xi . . . xj qm xk . . . xl
where the x’s are the symbols on the tape, qm is the current state, and the tape head is on the
square containing xk (the symbol immediately following qm ).
17 a Transitions or transition diagram/table. 6
b A universal Turing machine (UTM) is a Turing machine that simulates an arbitrary Turing machine 4
on arbitrary input. The universal machine essentially achieves this by reading both the description
of the machine to be simulated as well as the input to that machine from its own tape.
18 Given a TM M and an input w, whether M halts on w? .
HP is undecidable. .
Statement .
Proof by contradiction or by diagonalization 3
7
19 a Type 3: Regular 6
Type 2: Context Free
Type 1: Context Sensitive
Type 0: Unrestricted
Write production rule format for each type.
b Linear bounded automata are acceptors for the class of context-sensitive languages. The only 4
restriction placed on grammars for such languages is that no production maps a string to a shorter
string. Thus no derivation of a string in a context-sensitive language can contain a sentential form
longer than the string itself. Since there is a one-to-one correspondence between linear-bounded
automata and such grammars, no more tape than that occupied by the original string is necessary
for the string to be recognized by the automaton.
20 a RE languages or type-0 languages are generated by type-0 grammars. An RE language can be 5
accepted or recognized by Turing machine which means it will enter into final state for the strings
of language and may or may not enter into rejecting state for the strings which are not part of the
language. It means TM can loop forever for the strings which are not a part of the language. RE
languages are also called as Turing recognizable languages.
b If L is recursive language then its complement L’ is also recursive language. 5
Proof: Let L be a recursive language that is accepted by Turing machine T , which halts on all
inputs. Now we will construct a Turing machine Ts from Turing machine T , the construction is
shown below:
As shown in above figure, if the Turing machine T , on input string s enters into accept state then
Turing machine Ts halts without accepting input string w. On the other hand, if Turing machine T
halts without accepting input string w then Ts enters into a accept state. Ts accepts those strings
that T do not accept. Thus, we can say Ts recognizes the complement of L.