Vous êtes sur la page 1sur 32

SESSION- 2017-18 [EVEN] SEMESTER

COURSE FILE

THEORY OF AUTOMATA & FORMAL


LANGUAGES
[RCS-403]

B.TECH CSE 2nd YEAR- SECTION: B

Shyam Bahadur Verma

Assistant Professor

Department of CSE

BIT, Meerut
METHODS OF EVALUATION

 Mid-Term Test (MT-1, MT-2)


 Assignments
 Quiz
 End Semester Examination

Course Description:

This module introduces the theory of computation through a set of abstract machines that serve
as models for computation - finite automata, pushdown automata, and Turing machines – and
examines the relationship between these automata and formal languages. Additional topics
beyond the automata classes themselves include deterministic and nondeterministic machines,
regular expressions, context free grammars, undecidability, and the P and NP problems.

Course Objectives:

1. Understand basic properties of formal languages and formal grammars.


2. Understand basic properties of deterministic and nondeterministic finite automata.
3. Understand the relation between types of languages and types of finite automata.
4. Understanding the Context free languages and grammars, and also Normalizing CFG.
5. Understanding the relationship between regular expressions and finite automata.
6. Understand basic properties of Turing machines and computing with Turing machines.
7. Understand the concept of Pushdown automata and its application.
8. Understand the challenges for Theoretical Computer Science and its contribution to other
sciences.

Learning Outcomes:

1)Knowledge
- Acquire a full understanding and mentality of Automata Theory as the basis of all computer
science
languages design.
- Have a clear understanding of the Automata theory concepts such as RE's, DFA's, NFA's,
Turing
machines, Grammar, halting problem, computability and complexity.
2) Cognitive skills (thinking and analysis).
- Be able to design FAs, NFAs, Grammars, languages modelling, small compilers basics.
- Be able to design sample automata.
- Be able to minimize FA's and Grammars of Context Free Languages.
3)Professional Skill
- Perceive the power and limitation of a computer.
- Solve the problems using formal language.
4) Attitude
- Develop a view on the importance of computational theory.
5) Abilities
-Implement the concepts of automata into compiler construction and hardware design.
-Implement the concepts of automata into text processing and in the area of artificial
intelligence.
On completion of this Subject / Course the student shall be able to:

S.N Objectives Outcomes

1 Understand basic properties of formal languages and formal grammars. 1,2


Understand basic properties of deterministic and nondeterministic finite
2 1,2,3
automata.

Understand the relation between types of languages and types of finite


3 1,2,3
automata.

Understanding the Context free languages and grammars, and also


4 1,2,3
Normalizing CFG.

Understanding the relationship between regular expressions and finite


5 1,2,3
automata.

Understand basic properties of Turing machines and computing with Turing


6 1,4
machines.

7 Understand the concept of Pushdown automata and its application. 1,4


Understand the challenges for Theoretical Computer Science and its
8 contribution to 5
other sciences
Program Outcomes

The Department of Computer Science has identified 14 program outcomes that


undergraduate students should achieve during their course of study. These outcomes are
listed below:

1. Graduates will demonstrate the ability to apply knowledge of mathematics and


science to analyze computing systems.
2. Graduates will have the conceptual knowledge and background to be able to
analyze a problem and identify and define the computing requirements for its
solution.
3. Graduates will have the ability to design a computer-based system, process,
component or program.
4. Graduates will have the ability to implement a computer-based system, process,
component or program.
5. Graduates will have the ability to evaluate an existing computer-based system,
process, component or program.
6. Graduates will be able to work effectively in teams in designing and
implementing software systems.
7. Graduates will be aware of key environmental and ethical issues affecting
computer science and their responsibilities as computer science professionals.
8. Graduates will demonstrate the ability to orally communicate ideas and concepts
clearly and in an organized manner.
9. Graduates will demonstrate the ability to write clear system documentation, user
documentation and reports.
10. Graduates will have an understanding of the impact of computers in society.
11. Graduates will have a solid understanding of the concepts underlying computer
science.
12. Graduates will demonstrate the ability to use current techniques, skills and tools
for computing practice.

These program outcomes are designed to prepare the student for a lifetime of growth in
a computer science career.
The expected outcomes of the Course / Subject are:

S.N General Categories of Outcomes Specific Outcomes of the Course


Acquire a full understanding and mentality of
Graduates will demonstrate the ability to apply knowledge of
A Automata theory as the basis of all computer
mathematics and science to analyze computing systems. science languages design.
Graduates will have the conceptual knowledge and background
Be able to design FAs, NFAs, Grammars,
B to be able to analyze a problem and identify and define the languages modelling, small compilers basics.
computing requirements for its solution.
Graduates will have the ability to design a computer-based
C No
system, process, component or program.
Graduates will have the ability to implement a computer-based
D No
system, process, component or program.
Graduates will have the ability to evaluate an existing Perceive the power and limitation of a
E
computer-based system, process, component or program. computer.
Graduates will be able to work effectively in teams in
F No
designing and implementing software systems.
Graduates will be aware of key environmental and ethical
G issues affecting computer science and their responsibilities as No
computer science professionals.
Graduates will demonstrate the ability to orally communicate
H No
ideas and concepts clearly and in an organized manner.
Graduates will demonstrate the ability to write clear system
I No
documentation, user documentation and reports.
Graduates will have an understanding of the impact of Develop a view on the importance of
J
computers in society. computational theory.
Graduates will have a solid understanding of the concepts Perceive the power and limitation of a
K
underlying computer science. computer.
Graduates will demonstrate the ability to use current Develop an ability to apply the knowledge of
L
techniques, skills and tools for computing practice. automata in the field of artificial intelligence.
LTP
NCS- 402 Theory of Automata & Formal Languages
3 10
PROPOSED
UNIT TOPIC
LECTURES

Introduction: Alphabets, Strings and Languages; Automata and Grammars,


Deterministic finite Automata (DFA)-Formal Definition, Simplified notation: State
1 transition graph, Transition table, Language of DFA, Nondeterministic finite 8
Automata (NFA), NFA with epsilon transition, Language of NFA, Equivalence of NFA
and DFA, Minimization of Finite Automata, Distinguishing one string from other,
Myhill-Nerode Theorem.
Regular expression (RE): Definition, Operators of regular expression and their
precedence, Algebraic laws for Regular expressions, Kleen’s Theorem, Regular
expression to FA, DFA to Regular expression, Arden Theorem, Non Regular
2
Languages, Pumping Lemma for regular Languages . Application of Pumping 12
Lemma, Closure properties of Regular Languages, Decision properties of Regular
Languages, FA with output: Moore and Mealy machine, Equivalence of Moore and
Mealy Machine, Applications and Limitation of FA.
Context free grammar (CFG) and Context Free Languages (CFL): Definition,
Examples, Derivation, Derivation trees, Ambiguity in Grammar, Inherent
ambiguity, Ambiguous to Unambiguous CFG, Useless symbols, Simplification of
3
CFGs, Normal forms for CFGs: CNF and GNF, Closure proper ties of CFLs, 12
Decision Properties of CFLs: Emptiness, Finiteness and Membership, Pumping
lemma for CFLs.

Push Down Automata (PDA): Description and definition, Instantaneous


4 Description, Language of PDA, Acceptance by Final state, Acceptance by empty 8
stack, Deterministic PDA, Equivalence of PDA and CFG, CFG to PDA and PDA to
CFG, Two stack PDA.

Turing machines (TM): Basic model, definition and representation, Instantaneous


Description, Language acceptance by TM, Variants of Turing Machine, TM as
5 Computerof Integer functions, Universal TM, Church’s Thesis, Recursive and 10
recursively enumerable languages, Halting problem, Introduction to
Undecidability, Undecidable problems about TMs. Post correspondence problem
(PCP), Modified PCP, Introduction to recursive function theory.
References:
1. Hopcroft, Ullman, “Introduction to Automata Theory, Languages and Computation”, Pearson Education.
2. K.L.P. Mishra and N.Chandrasekaran, “Theory of Computer Science : Automata, Languages and Computation”, PHI Learning
Private Limited, Delhi India.
3. Peter Linz, "An Introduction to Formal Language and Automata", Narosa Publishing house.
4. Y.N.Singh “Mathematical Foundation of Computer Science”, New Age International.
5. Papadimitrou, C. and Lewis, C.L., “Elements of the Theory of Computation”, PHI Learning Private Limited, Delhi India.
6. K.Krithivasan and R.Rama; “Introduction to Formal Languages, Automata Theory and Computation”, Pearson Education.
7. Harry R. Lewis and Christos H. Papadimitriou, Elements of the theory of Computation, Second Edition, Prentice -Hall of India
Pvt. Ltd.
8. Micheal Sipser, “Introduction of the Theory and Computation”, Thomson Learning.

2017-18 [EVEN] SEMESTER


Class Test/ Quiz/ Viva-Voce Details
Subject Name: Theory of Automata & Formal Languages [RCS-403] Year: 2nd

S.N Date Time Slot Topics Covered Number of Remarks


Students
1 QUIZ-1

2 QUIZ-2

3 UNIT TEST-1
4 QUIZ-3

5 QUIZ-4

6 UNIT TEST-2
7 QUIZ-5

8 QUIZ-6

9 UNIT TEST-3
10 QUIZ-7
11 QUIZ-8
12 UNIT TEST-4
13 QUIZ-9
14 QUIZ-10
15 UNIT TEST-5
Mid-Term Test Details
Subject Name: Theory of Automata & Formal Languages [RCS-403]
Year: 2nd

Students
S.N Topics Covered <50% 50-75% >75% Remarks
Appeared

3
LESSON PLAN
Subject Name: Theory of Automata & Formal Languages [RCS-403] Year: 2nd

Planned Execution Objective


S.N. Unit Topic(s) Covered References
Date Date No.
Introduction: Alphabets, Strings and 22-1-2018
1 Languages; Automata and Grammars.
1 TB-1, Page 27-30
Deterministic finite Automata (DFA)- 23-1-2018
Formal Definition, Simplified notation:
2 State transition graph, Transition table,
2,3 TB-1, Page 43-47
Language of DFA.
3 Nondeterministic finite Automata (NFA). 24-1-2018 2,3 TB-1, Page 53-54

4 I NFA with epsilon transition, Language of 25-1-2018 1,2,3 TB-1, Page 68-73
NFA.
5 Equivalence of NFA and DFA. 29-1-2018 1,2,3 TB-1, Page 57
6 Minimization of Finite Automata. 30-1-2018 1,2,3 TB-1, Page 148
7 Distinguishing one string from other. 31-1-2018 1,2,3 TB-1, Page 146-148
Myhill-Nerode Theorem. 2-2-2018
8 1,2,3 Lecture Notes

II Regular expression (RE), Definition, 5-2-2018


9 Operators of regular expression and their 1,2,5 TB-1, Page 79-83
precedence.
Algebraic laws for Regular expressions, 6-2-2018
10 Kleen’s Theorem.
1,2,5 TB-1, Page106-112

11 Regular expression to FA. 7-2-2018 1,2,5 TB-1, Page 85-89


DFA to Regular expression, Arden 8-2-2018
12 Theorem.
1,2,5 TB-1, Page 90
Non Regular Languages, Pumping Lemma 9-2-2018
13 for regular Languages.
1 TB-1, Page 117-118

14 Application of Pumping Lemma. 14-2-2018 1 TB-1, Page 119


15 15-2-2018
Closure properties of Regular Languages,
1,2,5 TB-1, Page 122-135
16 Decision properties of Regular Languages. 16-2-2018

17 FA with output: Moore and Mealy machine. 17-2-2018 1,2,3 TB-2, Page 84
18 Equivalence of Moore and Mealy Machine. 18-2-2018 1,2,3 TB-2, Page 85-87

19 22-2-2018
20 Applications and Limitation of FA. 23-2-2018 1,3 TB-1, Page 64
Context free grammar (CFG) and Context 26-2-2018
21 Free Languages (CFL): Definition, 1,4 TB-1, Page 157
Examples, Derivation , Derivation trees.
22 Ambiguity in Grammar, Inherent ambiguity. 28-2-2018 1,4 TB-1, Page 193
23 Ambiguous to Unambiguous CFG. 5-3-2018 1,4 TB-1, Page 194
6-3-2018
24 Useless symbols, Simplification of CFGs. 1,4 TB-1, Page 240

7-3-2018

III 8-3-2018 Student Objective Date when topic


S.N Topic(s) Covered
Strength No. was taught
25 Normal forms for CFGs: CNF. 9-3-2018 1,4 TB-1, Page 250
26 12-3-2018 1,4
Normal forms for CFGs: GNF. TB-1, Page 252
27 13-3-2018

28 14-3-2018
Closure properties of CFLs. 1,4 TB-1, Page 264-271
29 15-3-2018

30 16-3-2018
Decision Properties of CFLs: Emptiness,
1,4 TB-1, Page 276-283
31 Finiteness and Membership. 20-3-2018

32 Pumping lemma for CFLs. 21-3-2018 4 TB-1, Page 257-260


Push Down Automata (PDA): Description 22-3-2018
33 and definition, Instantaneous Description, 1,7 TB-1, Page 205
Language of PDA.
34 Acceptance by Final state. 23-3-2018 7 TB-1, Page 214
35 Acceptance by empty stack. 24-3-2018 7 TB-1, Page 216
36 IV Deterministic PDA. 25-3-2018 7 TB-1, Page 232
37 Equivalence of PDA and CFG. 29-3-2018 4,7 TB-1, Page 222
38 Conversion from CFG to PDA. 30-3-2018 4,7 TB-1, Page 223
39 Conversion from PDA to CFG. 2-4-2018 4,7 TB-1, Page 226
40 Two stack PDA. 3-4-2018 4,7 Lecture Notes
V Turing machines (TM): Basic model, 4-4-2018
41 definition and representation, Instantaneous 1,6 TB-1, Page 296
Description, Language acceptance by TM.
42 Variants of Turing Machine. 5-4-2018 6 TB-1, Page 314
43 TM as Computer of Integer functions. 6-4-2018 6 TB-1, Page 332
44 Universal TM, Church’s Thesis. 9-4-2018 6,8 TB-1, Page 337
Recursive and recursively enumerable 10-4-2018
45 languages.
6 TB-1, Page 350
Halting problem, Introduction to 11-4-2018
46 Undecidability, Undecidable problems 6,8 TB-1, Page 358
about TMs.
47 Post correspondence problem (PCP). 12-4-2018 6,8 TB-1, Page 366-367
48 Modified PCP. 13-4-2018 6,8 TB-1, Page 369
49 16-4-2018
Introduction to recursive function theory. 6 TB-1, Page 355-356
50 17-4-2018
18-04-2018
to
51 Revision Classes
19-04-2018

Solving University Old 20-04-2018


52
Question Papers

Student Attendance Sheet


Subject Name: Theory of Automata & Formal Languages [RCS-403]
Year: 2nd

Date Date Date Date Date Date Date Date Date Date Date Date
S N. Name of Student UPTU R N

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15

16
17
18
19

20

21
22
23
24
25
26
27
28
29
30
31
32
33
34

35

36

37
38
39
40

41

42

43
Total Present
TUTORIAL SHEETS – I

Note: This Tutorial corresponds to Unit Nos.1-2

Q1 .Construct the Grammar for following FA. Obj-1

Q2. Differentiate between Moore and Melay machines. Obj-2,3


Q3. Construct regular expression for following FA. Obj-5

Q4. Explain Obj-1,2,3


i) E-closure
ii) NFA with E-closure

Q5. a) Explain the equivalence of two Finite Automata. Obj-1,2,3


b) Convert the regular expression to NFA : 0*(1+0) +01*

Q6. Minimize the following FA using Myhill-Nerode theorem Obj-3

Q7. Convert the following Left Linear Grammar to NFA. Obj-1


S-->Ab/ab
A--->Ab/Bb
B--->Ba/a

TUTORIAL SHEETS – II
Note: This Tutorial corresponds to Unit Nos.1-2

Q1. Convert the following Grammar to NFA Obj-1,2


S01A/10B
A01C/01
B10D/10
C01A
D10B

Q2. Convert the following (epsilon)ε- NFA to DFA Obj-1,2,3

Q3. Construct an NFA equivalent to the RE ((0+1)(0+1)(0+1))*


Obj-1,5
Q4. Convert the following Mealy machine into Moore machine
Obj-3

Q5. Convert the following Moore machine into Mealy machine


Obj-3
Q6. Find whether the following languages are regular or not.
Obj-1,3
(i) L={wε{a,b}|w=w }. R

(ii) L={0 1 2 ,n,m>=1}


n m n+m

(iii) L={1 |k=n ,n>=1} . (4)


k 2

(iv) L1/L2={x | for some y εL2,xy εL1},where L1 and L2 are


any two languages and L1/L2 is the quotient of L1 and L2.

TUTORIAL SHEETS – III

Note: This Tutorial corresponds to Unit Nos.3-4


Q1. Convert the following grammar into CNF Obj-4

SASA|aB

AB|S

Bb|ε

Q2. Design a push automata which accepts L={apbqcm|p+m=q} Obj-7

Q3. Convert CFG to PDA Obj-7

SaAA

AaS|bS|a

Q4. Let L2 denote the context-free language {ααR | α ∈ {a, b}*}, where αR stands for the

reverse of the stringα. Prove or disprove: The complement of L2 (that is, ∼L2 = {a, b}* - L2)

is context-free. (Note: Either construct a CFG/PDA to accept ∼L2, or supply a proof based on

the pumping lemma. Obj-4

Q5. Construct CFG for the following languages: Obj-4

a) L = { an / n is odd}

b) L={an bn /n>=1}.

Q6. Let G be the grammar S->aB/bA,A->a/aS/bAA,B->b/bS/aBB. for the string aaabbabbba

find the left most derivation. Also draw parse tree for the same. Obj-4

Q7. For the grammar S->aCa,C->aCa/b. Find L(G). Obj-4


Q8. Find the language generated by the CFG G=({S},{0,1},{S->0/1/ε, S->0S0/1S1},S).

Obj-4

Q9. What is the disadvantages of unambiguous parse tree. Give an example. Obj-4

TUTORIAL SHEETS – IV

Note: This Tutorial corresponds to Unit Nos.5


Q1. Design a TM to recognize each of the following languages. {ww R | w € (0+1)*} Obj-6
Q2. Describe the language accepted by the following Turing machine: Obj-1,6
a)

b)

Q3. Design the Turing machine which can shift the data on tape by two spaces. Obj-7
Q4. Design a Turing machine for function f(x,y)=x(x+y). Obj-7
Q5. Is it true that the language accepted by a non deterministic Turing Machine is different
from recursively enumerable language? Obj-7
Q6. When we say a problem is decidable? Give an example of undecidable problem? Give
two properties of recursively enumerable sets which are undecidable. Obj-8
Q7. Show that the following problem is undecidable.“Given two CFG’s G1 and G2, is
L(G1)∩L(G2)=Φ?”. Obj-8
Q8. Let Σ={0,1}.Let A and B be the lists of three strings each, defined as List A=
{1,10111 ,10}, List B={111 ,10 ,0 }.Does the instance of PCP has a solution.
Obj-8

Theory of Automata & Formal Languages
UNIT­1
ASSIGNMENT­1

1. Define finite automata. Discuss the applications based on finite automata.    
2. Describe the Deterministic and Non­ deterministic finite automata. How does the
Deterministic finite automaton differ from Non­ deterministic finite automata? 

*
3. Construct a DFA for the language L= (a+b) abb.
4. Construct a finite automata accepting all strings over {0, 1} having odd number of 0’s

5. Construct a finite automata accepting all strings over {0, 1} having even number of
0’s and 1’s.
6. What do you mean by Regular expressions? How can you convert a NFA to regular
expression?

UNIT­1
ASSIGNMENT­2

*
1. Construct the FA from the following regular expression r= (11+110) 0.
*
2. Construct a DFA equivalent to regular expression ba+(a+bb)a b
3. How NFA is converted to DFA? Give example and explain.
4. Construct DFA for given NFA with ∈­moves.

5. Construct a DFA equivalent to
M= ({q0, q1,q2},{0,1},$,q0,{q2})

6. Find a Regular expression corresponding to each of the following subsets over {0,1}*. 
th
a. The set of all strings where the 10  symbol from right end is a 1. 
b. The set of all strings containing exactly 2a’s. 
c. The set of all strings containing at least 2a’s. 
d. The set of all strings containing the substring aa.

UNIT­2
ASSIGNMENT­1

1. Define finite state machine. Describe Moore and Melay machines in detail.

2. Describe Myhill­ Nerode theorem.
3. Discuss the limitations of FSM.
4. Discuss Pumping lemma. Describe the application of pumping lemma.
5. Prove that the class of regular set is closed under complementation. 

6. Explain Melay and More machines. Construct Mooray machine which is equivalent 
toMelay machine.

Melay Machine
Present state Input a=0 Input a=1
State Output State Output

q1 q3 0 q2 0
q2 q1 1 q4 0
q3 q2 1 q1 1
q4 q4 1 q3 0
UNIT­2
ASSIGNMENT­2

1. Construct minimum state automata equivalent to transition diagram:­

2. Construct finite automata equivalent to regular expression

*
(0+1) (00+11)(0+1)
3. Convert this NFA into R.E by using arden’s method.

i2
4. Show that the set L={a  |i>=1} is not regular.
i i
5. Show that L={0 1 |>=1} is not regular.
6. Construct a Moore machine equivalent to melay machine.

Start 0/Z1

q2
q1
1/Z2 0/Z1
1/Z1 1/Z

q3
UNIT­3

ASSIGNMENT­1

1. Discuss Griebach Normal Form (GNF) and its applications.
2. Convert the grammar into GNF.
S­>AB

A­>BS/b

B­>SA/a
3. What is meant by pushdown machines? Discuss the application of pushdown 
machines.
4. Define context free and context sensitive grammar and explain them.

5. Write three different derivation of the string “ababaa” using the following grammar.
Also give the derivation tree. 

S­> AA 
A­>AAA|bA|Ab|a
6. Eliminate all null productions.

S­>ACD
A­>a
B­>∈
C­>ED/∈
D­>BC/b
E­>b

UNIT­3,4
ASSIGNMENT­2

1. S­>S+S/S*S/a/b   show that G is ambiguous.
2. Find a grammar in CNF equivalent to the grammar.
S­>ASA/bA

A­>B/S

B­>C
3. What do you mean by ambiguity? If CGF is S=SbS/a, show that G is ambiguous.

n n
4. Design a PDA to accept the language L= {a b | n>=1} by null store. 
n m n
5. Design a PDA to accept the language L= (a b c |n,m>=1} by null store. 
6. Construct a PDA with equal no of a’s and b’s by final state.
UNIT­5
ASSIGNMENT­1

1. Write a short note on unrestricted grammar.
2. Write a note on PCP problem.
3. Explain Deterministic and Non deterministic Turing machines.
4. Write short note on primitive recursive functions.
5. What do you mean by halting problem of Turing machine?
6. Write short note on Chomsky hierarchy.

UNIT­5
ASSIGNMENT­2

n n
1. Design a Turing machine to accept the language L={a b  |n>=1}   
2. Find the highest type number which can be applied to the following productions: 
S­>Aa, A­>c/Ba, B­>abc
S­>aS/ab
3. Design a Turing machine over {1,b} which can compute a concatenation function over 

∑= {1}. If a pair of words (w1, w2) is input, the output has to be w1w2.
4. Explain Primitive recursive function over initial function.
5. Explain Primitive recursive function over N.
6. Explain the model of Linear bounded automata.
QUIZ-1

Q1. Consider the DFA given above. Which of the following are FALSE?
1. Complement of L(A) is context-free.
2. L(A) = L((11*0+0)(0 + 1)*0*1*)
3. For the language accepted by A, A is the minimal DFA.
4. A accepts all strings over {0, 1} of length at least 2.
A 1 and 3 only
B 2 and 4 only
C 2 and 3 only
D 3 and 4 only

Q2. What is the complement of the language accepted by the NFA shown below?

Q3. Let w be any string of length n is {0,1}*. Let L be the set of all substrings of w. What is the
minimum number of states in a non-deterministic finite automaton that accepts L?

A n-1
B n
C n+1
D 2n-1
Q4. Which one of the following languages over the alphabet {0,1} is described by the regular
expression: (0+1)*0(0+1)*0(0+1)*?

A The set of all strings containing the substring 00.


B The set of all strings containing at most two 0’s.
C The set of all strings containing at least two 0’s.
D The set of all strings that begin and end with either 0 or 1
Q5. Which one of the following is FALSE?

A There is unique minimal DFA for every regular language


B Every NFA can be converted to an equivalent PDA.
C Complement of every context-free language is recursive.
D Every nondeterministic PDA can be converted to an equivalent deterministic PDA.
QUIZ-2
Q1. Which of the following statements is false?

A Every NFA can be converted to an equivalent DFA


Every non-deterministic Turing machine can be converted to an equivalent deterministic
B
Turing machine
C Every regular language is also a context-free language
D Every subset of a recursively enumerable set is recursive
Q2. Which of the following is TRUE?
A Every subset of a regular set is regular.
B Every finite subset of a non-regular set is regular.
C The union of two non-regular sets is not regular.
D Infinite union of finite sets is regular
Q3. A minimum state deterministic finite automaton accepting the language L={w | w ε {0,1} *,
number of 0s and 1s in w are divisible by 3 and 5, respectively} has

A 15 states
B 11 states
C 10 states
D 9 states

Q4.

A {q0, q1, q2}


B {q0, q1}
C {q0, q1, q2, q3}
D {q3}
Q5. The regular expression 0*(10*)* denotes the same set as

A (1*0)*1*
B 0 + (0 + 10)*
C (0 + 1)* 10(0 + 1)*
D none of these
QUIZ-3
Q1.

The Finite state machine described by the following state diagram with A as starting state, where
an arc label is x / y and x stands for 1-bit input and y stands for 2- bit output

A Outputs the sum of the present and the previous bits of the input.
B Outputs 01 whenever the input sequence contains 11.
C Outputs 00 whenever the input sequence contains 10.
D None of these
Q2. The smallest finite automation which accepts the language {x | length of x is divisible by 3}
has :

A 2 states
B 3 states
C 4 states
D 5 states

Q3. Given an arbitary non-deterministic finite automaton (NFA) with N states, the maximum
number of states in an equivalent minimized DFA is at least

2 N
A-N B-2 C-2N D-N!

Q4.
A {q0, q1, q2}
B {q0, q1}
C {q0, q1, q2, q3}
D {q3}
Q5. How many minimum states are required in a DFA to find whether a given binary string
has odd number of 0's or not, there can be any number of 1's.
A-1 B-2 C-3 D-4

QUIZ-4
Q1. The number of states in the minimal deterministic finite automaton corresponding to the
regular expression (0 + 1)*(10) is

A-5 B-2 C-3 D-4

Q2. Let T be the language represented by the regular expression Σ∗0011Σ∗ where Σ = {0, 1}. What is the
minimum number of states in a DFA that recognizes L' (complement of L)?

A-4 B-5 C-6 D-8

Q3.
Which of the following statements is TRUE about the regular expression 01*0?
A It represents a finite set of finite strings.
B It represents an infinite set of finite strings.
C It represents a finite set of infinite strings.
D It represents an infinite set of infinite strings

Q4. The number of states in the minimum sized DFA that accepts the language defined by the regular
expression (0+1)*(0+1)(0+1)* is __________________

A-4 B-5 C-2 D-3

Q5. Consider the following two statements:


I. If all states of an NFA are accepting states then the language accepted by
the NFA is Σ∗ .
II. There exists a regular language A such that for all languages B, A ∩ B is
regular.

Which one of the following is CORRECT?


A Only I is true
B Only II is true
C Both I and II are true
D Both I and II are false
QUIZ-5
Q1. In the context-free grammar below, S is the start symbol, a and b are terminals, and ϵ
denotes the empty string S → aSa | bSb | a | b | ϵ Which of the following strings is NOT
A aaaa
B baba
C abba
D babaaabab
Q2. Consider the languages L1 = {0i1j | i != j}. L2 = {0i1j | i = j}. L3 = {0i1j | i = 2j+1}. L4 =
{0i1j | i != 2j}.

A Only L2 is context free


B Only L2 and L3 are context free
C Only L1 and L2 are context free
D All are context free
Q3 S -> aSa|bSb|a|b; The language generated by the above grammar over the alphabet {a,b} is
the set of

A All palindromes
B All odd length palindromes.
C Strings that begin and end with the same symbol
D All even length palindromes
Q4. Consider the CFG with {S,A,B) as the non-terminal alphabet, {a,b) as the terminal alphabet,
S as the start symbol and the following set of production rules
S --> aB S --> bA
B --> b A --> a
B --> bS A --> aS
B --> aBB A --> bAA
Which of the following strings is generated by the grammar?
A aaaabb
B aabbbb
C aabbab
D abbbba
Q5. For the correct answer strings to above question, how many derivation trees are there?

A 1
B 2
C 3
D 4

generated by the grammar?


QUIZ-6
Q1 he language L= {0i21i | i≥0 } over the alphabet {0,1, 2} is:

A not recursive
B is recursive and is a deterministic CFL.
C is a regular language.
D is not a deterministic CFL but a CFL
Q2. Let G = ({S}, {a, b} R, S) be a context free grammar where the rule set R is S → a S b | SS | ε
Which of the following statements is true?

AG is not ambiguous
BThere exist x, y, ∈ L (G) such that xy ∉ L(G)
CThere is a deterministic pushdown automaton that accepts L(G)
DWe can find a deterministic finite state automaton that accepts L(G)
Q3. Which of the following statements is true?
A If a language is context free it can always be accepted by a deterministic push-down automaton
B The union of two context free languages is context free
C The intersection of two context free languages is context free
D The complement of a context free language is context free
Q4. Which one of the following statements is FALSE?

There exist context-free languages such that all the context-free grammars generating them are
A
ambiguous
An unambiguous context free grammar always has a unique parse tree for each string of the language
B
generated by it.
Both deterministic and non-deterministic pushdown automata always accept the same set of
C
languages
D A finite set of string from one alphabet is always a regular language.
Q5. A CFG G is given with the following productions where S is the start symbol, A is a non-terminal
and a and b are terminals.
S→aS∣A
A→aAb∣bAa∣ϵ
Which of the following strings is generated by the grammar above?
A-aabbaba B-aabaaba C-abababb D-aabbaab

QUIZ-7
m n m+n
Q1. The language {a b C | m, n ≥ 1} is

A regular
B context-free but not regular
C context sensitive but not context free
D type-0 but not context sensitive
Q2. The language accepted by a Pushdown Automation in which the stack is limited to 10 items is
best described as
A Context Free
B Regular
C Deterministic Context Free
D Recursive
Q3. Which of the following statements is true?
A If a language is context free it can always be accepted by a deterministic push-down automaton
B The union of two context free languages is context free
C The intersection of two context free languages is context free
D The complement of a context free language is context free
Q4. Which of the following languages are context-free?
L1 = {ambnanbm ⎪ m, n ≥ 1}
L2 = {ambnambn ⎪ m, n ≥ 1}
L3 = {ambn ⎪ m = 2n + 1}
A L1 and L2 only
B L1 and L3 only
C L2 and L3 only
D L3 only

QUIZ-9

QUIZ-8
Q1. Let L1 be a recursive language. Let L2 and L3 be languages that are recursively enumerable but not
recursive. Which of the following statements is not necessarily true? (A) L2 – L1 is recursively
enumerable. (B) L1 – L3 is recursively enumerable (C) L2 ∩ L1 is recursively enumerable (D) L2 ∪ L1 is
recursively enumerable

A B C D

Q2. If L and L' are recursively enumerable, then L is

A regular
B context-free
C context-sensitive
D recursive
Q3. Let L be a language and L' be its complement. Which one of the following is NOT a viable
possibility?

A Neither L nor L' is recursively enumerable (r.e.).


B One of L and L' is r.e. but not recursive; the other is not r.e.
C Both L and L' are r.e. but not recursive.
D Both L and L' are recursive
Q4. For S ∈ (0 + 1) * let d(s) denote the decimal value of s (e.g. d(101) = 5). Let L = {s ∈ (0 +
1)* d(s)mod5 = 2 and d(s)mod7 != 4}. Which one of the following statements is true?

A L is recursively enumerable, but not recursive


B L is recursive, but not context-free
C L is context-free, but not regular
D L is regular

Q5. Let L1 be a recursive language, and let L2 be a recursively enumerable but not a
recursive language. Which one of the following is TRUE?
L1' --> Complement of L1
L2' --> Complement of L2
A L1' is recursive and L2' is recursively enumerable
B L1' is recursive and L2' is not recursively enumerable
C L1' and L2' are recursively enumerable
D L1' is recursively enumerable and L2' is recursive

Vous aimerez peut-être aussi