# Short Answer/Recall Type Questions

AI and Robotics

Dec 1, 2013 (4 years and 7 months ago)

3,661 views

SHAHEED UDHAM SINGH COLLEGE

OF ENGINEERING AND
TECHNOLOGY ,
TANGORI

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

QUESTION BANK

Subject Code: CS
-
404

Year/ Sem: 4
th

/ 7
th

Subject Name: FLAT

Prepared By:
-

Er. Sukhpreet Kaur

Short Answer/
Recall Typ
e Questions

1)

What is the differenc
e between Kleene’s closure and P
ositive closure of a set?

2)

What is a Finite Automaton?

3)

The

Regular Sets are closed under H
omomorphism. Explain.

4)

Explain
Homomorphism and Inverse H
omomorphism.

5)

What are Ambiguous Grammars?

6)

Is
Push Down Automata a Deterministic D
evice? Explain.

7)

What is the difference between Regular Grammar and Context F
ree
G
rammars?

8)

If F1 and F2 be two Finite A
utomata accepting languages L1 and L2
respectively, when can F1 and F2 be termed as equivalent?

9)
Can

the language {a
n
b
n
c
n

: n>=0 } be accepted by a Turing Machine.

10)
State any two properties of LR(k) grammars.

11) Wh
at do you mean by reduced grammars? Give example.

12)
Every non
-
empty CFL is generated by a CFG with no useless symbols. Justify
the state
ment.

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 L
anguage?

15)
State about Dyck Language.

16)
Define Regular Ex
pressions.

17)
What do you understand by Canonical Derivations?

18)
Differentiate between Context F
ree and
C
ontext
S
ensitive
G
rammars.

19)
The conversion from a grammar to Chomsky normal form can square the
number of productions in a grammar. Justify the s
tatement.

20)

Write the definition of a L
anguage and give an example.

21)

Give the difference between
T
ype 1 grammar
s and Type 2 grammars
.

22)

Write the One S
ided
C
ontext
S
ensitive
G
rammar.

23)

Give

the

mathematical

definition of Finite Automata.

24)

Write t
he Kuroda Normal Form.

25)

Explain in detail the properties
of LL(k) grammars.

26)

Give the transition table of a Turing M
achine.

27)

Write algebraic properties of U
niversality.

28)

For a given problem if a Turing machine halts, it signifies
that the
problem
cannot be enu
merated 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 r
egular 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 t
he 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 al
l 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) gr
ammars 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 a
tmost one pair of consecutive 1's.

44) What is I
dempotence
L
aw of
U
nion?

45)

What is meant by Y
ield of a
Parse T
ree ?

46)
Give formal notation for Push Down Automata.

47)

What are useless symbols

in context of grammars
?

48) What is 2
-

Push Down Automata?

4
9)
Construct a nondeterministic finite automaton accepting {ab,ba}, and use it to
find a deterministic automaton accepting the same set.

50) Consider a s
et L = {0, 1}. What is L* and L
+
?

51) What is the difference between NDFA and DFA?

52) Differentiate be
tween 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 = { 0
n
1
n

| n>=0} U { 1
n
0
n

| 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 = { a
n

b
2n

c
m

| 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
H
omomorphism and
I
somorphism.

63)

Write the regular expression over alphabet (a,b,c) con
taining 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)

Dif
ferentiate between Derivation Trees and D
erivation
G
raphs.

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 exp
ression 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 langu
age 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 l
anguage 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 bin
ary 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)

Sh
ow 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 fo
llowing Push D
own 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? Co
nsider 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 )

Prod
uctions

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 Lemma
s in complexity theory.

14)
Prove that {0"/n i
s 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

0
A/ ε

B

o
B/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 C
omplexity in cellular automata.

18) Give
the D
eterministic
F
inite
A
utomata accepting the set of all strings of 0’s and
1’s in which both the n
umber of 0’s and 1’s are even.

19) Let L be the set of all strings given by 0
i
1
i

where i is an integer greater than 1 i.e.

L = { 0
i
1
i

| 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 {wcw
R

: 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 accep
ted 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={ wcw
T

| 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 ={a
n
b
n
c
n

| 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 pro
ductions 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.

i
i) 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 = { a
i
b
i
c
i

| 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 ea
ch 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 tr
iples.

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 expressi
on 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 langua
ge 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 conse
cutive 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 divisib
le 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 express
ion 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 st
ack, then
prove that there is conte
xt free grammar G with L(G) = L

3) What is the significance of converting a grammar to GNF?

Conver
t 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
t
able 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. Pro
ve.

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

Chom
sky 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 ex
pression:

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 i
f L is regular then L
T

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 lan
guage 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 state
s 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 n
ot 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 th
at 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) T
he 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 c
an 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 gramm
ars?

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 | X X \$

X

\$ | \$ \$ \$ | X X

X

\$ | \$ \$ X | X \$ X

X

\$ | \$ X \$ | \$ \$ X

43)
For each language below, design a Deterministic Finite Automata, DFA.

a) Draw the state trans
ition 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 str
ings over sigma={ a, b, c} that contains the empty string

and
strings that have a length that is a multiple of three

w
ith 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 t
hat 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)

Des
ign 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)

C
onstruct 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 1
01 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) Cons
truct 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) funct
ion.

60)

Build a multitrack Turing Machine for checking whether given number is
prime or not?