Gujarat Technological UniversitySummer 2023 Examination

GTU 3160704 Theory of Computation (TOC) Summer 2023 Paper Solution & PDF

B.E. · Computer Engineering · Semester 6 · Subject Code: 3160704
Download Official GTU PDF
Share:
Total Marks70 MarksExternal theory exam
Passing Marks23 Marks33% minimum cutoff
Exam Duration2.5 Hours10:30 AM – 1:00 PM
Paper Structure5 QuestionsWith internal OR choices
Jump toQ1Q2Q3Q4Q5

Question 1

14 MarksMedium
(a)

Let f be a function from the set 𝐴 = {1,2,3,4} to 𝐵 = {𝑝, 𝑞, 𝑟, 𝑠} such that, 𝑓 = {(1, 𝑝)(2, 𝑝)(3, 𝑞)(4, 𝑠)}. Is 𝑓−1 a function?

3 Marks
(b)
𝐿 is defined recursively as follows:
1𝜖 ∈ 𝐿
2∀𝑥 ∈ 𝐿, both 0𝑥 and 0𝑥1 are in𝐿. Prove that: For every 𝑛 >= 0, every 𝑥 belongs to 𝐿 obtained by n applications of rule 2 is an element of L.
4 Marks
(c)

Discuss “Distinguishability” of one string from another and explain how it affects the number of states in an FA. Considering the example of 𝐿 = {𝑎, 𝑏}∗{𝑎𝑏𝑎}, how do the distinguishable strings in L relate to the number of states in its FA?

7 Marks

Question 2

14 MarksMedium
(a)
Define: Grammar.
3 Marks
(b)

What are similarities and differences between Moore machines and Mealy machines?

4 Marks
(c)
Given two languages 𝐿1 and 𝐿2, defined as:

𝐿1 = {𝑥 | 𝑎𝑙𝑙 𝑥 𝑠𝑡𝑎𝑟𝑡 𝑤𝑖𝑡ℎ 𝑎𝑏𝑎 } 𝐿2 = {𝑥 | 𝑎𝑙𝑙 𝑥 𝑒𝑛𝑑𝑠 𝑖𝑛 𝑏𝑏} Write the regular expression for both the languages and construct FAs 𝑀1 and 𝑀2 such that 𝑀1 accepts 𝐿1 and 𝑀2 accepts 𝐿2. Derive 𝐿1 ∩ 𝐿2.

7 Marks
OR OPTION
(c)

Draw the given NFA in Table-1 and convert it to FA and identify the language. q0 is the initial state and q1 is the accepting state.

State𝛿(𝑞, 0)𝛿(𝑞, 1)
𝑞0{𝑞0, 𝑞1}{𝑞1}
𝑞1{ø}{𝑞0, 𝑞1}
7 Marks

Question 3

14 MarksMedium
(a)
Draw NFA lambda for the given regular expression:
0* (00 + 11)* (001) (01 + 10)
3 Marks
(b)
Explain the Pumping Lemma for Context Free Languages.
4 Marks
(c)
Convert the following grammar to CNF.
S → ABA
A → aA | ϵ
B → bB | ϵ
7 Marks
OR OPTION
(a)

Find the ꓥ-closure of a set of states for each state of the given NFA lambda in Figure-1.

GTU Theory of Computation (3160704) Summer 2023 Question 3 OR (a) Diagram
3 Marks
(b)
What are non-CFLs? Give at-least two examples of non-CFLs.
4 Marks
(c)
Show Bottom Up Parsing of the string “id + id * id” using the following grammar.
E → E + T | T
T → T * F | F
F → (E) | id
7 Marks

Question 4

14 MarksMedium
(a)
Define PDA. State whether a PDA can accept a CFL or not.
3 Marks
(b)
Discuss the closure properties of CFLs.
4 Marks
(c)

For the given Turing Machine in Table-2, trace the transition for the strings 1011 and 10101 and identify the language recognized by this TM. TM is defined as TM = (Q, Σ, Γ, q0, δ ) where {q0,q1,q2,q3,q4,q5,q6} ∈ Q, Σ = {0,1}, {0,1,X,Y,B} ∈ Γ, q0 ∈ Q, B ∈ Γ , B ∉ Σ, {q6} is the accepting state.

State01XYB
𝑞0(𝑞1, 𝑋, 𝑅)(𝑞2, 𝑌, 𝑅)(𝑞6, 𝑋, 𝑅)(𝑞6, 𝑌, 𝑅)(𝑞6, 𝐵, 𝑅)
𝑞1(𝑞1, 0, 𝑅)(𝑞1, 1, 𝑅)(𝑞3, 𝑋, 𝐿)(𝑞3, 𝑌, 𝐿)(𝑞3, 𝐵, 𝐿)
𝑞2(𝑞2, 0, 𝑅)(𝑞2, 1, 𝑅)(𝑞4, 𝑋, 𝐿)(𝑞4, 𝑌, 𝐿)(𝑞4, 𝐵, 𝐿)
𝑞3(𝑞5, 𝑋, 𝐿)(𝑞6, 𝑋, 𝑅)(𝑞6, 𝑌, 𝑅)
𝑞4(𝑞5, 𝑌, 𝐿)(𝑞6, 𝑋, 𝑅)(𝑞6, 𝑌, 𝑅)
𝑞5(𝑞5, 0, 𝐿)(𝑞5, 1, 𝐿)(𝑞0, 𝑋, 𝑅)(𝑞0, 𝑌, 𝑅)
7 Marks
OR OPTION
(a)
Compare NPDA with DPDA.
3 Marks
(b)

Show that if there are strings 𝑥 and 𝑦 in the language 𝐿 so that 𝑥 is a prefix of 𝑦 and 𝑥 ≠ 𝑦, then no DPDA can accept 𝐿 by empty stack.

4 Marks
(c)

Draw a TM for the Language of strings with balanced parenthesis “(” and “)” only.

7 Marks

Question 5

14 MarksMedium
(a)
When can we say that the language is decidable or undecidable?
3 Marks
(b)

Draw only the transition table of Turing Machine to accept the language 𝐿 = {0𝑛1𝑛: 𝑤ℎ𝑒𝑟𝑒 𝑛 ≥ 1}

4 Marks
(c)

Define: Bounded Minimalization and show that, if P is a primitive recursive (𝑛 +

1place predicate, its bounded minimalization 𝑚𝑃 is a primitive recursive function.
7 Marks
OR OPTION
(a)

When can the language be called a recursive language or a recursively enumerable language?

3 Marks
(b)

Show that a Turing Machine to recognize the language 𝐿 = 𝐿(0∗1) can accept the string without moving the head in L direction.

4 Marks
(c)

Define: 𝜇-Recursive functions and show how all computable functions are 𝜇 - recursive.

7 Marks
College Exam Groups

Studying for Theory of Computation?

Circulate this solved paper with KaTeX formulas and 1-click AI step solvers to your batchmates on WhatsApp or Telegram.

About this Examination Paper & Attribution

Official Gujarat Technological University (GTU) examination paper and step-by-step solutions for Theory of Computation (TOC) (Summer 2023, B.E. · Computer Engineering, Sem 6). Features complete 70-mark regular & remedial examination pattern, official marking distribution across all 5 questions, and direct 1-click official PDF download.

Transcribed for student exam preparation from Gujarat Technological University official examination archives. Questions, syllabus guidelines, and curriculum marking schemes remain the intellectual property of Gujarat Technological University.

Download PDF