0% found this document useful (0 votes)
1K views11 pages

N 4 DD 4 Aadae 1466

This document contains a question bank for the subject "FLAT" from the Department of Computer Science and Engineering at Shaheed Udham Singh College of Engineering and Technology, Tangori. It includes 81 questions ranging from short answer to long answer/comprehensive type questions related to formal languages and automata theory. The questions cover topics such as regular expressions, finite automata, pushdown automata, context-free grammars, Turing machines, recursively enumerable languages, and properties of formal language classes.

Uploaded by

bijan11
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views11 pages

N 4 DD 4 Aadae 1466

This document contains a question bank for the subject "FLAT" from the Department of Computer Science and Engineering at Shaheed Udham Singh College of Engineering and Technology, Tangori. It includes 81 questions ranging from short answer to long answer/comprehensive type questions related to formal languages and automata theory. The questions cover topics such as regular expressions, finite automata, pushdown automata, context-free grammars, Turing machines, recursively enumerable languages, and properties of formal language classes.

Uploaded by

bijan11
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 11

SHAHEED UDHAM SINGH COLLEGE OF ENGINEERING AND

TECHNOLOGY , TANGORI

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


QUESTION BANK

Subject Code: CS-404 Year/ Sem: 4th / 7th


Subject Name: FLAT

Prepared By: - Er. Sukhpreet Kaur

Short Answer/Recall Type Questions


1) What is the difference between Kleene’s closure and Positive closure of a set?
2) What is a Finite Automaton?
3) The Regular Sets are closed under Homomorphism. Explain.
4) Explain Homomorphism and Inverse Homomorphism.
5) What are Ambiguous Grammars?
6) Is Push Down Automata a Deterministic Device? Explain.
7) What is the difference between Regular Grammar and Context Free
Grammars?
8) If F1 and F2 be two Finite Automata accepting languages L1 and L2
respectively, when can F1 and F2 be termed as equivalent?
9) Can the language {anbncn : n>=0 } be accepted by a Turing Machine.
10) State any two properties of LR(k) grammars.
11) What do you mean by reduced grammars? Give example.
12) Every non-empty CFL is generated by a CFG with no useless symbols. Justify
the statement.
13) Give the leftmost order of derivation of a string id + id * id. Also draw the
derivation tree with the grammar E  E+E | E*E | id.
14) What do you understand by Recursively Enumerable Language?
15) State about Dyck Language.
16) Define Regular Expressions.
17) What do you understand by Canonical Derivations?
18) Differentiate between Context Free and Context Sensitive Grammars.
19) The conversion from a grammar to Chomsky normal form can square the
number of productions in a grammar. Justify the statement.
20) Write the definition of a Language and give an example.
21) Give the difference between Type 1 grammars and Type 2 grammars.
22) Write the One Sided Context Sensitive Grammar.
23) Give the mathematical definition of Finite Automata.
24) Write the Kuroda Normal Form.
25) Explain in detail the properties of LL(k) grammars.
26) Give the transition table of a Turing Machine.
27) Write algebraic properties of Universality.
28) For a given problem if a Turing machine halts, it signifies that the problem
cannot be enumerated by a Push Down Automata…. True/False
29) A grammar given by A aS | b | aSS | a is in GNF.. True/False.
30) Finite Automata can have a single bit memory to remember a past state in
which it has been at earlier time… True/False
31) Homomorphism is property of regular languages but not of context free
languages…. True/False
32) Derivation languages must be Context sensitive languages…. True/False
33) A set of palindromes over the set {a,b} is an example of Dyck Language….
True/False
34) What are Rewriting Systems? What are the two operations in Rewriting
Systems?
35) Prove that the following grammar is ambiguous :-
S  aB | ab , A  aAB | a , B  ABb | b.
36) Find the language generated by the following grammar
S  0S1 | 0A1 , A  1A | 1.
37) Construct a C.F.G generating all integers ( with sign)
38) Cellular automaton can be made to work in any dimension of adjacency….
True/False
39) A language that is accepted by a Push Down Automaton must always have a
grammar to generate the same language set…. True/False
40) LL(1) grammars are never ambiguous…. True/False
41) C compiler is an example of one sided context sensitive grammar….
True/False
42) What is ε –closure of state?
43) Write regular expression for the language which consists of set of strings of
0's and 1's with atmost one pair of consecutive 1's.
44) What is Idempotence Law of Union?
45) What is meant by Yield of a Parse Tree ?
46) Give formal notation for Push Down Automata.
47) What are useless symbols in context of grammars?
48) What is 2- Push Down Automata?
49) Construct a nondeterministic finite automaton accepting {ab,ba}, and use it to
find a deterministic automaton accepting the same set.
50) Consider a set L = {0, 1}. What is L* and L+?
51) What is the difference between NDFA and DFA?
52) Differentiate between PDA and 2PDA.
53) What are Rewriting Systems? What are the two operations in Rewriting
Systems?
54) Give the R.E for the following language:
a) which uses first character ‘a’ or ‘c’ followed by any string using ‘b’.
b) which uses character a , b but have exactly one ’a’.
55) Prove that the following grammar is ambiguous :-
S  aB | ab , A  aAB | a , B  ABb | b.
56) Find the language generated by the following grammar
S  aA , A  bS , SΛ.
57) Design a CFG for the language :-
L = { 0n 1n | n>=0} U { 1n 0n | n>=0}
58) State and prove Arden’s Theorem.
59) Find the language generated by the following grammar
S 0S1 | 0A | 0 | 1B | 1 , A  0A | 0 , B 1B 1.
60) Find the grammar for the following language :
L = { an b2n cm | n,m>=0}
61) Consider the CFG
SXX,
X XXX | bX | Xb | a
Find the parse tree for the string bbaaaab.
62) Differentiate between Homomorphism and Isomorphism.
63) Write the regular expression over alphabet (a,b,c) containing at least one a and
at least one b.
64) Give the regular expression for the set of strings of 0’s and 1’s whose tenth
symbol from the right end is 1.
65) Write a regular expression for the set of strings of 0’s and 1’s not containing
101 as a substring.
66) Differentiate between Derivation Trees and Derivation Graphs.
67) What are Derivation Languages? State the algebraic properties of derivation
languages with suitable example.
67) Define Parse Trees ? What is meant by a yield of a parse tree?
68) Write the regular expression for the language accepting all combinations of a’s
over the set Σ = {a}.
69) Design the regular expression for the language accepting all combinations of
a’s except the null string over Σ ={a}.
70) Construct the regular expression for the language accepting all the strings
which are ending with 00 over the set Σ = {0,1}.
71) If L = { The Language starting and ending with a and having any combination
of b’s in between}, then what is r?
72) Describe in simple English the language represented by the following regular
expression r = (a +ab)*
73) Write a regular expression which denotes a language L over the set Σ = {1}
having odd length of strings.
74) Describe the language denoted by following regular expression
r.e = (b * (aaa) * b *)*
75) Show that (0*1*)* = ( 0 + 1)*
76) Construct CFG for the language containing atleast one occurrence of double a.
77) Construct CFG for the language containing all the strings of different first and
last symbols over Σ = {0,1}.
78) Design a FA which accepts the only input 101 over the input set Z = {0,1).
79) Why finite automata are less powerful than PDA?
80) Design a FA which checks whether the given binary number is even.
81) Design FA which accepts only those strings which start with 1 and ends with
0.
Long Answer/Comprehensive Type Questions

1) Find the reduced grammar that is equivalent to CFG given below


S  aAa , A  bBB , B  ab , C aB.

2) Show that G1 = ( { S} , {a ,b}, P1 , S ) , where P1 = { S  aSb | ab } is equivalent


to G2 =( {S , A , B, C}, {a , b} , P2 , S ), where P2 = { S AC , C SB , S AB ,
Aa , Bb}
3) Convert the following grammar into CNF.
S  1A | 0B , A  1AA | 0S | 0 , B  0BB | 1S | 1
4) Prove that the language of a set of strings of 0’s and 1’s whose length is a perfect
square is not regular.
5) a) State differences between a push down automata and a 2 push down automata.
b) Consider the following Push Down Automata P = ({q}, {e,i}, {Z},δ , q , Z)
where δ is defined by :
δ ( q , i , Z ) = { ( q,ZZ)}
δ ( q , e, Z ) = { ( q, ε ) }
Convert this PDA to an equivalent grammar.
6) Why is it necessary to have unambiguous grammar? Consider the grammar given
by SaS | aSbS | ε. Prove that this grammar is unambiguous.
7) Discuss the working of cellular automata with a suitable example.
8) Construct a NPDA equivalent to the following grammar:
G = ( {S, A}, {a, b}, P, S )
Productions
S -> a A A
A -> a S | b S | a
9) Find the reduced grammar that is equivalent to CFG given below :
S  aC | SB.
A  bSCa.
B  aSB | bBC.
C  aBC | ad.
10) Construct the Finite Automata for accepting all possible strings of zeros and one’s
which does not contain 011 as substring.
11) List and explain various formal language aspects in detail.
12) List the properties of context free grammars/languages.
13) Explain Translation Lemmas in complexity theory.
14) Prove that {0"/n is a power of 2} is not a regular language.
15) Draw a parse tree for the following grammar which derives the string
00011
S  A1B
A  0A/ ε
B  oB/1B/ε
16) Consider the following ambiguous grammar.
S  as/aSbS/ ε.
Show that the string ‘aab’ has two :
(i) Parse Trees
(ii) Left Most Derivation
(iii) Right Most Derivations
17) Write a brief note about Universality and Complexity in cellular automata.
18) Give the Deterministic Finite Automata accepting the set of all strings of 0’s and
1’s in which both the number of 0’s and 1’s are even.
19) Let L be the set of all strings given by 0i1i where i is an integer greater than 1 i.e.
L = { 0i1i | i is an integer, i>=1}
Prove that L is not a regular set.
20) Let G be a grammar given by (V,T,P,S) with V ={S}, T={a,b,c}, P ={ SaSa ,
SbSb , Sc} where generates the language {wcwR : w t {a,b}* and wR is reverse
of string w}. Construct a PDA equivalent to the following grammar.
21) Given the CFG G = ( {S, A, B, C}, {a, b}, P, S) with Productions
S -> AB | BC
A -> BA | a
B -> CC | b
C -> AB | a
Determine if these strings are in the language:
a) aaaaa
b) aaaaaa
c) baabab
22) Some languages which are not accepted either by a Finite Automaton or by a
Push Down Automaton are accepted by a Turing Machine. Explain the statement with
a suitable example.
23) Convert the grammar SAS | aa into GNF.
24) Write the definition of a non deterministic push down Automata (npda).
Construct a pda A accepting
L={ wcwT | w belongs to {a,b}* } by final state.
25) Convert the following grammar with productions SABa, Aaab, BAc to
Chomsky Normal Form.
26) Show that L ={anbncn | n>=1} is not context free but context sensitive.
27) If X and Y are regular sets over ∑, then X ∩ Y is also regular over ∑.
28)Find the reduced grammar that is equivalent to CFG given below :
S  aAa , A  Sb | bcc | DaA , C  abb |DD , E  aC ,
D  aDA
29)Show that G1 = ( { S} , {a ,b}, P1 , S ) , where P1 = { S  aSb | ab } is
equivalent to
G2 =( {S , A , B, C}, {a , b} , P2 , S ), where P2 = { S AC ,
C SB , S AB , Aa , Bb}
30) Convert the following grammar into CNF.
S abSb | a | aAb
A  bS | aAAb.
31) Identify and remove the unit productions from following grammar
S A | bb,
A  B | b,
B  S | a.
32) Consider the following grammar G and remove the null productions :
SABAC , A aA | Λ , B bB | Λ , C  c.
33) Find the reduced grammar that is equivalent to the CFG given below:
SaC | SB , AbSCa , BaSB | bBC, CaBC | ad.
34) For the ∑ = {a,b}
i) Build an FA that accepts only those words that have more than four letters.
ii) Build an FA that accepts only those words that have fewer than four letters.
iii) Build an FA that accepts only those words with exactly four letters.
iv) Build an FA that accepts only those words that do not with ba.
v) Build an FA that accepts only those words that begin or end with a double
letter.
35) Construct a finite automata for the regular expression
r = (a + b)* abb.
36) Prove the following identity :
( a * ab + ba)*a* = (a+ab+ba)*.
37) Prove that language which contains set of strings of balanced parentheses is not
regular.
38) Write a CFG which generates strings having equal number of a’s and b’s.
39) Design a CFG, which can generate string, having any combination of a’s and b’s
except null string.
40) Let G be a CFG in Chomsky Normal Form. Give an algorithm to determine the
number of distinct derivations of a string x.
41) Write out the steps using the pumping lemma for CFL's to prove that
L = { aibici | i >= 1 } is not a CFL.
42) How do we eliminate empty moves from any NDFA?
43) What are the various identities for the regular expressions?
44) Construct a regular expression defining each of the following language over the
alphabet ∑ = { a,b}
a. All strings that do not end in a double letter.
b. All strings in which letter b never triples.
c. All strings in which a is tripled or b is tripled.
d. All strings that have an even number of a’s and an odd number of b’s.
e. All strings that have an odd number of a’s and an odd number of b’s.
45) Build a Turing Machine that accepts the language of all words that contain the
substring bbb.
46) a) Write regular expression to denote the language L over Σ*, where Σ = {a,b,c}
in which every string will be such that any number of a’s is followed by any number
of b’s is followed by any number of c’s.
b) Write a regular expression to denote a language L over Σ*, where Σ = {a,b,c}
such that every string will have atleast one a followed by atleast one followed by
atleast one c.
47) Write a regular expression to denote a language L which accepts all the strinsg
which begin or end with either 00 or 11.
48) a) Write a regular expression to denote a language L over Σ*, where Σ = {a,b}
such that the third character from right end of the string is always a.
b) Construct a regular expression for the language L which accepts all the strings
with atleast two b’s over the Σ = {a,b}.
c) Construct regular expression for the language which consists of exactly two b’s
over the set Σ = {a,b}.
d) Write a regular expression which contains L having strings which should have
atleast one 0 and atleast one 1.
e) Construct a regular expression which denotes a language L over the set Σ = {0}
having even length of string.
49) Show that ( ab )* is not equal to (a*b*)
50) Show that (r+s)* is not equal to r* + s*
51) Prove that r(s+t) = rs + rt
52) Find whether
(a*ab + ba)*a* = (a+ab+ba)*
53) Construct a grammar for the language containing strings of at least two a’s.
54) Construct a grammar which consists of all the strings having atleast one
occurrence of 000.
55)Construct CFG for the language in which there are no consecutive b’s, the strings
may or may not have consecutive a’s.
56) Recognize the context free language for the given CFG
S  aB | bA
A  a | aS | bAA
B  b | bS | aBB
57) Design FA which accepts odd number of 1’s and any number of 0’s.
58) Design FA which checks whether the given unary number is divisible by 3.
59) Compare push down automata with finite automata.
60) Construct PDA over Σ = {0,1}.for the language consisting strings of twice as
many a’s as b’s.
61) Construct NFA for the regular expression b + ba*
62) Design a FA from given regular expression 10 + (0 + 11) 0*1.

Very Long Answer/Application Based Questions

1) Prove that how all the languages classified by the Chomsky are closed under
union, concatenation and transpose.
2) Let M be a push down automata accepting a language L by empty stack, then
prove that there is context free grammar G with L(G) = L
3) What is the significance of converting a grammar to GNF? Convert the following
grammar to GNF
S ASB | ε
A aAS | a
B  SbS | A | bb
4) a) Turing machines are simplified representation of a general computer.
Explain
b) Design a Turing Machine to accept the language L of palindromes over
{a,b}.
5) How can you say that Turing Machines are more capable than finite state
machines. Explain.
6) Consider the grammar:
S A , A  BA | ε , BaB | b.
Construct NFA and its equivalent DFA for LR(1) items of above grammar.
7) Write the machine description for a Turing machine, including delta transition
table for the specific machine that starts with a number n on the tape and finishes with
n squared on the tape. n on the input is just n zeros followed by blank tape.
(tape 000#b)
8) If L is a context free Language, then there exists a PDA M which accepts L. Prove.
9) Construct an NFA for the following regular expression:
10 + (0+11) 0 * 1.
10) L = { ww | w in Sigma star } is not a CFL. L is recognized by a Turing machine.
What essential feature does a Turing machine have that a NPDA did not have to be
able to recognize L ?
11) Prove that for any CFG G there is a CFG G1 in Chomsky Normal Form such that
L(Gl) = L(G) where L is the language accepted by the grammar.
12) Design a Turing Machines which generates a set of string with equal numbers of
0's and 1's.
13) Convert the following regular expression to NFA :
( i ) ( 0 + 1 )1 ( 0 + 1 )
(ii) 00 (0 + 1)
(iii) 01*
(iv) (0 + 1) 01
14) If L is a context free language, then there exists a PDA M which accepts L. Prove.
15) Construct an NFA for the following regular expression:
10 + (0+11) 0*1.
16) Given two regular expressions, how to prove that they are equal, or in other
words they match exactly the same language?
17) Prove that if L is regular then LT is also regular.
18) We can use Pumping Lemma to prove a language is not regular by contradiction.
Are there cases when we cannot find a string that cannot be pumped to prove a
language is not regular?
19) How do the three constraints of "special form GNFA" definition make sense in
the procedure converting DFA to regular expression?
20) The pumping lemma states that all regular languages have a special property. Is
there any nonregular language having this special property?
21) Discuss in brief Griebach Normal Form. Reduce the following grammar into
GNF :
S  A0 , A  0B , B  A0 , B  1.
22) Identify and remove the unit productions from following grammar
S A | bb,
A  B | b,
B  S | a.
23) Consider the following grammar G and remove the null productions :
SABAC , A aA | Λ , B bB | Λ , C  c.
24) Find the reduced grammar that is equivalent to the CFG given below:
SaC | SB , AbSCa , BaSB | bBC, CaBC | ad.
25) Construct the DFA for the regular expression (0+1)*1 (0+1).
26) Build a Turing Machine that accepts the language ODD PALINDROME.
27) Are the following true or false? Support your answer by giving proofs or counter-
examples.
a) If L1 U L2 is regular and L1 is regular, then L2 is regular.
b) If L1L2 is regular and L1 is regular, then L2 is regular.
c) If L* is regular, then L is regular.
28) a) Construct a regular grammar which can generate the set of all strings starting
with a letter ( A to Z) followed by a string of letters or digits ( 0 to 9).
b) Show that a deterministic finite automaton with n states accepting a nonempty
set accepts a string of length m, m < n.
29) What are the linear grammars? Explain its various types. Also prove the
following:
a) A right – linear or left-linear grammar is equivalent to a regular grammar.
b) A linear grammar is not necessarily equivalent to a regular grammar.
30) A context free grammar G is said to be self-embedding if there exists some useful
variable A such that A can derive uAv, where u,v belongs to terminal set and they are
not empty/ Show that a context-free language is regular iff it is generated by a
nonselfembedding grammar.
31) Show that a regular set accepted by a deterministic finite automaton with n states
is accepted to final state by a deterministic pda with n states and one pushdown
symbol. Deduce that every regular set is a deterministic context-free language.
32) Why are all regular languages context-free? How can we prove it?
33) What's the difference between the language recognized by deterministic and
nondeterministic ones? Can we make a pushdown automaton deterministic?
34) What do you want to minimize, the number of rules, the total length of right-hand
sides, the maximum length of right-hand side?
35) Are Context Free Languages closed under union, intersection, complement,
concatenation?
36) The state diagram of a TM seems to be tricky. Are there any tips how to draw the
diagram?
37) Let A,B,C be languages, and C = A concat B. If C and A are both regular,
whether B is regular? Or under which circumstance would the conclusion be true?
38) We can construct a CFG for a regular language by constructing a DFA for that
language. What kind of CFG can be constructed this way? Do these CFGs have some
attributes? Is there a clear way to know whether the language is regular by only the
context-free grammars?
39) If we already know some CFG is ambiguous, is there some algorithm to eliminate
the ambiguity?
40) If two DFAs M1 and M2 have been transformed to their minimal forms, how can
we easily check whether these two minimal DFAs are isomorphic?
41) Why do Turing recognizable/decidable languages not have a pumping lemma? Is
it because they have not enough structure information like CFL and regular language?
42) Which of the following grammars generates the string
$$
X  $ | X$$ | $$X
X $ | $$X | XX$
X  $ | $$$ | XX
X $ | $$X | X$X
X  $ | $X$ | $$X
43) For each language below, design a Deterministic Finite Automata, DFA.
a) Draw the state transition diagram.
b) Write the state transition table.
c) Write a regular expression.

Languages:
1) The set of strings over sigma={ 0, 1} ending in 11
2) The set of strings over sigma={ 0, 1} that contain three consecutive
ones.
3) The set of strings over sigma={ a, b, c} that contains the empty string and
strings that have a length that is a multiple of three with every block of three
containing one a, one b and one c.
44) Convert the NFA to an equivalent DFA
| 0 | 1 F = { q2, q4 }
----+----------+----------
q0 | {q0,q3} | {q0,q1}
q1 | phi | {q2}
q2 | {q2} | {q2}
q3 | {q4} | phi
q4 | {q4} | {q4}

M = (Q, sigma, delta, q0, F)


Q={?}
F={?}
q0 = ?
sigma = { ? }
delta = ? transition table ?
45) a) Design FA to check whether given decimal number is divisible by three.
b) Design FA which checks whether a given binary number is divisible
by three.
46) Construct the transition graph for a FA which accepts a language L over Σ
{0,1 } in which every string start with 0 and ends with 1.
47) Design a FA that reads strings made up of letters in the word CHARIOT and
recognize those strings that contain the word ‘CAT’ as a substring.
48) Design DFA for accepting the set of integers.
49) a) Construct a NFA in which double ‘1’ is followed by double ‘0’ over Σ =
{0,1}.
b) Design NFA which accepts the string containing either ‘01’ or ‘10’
over Σ = {0,1}.
50) Design push down automata which accepts only odd number of a’s over Σ =
{0,1}.
51) Design pda that checks the well formedness of parenthesis. Consider the
parenthesis is as (, ) , [ , ], { , }.
52) Construct pda for accepting the strings of even-length parenthesis.
53) Construct a Turing Machine M for Σ = {a,b} which will convert lower case
letters to upper case.
54) Construct a Turing Machine which accepts the language of aba over Σ =
{a,b}.
55) Design a Turing Machine which recognizes the input language having a
substring as 101 and replaces every occurrence of 101 by 110.
56) Construct Turing Machine for concatenation of the two strings of unary
numbers. This TM is for a concatenate function.
57) Construct Turing Machine for obtaining two’s complement of a given binary
number.
58) a) Construct Turing Machine for reversing a binary string on the input tape.
b) Construct Turing Machine for copying the input unary string on the tape.
59) Construct Turing Machine for performing logarithmic operation of given
binary number i.e, compute log(n) function.
60) Build a multitrack Turing Machine for checking whether given number is
prime or not?

You might also like