CS402 FULL Material 2011

271
MIDTERM EXAMINATION Spring 2009 CS402- Theory of Automata (Session - 1) Question No: 1 ( Marks: 1 ) - Please choose one Alphabet S = {a,bc,cc} has number of letters. One Two Three Four Question No: 2 ( Marks: 1 ) - Please choose one In which of the following language Rev(s)=s EQUAL INTEGER PALINDROME FACTORIAL Question No: 3 ( Marks: 1 ) - Please choose one If S = {ab, bb}, then S* will not contain abbbab bbba bbbbab ababbb Question No: 4 ( Marks: 1 ) - Please choose one a,b 1 2 + a,b

Transcript of CS402 FULL Material 2011

Page 1: CS402 FULL Material 2011

MIDTERM EXAMINATION Spring 2009

CS402- Theory of Automata (Session - 1)

Question No: 1 ( Marks: 1 ) - Please choose one

Alphabet S = {a,bc,cc} has number of letters.

One

Two

Three

Four

Question No: 2 ( Marks: 1 ) - Please choose one

In which of the following language Rev(s)=s

EQUAL

INTEGER

PALINDROME

FACTORIAL

Question No: 3 ( Marks: 1 ) - Please choose one

If S = {ab, bb}, then S* will not contain

abbbab

bbba

bbbbab

ababbb

Question No: 4 ( Marks: 1 ) - Please choose one

a,b

1 – 2 +

a,b

Page 2: CS402 FULL Material 2011

Above given FA generates the language having strings of

ODD length

EVEN length

Equal number of a’s and b’s

None of these

Question No: 5 ( Marks: 1 ) - Please choose one

a+b a+b

- aa+bb +

Above given GTG accepts the language in which strings

Contains double a or double b

Contains both a and double b

Depends on the alphabet

None of these

Question No: 6 ( Marks: 1 ) - Please choose one

aa+bb

3- 1

ab+b

a

ab+ba

aa+bb 2

Page 3: CS402 FULL Material 2011

4+ If above given TG is drawn like

aa+bb

3 1 X

4

Then what will be written in place of X.

(ab+ba)(aa+bb)(ba+ab)

(ab+ba)(aa+bb)(ab+ba)

(ab+ba)(aa+bb)*(ab+ba)

(ab+ba)(aa+bb)(ab+ba)*

Question No: 7 ( Marks: 1 ) - Please choose one

FA3 expresses r1r2. Then initial state of FA3 will consist of

Initial state of FA2

Initial state of FA1

Initial states

of both FA1 & FA2

Depends on FA’s

Question No: 8 ( Marks: 1 ) - Please choose one

FA3 expresses r1r2. Then there will be at least one final state of FA3 that consist of final state of FA1 and initial state of FA2.

True

False

Depends on language

None of these

Question No: 9 ( Marks: 1 ) - Please choose one

Two machines are said to be equivalent if they print the same output string when the different input string is run on them

True

False

Depends on language

May be or may not be

Page 4: CS402 FULL Material 2011

Above given FA accepts strings defined over S={a , b}

All

Some

All but not null

None of these Question No: 1 ( Marks: 1 ) - Please choose one Length of null string is Always not equal to 0 Always equal to 0 It has variable length All are true Question No: 2 ( Marks: 1 ) - Please choose one If an alphabet has n number of letter, then number of strings of length m will be n+m (n)(m) mn

nm

Question No: 3 ( Marks: 1 ) - Please choose one Languages generated by kleene star are always ______________. Finite Infinite Sometimes finite & sometimes infinite None of the these Question No: 4 ( Marks: 1 ) - Please choose one “Every finite language can be expressed by FA”. This statement is __________. True False Depends on language None of these Question No: 5 ( Marks: 1 ) - Please choose one In FA, if one enters in a specific state but there is no way to leave it, then that specific state is called Dead States Waste Baskets Davey John Lockers All of these Question No: 6 ( Marks: 1 ) - Please choose one In TG there may exist no paths for certain string. True False Depends on the language None of these Question No: 7 ( Marks: 1 ) - Please choose one In GTG’s there may exist no path for a certain string.

Page 5: CS402 FULL Material 2011

True False Depends on alphabet None of these Question No: 8 ( Marks: 1 ) - Please choose one In drawing FA3 (which is equal to FA1 + FA2), a state will be declared final if States of both FA’s are final At least one state is final Depends on language None of the given Question No: 9 ( Marks: 1 ) - Please choose one a ^ 1- 4+ b 5 a a a ^, b a 2 3 Above given structure is an ________. FA NFA NFA -^ TG Question No: 10 ( Marks: 1 ) - Please choose one b 1- 5+ a 4+ b a a,b a, b 2 3 Above given TG represents the language____ Begins and ends with same letters Begins and ends with different letters Begins with a None of these Question No: 11 ( Marks: 1 ) - Please choose one In TG, there may be a transition for null string. True False Can’t show transition for string None of these Question No: 12 ( Marks: 1 ) - Please choose one The _______ machine helps in building a machine that can perform the addition of binary numbers. Incrementing Complementing Decrementing None of the given

Memoona
Highlight
Page 6: CS402 FULL Material 2011

Question No: 13 ( Marks: 1 ) - Please choose one GTG can have _____________ initial state. Zero One More than One One OR more than One Question No: 14 ( Marks: 1 ) - Please choose one One FA has n states and m letters in the alphabet. Then FA will have _____ number of transitions in the diagram. (n)+(m) (m)(n) OR (n)(m) None of the given options (m)-(n) Question No: 15 ( Marks: 1 ) - Please choose one If L1 and L2 are expressed by regular expressions r1 and r2, respectively then the language expressed by r1 + r2 will be _________ Regular Ir-regular Can’t be decided Another Language which is not listed here Question No: 16 ( Marks: 1 ) - Please choose one Which statement is true? All words are strings All strings are words Both are always same None of these

Question No: 6 ( Marks: 1 ) - Please choose one

According to 3rd part of the Kleene’s theorem, If a language can be accepted by an RE then it can be accepted by a as well

TG

FA

TG and FA

None of these

Question No: 7 ( Marks: 1 ) - Please choose one

r1 r2

…. 5 ….

… rn

.

r1+r2 + …

…. 5 ….

+rn

Memoona
Highlight
Page 7: CS402 FULL Material 2011

Above given GTG’s are

Equivalent

Non-equivalent

Non-valid

None of the given

Question No: 8 ( Marks: 1 ) - Please choose one

If FA1 accepts no string and FA2 acceptsmany strings, then FA1 + FA2 will be equal to

FA1

FA2

May be both

None of the given

Question No: 9 ( Marks: 1 ) - Please choose one

a b b

- + a

a, b

- b +

Page 8: CS402 FULL Material 2011

Above given NFA and FA generate same language.

True

False

FA & NFA can’t be equivalent

None of these

Question No: 10 ( Marks: 1 ) - Please choose one

- a +

Above given structure is a

FA

TG

NFA

FA and NFA

Question No: 11 ( Marks: 1 ) - Please choose one

2 a 4

a,b a a

a,b

1– 6+

b b

3 b 5

a,b -

aaa,bbb

a,b +

Page 9: CS402 FULL Material 2011

Above given TG’s are .

Equivalent

Non-equivalent

TG’s are not valid

None of these

Question No: 12 ( Marks: 1 ) - Please choose one

–– a +

––

Above given TG has the RE.

(a + b)*a

+ (a + b)*a

None of these

+ (a + b)*a*

Question No: 13 ( Marks: 1 ) - Please choose one

a

a –– +

a b b

b

Above given FA has RE.

(a + b)*a

Memoona
Highlight
Page 10: CS402 FULL Material 2011

a(a + b)*

((a + b)*a)*

(a + b)*a & ((a + b)*a)*

Question No: 14 ( Marks: 1 ) - Please choose one

–– b

a,b

+

Page 11: CS402 FULL Material 2011

Above given TG accepts the string.

bb

baba

bbba

all of the given options

Question No: 17 ( Marks: 1 )

What is the difference between Regular Languages and Non Regular Languages?

Question No: 18 ( Marks: 1 )

What is meant by tokenizing a string?

Question No: 19 ( Marks: 2 )

Define the language for the following NFA also write the regular expression for the language?

a,b

1- a

2 a 3+

a,b

Page 12: CS402 FULL Material 2011

Question No: 20 ( Marks: 3 )

Describe the method of NFA corresponding to Concatenation of FAs.

Question No: 21 ( Marks: 5 )

(i) When asked to give a recursive definition for the language PALINDROM over the alphabet S = {a, b}, a student wrote: Rule 1 a and b are in PALINDROM. Rule 2 If x is in PALINDROM, then so are axa and bxb Unfortunately all the words in the language defined above have an odd length and so it is not all of PALINDROM. Fix this problem. (ii) Give a recursive definition for the language EVENPALINDROM of all palindromes of even length

Question No: 22 ( Marks: 10 )

What do you mean by “bypass and state elimination” Also reduce the following TG by eliminating state 3. (Draw reduced TG)

MIDTERM EXAMINATION Spring 2009

CS402- Theory of Automata (Session - 3)

Question No: 1 ( Marks: 1 ) - Please choose one

If r1 and r2 are regular expressions then which of the following is not regular expression.

r1 = r2

Page 13: CS402 FULL Material 2011

r1r2

r1*

r1 – r2

Question No: 2 ( Marks: 1 ) - Please choose one

Which of the following is not a word of language EQUAL?

aaabbb

abbbabaa

abababa

bbbaaa

Question No: 3 ( Marks: 1 ) - Please choose one

If S = {aa, bb}, then S* will not contain..

aabbaa

bbaabbbb

aaabbb

aabbbb

Question No: 4 ( Marks: 1 ) - Please choose one

One language can be represented by more than one RE” this statement is

False

True

Can’t be assumed

None of these

Question No: 5 ( Marks: 1 ) - Please choose one

Page 14: CS402 FULL Material 2011

“Every Infinite language is regular” this statement is

True

False

Can’t be supposed

None of these

Question No: 6 ( Marks: 1 ) - Please choose one

PALINDROME can be defined by more than one regular language

True

False

By only one RE

Some times By only one RE and Some times False

Question No: 7 ( Marks: 1 ) - Please choose one

a,b 1

a,b 2+

Page 15: CS402 FULL Material 2011

Above given FA can be expressed as

a* + b*

(ab + ba)*

None of these

Above given TG has RE.

(aa+bb+(ab+ba)(aa+bb)(ab+ba))*

(aa+bb+(ab+ba)(aa+bb)*(ab+ba))*

(aa+ba+(bb+ba)(ab+bb)(ab+aa))*

(ab+ba+(ab+ba)(aa+bb)(ab+ba))*

Question No: 17 ( Marks: 1 )

How can we say that two REs are equal?

Question No: 18 ( Marks: 1 )

What is meant by Kleene star closure of a language?

Question No: 19 ( Marks: 2 )

What the Pumping lemma II says about length(x) + length(y) must be:

Question No: 20 ( Marks: 3 )

Page 16: CS402 FULL Material 2011

Consider the language S*, where S = {ab, ba}, Can any word in this language contain the substrings aaa or bbb? Why or why not?

Question No: 21 ( Marks: 5 )

Give the transition table of an FA3 corresponding to FA1+FA2, where FA1, FA2 are given below. FA1

FA2

Question No: 22 ( Marks: 10 )

What is meant by nondeterminism? Draw the TG for the following RE

(aa)*b(b*+( (aa)+b)*) bb.

CS402- Theory of Automata

(Session - 3)

Question No: 1 ( Marks: 1 ) - Please choose one

S = {baa, ab}, then S* will not contain

abbaab

abab

baabaa

abbaa

Page 17: CS402 FULL Material 2011

Question No: 2 ( Marks: 1 ) - Please choose one

1*(1 + ) = 1* this statement is

True

False

Sometimes true & sometimes false

None of these

Question No: 3 ( Marks: 1 ) - Please choose one

One language can be represented by more than one RE” this statement is

False

True

Can’t be assumed

None of these

Question No: 4 ( Marks: 1 ) - Please choose one

a(a+b)*a+b(a+b)*b is RE for the language defined over S={a,b} having words beginning

and ending with same letters

True

False

Such a language is not regular

None of these

Question No: 5 ( Marks: 1 ) - Please choose one

b a a

– +

Page 18: CS402 FULL Material 2011

b

Above given FA can be expressed by

(a + b)*a

(a + b)*b

a (a + b)*

b (a + b)*

Question No: 6 ( Marks: 1 ) - Please choose one

If a language has RE, then that language can be expressed through TG.

True

False

Depends on language

None of these

Question No: 7 ( Marks: 1 ) - Please choose one

In TG there may exist no paths for certain string.

True

False

Depends on the language

None of these

Question No: 9 ( Marks: 1 ) - Please choose one

FA1 corresponds to r*, then FA1 must accept string.

Every

Null

Page 19: CS402 FULL Material 2011

Odd length

Even length

Question No: 10 ( Marks: 1 ) - Please choose one

In NFA, there may be more than one transition for certain letters and there may not be any transition for certain letters. This statement is .

False

True

Depends on language

None of the given

Question No: 11 ( Marks: 1 ) - Please choose one a,b

b – +

Above given TG accepts the language in which all strings

Ends in b

Begins with b

Ends and begins with b

None of the given

Page 20: CS402 FULL Material 2011

Question No: 1 ( Marks: 1 ) - Please choose one

Σ={a,Aa,Abb}, then string aAaAbbAa has ________ length. ► One ► Two ► Three ► Four Question No: 2 ( Marks: 1 ) - Please choose one

Languages generated by kleene star are always ______________. ► Finite ► Infinite ► Sometimes finite & sometimes infinite ► None of the these Question No: 3 ( Marks: 1 ) - Please choose one

Let S = {aa, bb} be a set of strings then s* will have ► Λ ► abba ► aabbbaa ► bbaab Question No: 4 ( Marks: 1 ) - Please choose one

If r1 = (aa + bb) and r2 = ( a + b) then the language (aa + bb)* will be generated by ► (r1)(r2) ► (r1 + r2) ► (r2)* ► (r1)* Question No: 5 ( Marks: 1 ) - Please choose one

y a, b

x ±

a, b

Above given FA can be represented by ► ((a+ b) (a + b))* ► (a + b)(a + b)* ► (a + b)(a + b) ► (a + b)*(a + b)* Question No: 6 ( Marks: 1 ) - Please choose one

a,b

2+

1±a,b

Page 21: CS402 FULL Material 2011

Above given FA accepts ___________ strings defined over Σ={a , b} ► All ► Some ► All but not null ► None of these Question No: 7 ( Marks: 1 ) - Please choose one

If a language can be expressed through FA, then it can also be expressed through TG. ► True ► False ► Depends on language ► None of the above Question No: 8 ( Marks: 1 ) - Please choose one

b

b

3+ a

1-

a

aa

a

4+ b

2-

.b

b

ab

5 6

Above given TG has ____________________ RE. ► a+b+a(a + b)*a + b(a + b)*b ► a(a + b)*a + b(a + b)*b ► both are given ► none of the given Question No: 9 ( Marks: 1 ) - Please choose one

b

b

3+ a

1-

a

aa

a

4+ b

2-

.b

b

ab

5 6

Above given FA accepts the language in which strings ► Begins with and ends in same letter ► Begins with and ends in different letter ► Has length more than 2 ► None of the given Question No: 10 ( Marks: 1 ) - Please choose one

GTG can have _______________ final state. ► 0 ► 1 ► More than 1

Page 22: CS402 FULL Material 2011

► All of the given Question No: 11 ( Marks: 1 ) - Please choose one

In GTG, if a state has more than one incoming transitions from a state. Then all those incoming transitions can be reduced to one transition using _____________ sign ► - ► + ► * ► None of the given Question No: 12 ( Marks: 1 ) - Please choose one

aa+bb ab+ba

ab+ba

aa+bb

Λ

4+

3- 21

Λ

If above given TG is drawn like

aa+bb

Λ

4

3 1

Λ

X

Then what will be written in place of X. ► (ab+ba)(aa+bb)(ba+ab) ► (ab+ba)(aa+bb)(ab+ba) ► (ab+ba)(aa+bb)*(ab+ba) ► (ab+ba)(aa+bb)(ab+ba)* Question No: 13 ( Marks: 1 ) - Please choose one

“One language can be expressed by more than one NFA”. This statement is ______________. ► False ► True ► Depends on NFA ► None of the given Question No: 14 ( Marks: 1 ) - Please choose one

Page 23: CS402 FULL Material 2011

a

^

1-

4+

b 5

a a a

^, b a

2

3

Above given structure is an ________. ► FA ► NFA ► NFA -^ ► TG Question No: 15 ( Marks: 1 ) - Please choose one

One FA has 3 states and 2 letters in the alphabet. Then FA will have ___________ number of transitions in the diagram ► 4 ► 5 ► 7 ► 6 Question No: 16 ( Marks: 1 ) - Please choose one

aa

b

bb

a

1-

2-

3+

4+

b

a

Above given two TG’s are _______________. ► Equivalent ► None-equivalent ► Not valid ► None of the given Question No: 17 ( Marks: 1 )

What do you mean by dead state? Question No: 18 ( Marks: 1 )

Define empty or null strings? Question No: 19 ( Marks: 2 )

Page 24: CS402 FULL Material 2011

Write strings that ends on "a" and strings containing exactly one "a". over Σ= {a, b} Question No: 20 ( Marks: 3 )

Let S be all string of a’s and b’s with odd length. What is S*? Question No: 21 ( Marks: 5 )

Give the transition table of an FA3 corresponding to FA1+FA2, where FA1, FA2 are given below. FA1

FA2

Question No: 22 ( Marks: 10 )

Give the regular expression and draw the GTG for the following language. Language L of strings, defined over Σ = {a, b}, beginning with and ending in same letters. In which of the following language Rev(s)=s

1. Equal 2. Integer 3. Palindrome 4. Factorial

Q1 A DFA with n states must accept at least one string of length greater than n. Choices:

1. True 2. False

Page 25: CS402 FULL Material 2011

Q2 FA corresponding to an NFA can be built by introducing a state corresponding to the combination of states, for a letter having Choices:

1. no transition at certain state 2. one transition at certain state 3. more than one transitions at certain state 4. none of the given options

Q3 Which of the following statement is NOT true? Choices:

1. FA can be considered to be an NFA 2. FA can be considered to be an NFA with null string 3. NFA can be considered to be an TG 4. TG can be considered to be an NFA

Q4 For every three regular expressions R, S, and T, the languages denoted by R(S U T) and (RS) U (RT) are the same. Choices:

1. True 2. False

Q5 Does the empty string match the regular expression |y+a|? Choices:

1. Yes 2. No

Q6 If an FA already accepts the language expressed by the closure of certain RE, then the given FA is the required FA. Choices:

1. True 2. False

Q7 Which of the following statement is true about NFA with Null String? Choices:

1. Infinite states 2. Infinite set of letters 3. Infinite set of transitions 4. Transition of null string is allowed at any stage

Q8 If R is a regular language and L is some language, and L U R is a regular language, then L must be a regular language. Choices:

1. True 2. False

Page 26: CS402 FULL Material 2011

Q9 FA corresponding to an NFA can be built by introducing an empty state for a letter having Choices:

1. no transition at certain state 2. one transition at certain state 3. two transition at certain state 4. more than two transitions at certain state

Q10 Let FA3 be an FA corresponding to FA1FA2, then the initial state of FA3 must correspond to the initial state of Choices:

1. FA1 only 2. FA2 only 3. FA1 or FA2 4. FA1 and FA2

If an FA accept a word then there must exist a path from

1. Initial to final state. 2. Initial to each state 3. Initial to each state but not to final state. 4. Initial to final state by traversing each state

If an FA has N state then it must accept the word of length

1. n-1 2. state 3. transition 4. input tape

The part of an FA, where the input string is placed before it is run, is called _______

1. state 2. transition 3. input tape 4. output tape

The complement of a regular language is also a regular

1. True 2. False

A PDA is not in conversion form if ___________

1. There are more than one ACCEPT states 2. There are more than one REJECT states 3. Every READ or HERE is followed immediately by a put

Page 27: CS402 FULL Material 2011

4. All of the given options In conversion form of PDA there is no……… state

1. Push 2. Read

Consider the following production (of a CFG): S->XYZ Here ______ is left most non-terminal in working string. Note: S, X, Y and Z are all non-terminals

1. S 2. X 3. Y 4. Z

Which of the following states is not part of PDA

1. Start 2. Accept 3. Write 4. reject

The tree which produced all the strings of a language is called

1. Derivation tree 2. Ambiguous tree 3. Total language tree 4. Non-Ambiguous tree

Question # 1 of 10 ( Start time: 05:46:41 PM ) Total Marks: 1 While finding RE corresponding to TG, If TG has more than one start state then Select correct option: Introduce the new start state Eliminate the old start state Replace the old start state with final state Replace the old final state with new start state Question # 2

1. While finding RE corresponding to TG, we connect the new start state to the old start state by the transition labeled by Select correct option:

Page 28: CS402 FULL Material 2011

a b null string None of the given options

Question # 3 of 10 ( Start time: 05:49:03 PM ) Total Marks: 1 Which of the following regular expression represents same language? a. (a+ab)* b. (ba+a)* c. a*(aa*b)* d. (a*b*)* a+b)*a(a+b)*b(a+b)*+ (a+b)*b(a+b)*a(a+b)*. { x}*, { x}+, {a+b}* Select correct option: a and b a and c c and d Question # 4 of 10 ( Start time: 05:50:32 PM ) Total Marks: 1 (a* + b*)* = (a + b)* this expression is __________ Select correct option: True False Question # 5 of 10 ( Start time: 05:51:30 PM ) Total Marks: 1 Let FA3 be an FA corresponding to FA1+FA2, then the initial state of FA3 must correspond to the initial state of Select correct option: FA1 only FA2 only FA1 or FA2 FA1 and FA2 Question # 6 of 10 ( Start time: 05:53:01 PM ) Total Marks: 1 Which of the following statement is NOT true about TG? Select correct option: There exists exactly one path for certain string There may exist more than one paths for certain string There may exist no path for certain string There may be no final state Question # 7 of 10 ( Start time: 05:54:06 PM ) Total Marks: 1 Kleene’s theorem states Select correct option: All representations of a regular language are equivalent. All representations of a context free language are equivalent. All representations of a recursive language are equivalent Finite Automata are less powerful than Pushdown Automata. Question # 8 of 10 (Start time: 05:55:36 PM) Total Marks: 1 What do automata mean? Select correct option: Something done manually Something done automatically

Page 29: CS402 FULL Material 2011

Question # 9 of 10 ( Start time: 05:56:51 PM ) Total Marks: 1 A language accepted by an FA is also accepted by Select correct option: TG only GTG only RE only All of the given Question # 10 of 10 ( Start time: 05:58:16 PM ) Total Marks: 1 If r1 = (aa + bb) and r2 = (a + b) then the language (aa + bb)(a + b) will be generated by Select correct option: (r1)(r2) (r1 + r2) (r2)(r1) (r1)* Question No: 1 ( Marks: 1 ) - Please choose one

Σ={a,Aa,Abb}, then string aAaAbbAa has ________ length. ► One ► Two ► Three ► Four Question No: 2 ( Marks: 1 ) - Please choose one

Languages generated by kleene star are always ______________. ► Finite ► Infinite ► Sometimes finite & sometimes infinite ► None of the these Question No: 3 ( Marks: 1 ) - Please choose one

Let S = {aa, bb} be a set of strings then s* will have ► Λ ► abba ► aabbbaa ► bbaab Question No: 4 ( Marks: 1 ) - Please choose one

If r1 = (aa + bb) and r2 = ( a + b) then the language (aa + bb)* will be generated by ► (r1)(r2) ► (r1 + r2) ► (r2)* ► (r1)* Question No: 5 ( Marks: 1 ) - Please choose one

Page 30: CS402 FULL Material 2011

y a, b

x ±

a, b

Above given FA can be represented by ► ((a+ b) (a + b))* ► (a + b)(a + b)* ► (a + b)(a + b) ► (a + b)*(a + b)* Question No: 6 ( Marks: 1 ) - Please choose one

a,b

2+

1±a,b

Above given FA accepts ___________ strings defined over Σ={a , b} ► All ► Some ► All but not null ► None of these Question No: 7 ( Marks: 1 ) - Please choose one

If a language can be expressed through FA, then it can also be expressed through TG. ► True ► False ► Depends on language ► None of the above Question No: 8 ( Marks: 1 ) - Please choose one

b

b

3+ a

1-

a

aa

a

4+ b

2-

.b

b

ab

5 6

Above given TG has ____________________ RE. ► a+b+a(a + b)*a + b(a + b)*b ► a(a + b)*a + b(a + b)*b ► both are given ► none of the given Question No: 9 ( Marks: 1 ) - Please choose one

Page 31: CS402 FULL Material 2011

b

b

3+ a

1-

a

aa

a

4+ b

2-

.b

b

ab

5 6

Above given FA accepts the language in which strings ► Begins with and ends in same letter ► Begins with and ends in different letter ► Has length more than 2 ► None of the given Question No: 10 ( Marks: 1 ) - Please choose one

GTG can have _______________ final state. ► 0 ► 1 ► More than 1 ► All of the given Question No: 11 ( Marks: 1 ) - Please choose one

In GTG, if a state has more than one incoming transitions from a state. Then all those incoming transitions can be reduced to one transition using _____________ sign ► - ► + ► * ► None of the given Question No: 12 ( Marks: 1 ) - Please choose one

aa+bb ab+ba

ab+ba

aa+bb

Λ

4+

3- 21

Λ

If above given TG is drawn like

Page 32: CS402 FULL Material 2011

aa+bb

Λ

4

3 1

Λ

X

Then what will be written in place of X. ► (ab+ba)(aa+bb)(ba+ab) ► (ab+ba)(aa+bb)(ab+ba) ► (ab+ba)(aa+bb)*(ab+ba) ► (ab+ba)(aa+bb)(ab+ba)* Question No: 13 ( Marks: 1 ) - Please choose one

“One language can be expressed by more than one NFA”. This statement is ______________. ► False ► True ► Depends on NFA ► None of the given Question No: 14 ( Marks: 1 ) - Please choose one

a

^

1-

4+

b 5

a a a

^, b a

2

3

Above given structure is an ________. ► FA ► NFA ► NFA -^ ► TG Question No: 15 ( Marks: 1 ) - Please choose one

One FA has 3 states and 2 letters in the alphabet. Then FA will have ___________ number of transitions in the diagram ► 4 ► 5 ► 7 ► 6 Question No: 16 ( Marks: 1 ) - Please choose one

Page 33: CS402 FULL Material 2011

aa

b

bb

a

1-

2-

3+

4+

b

a

Above given two TG’s are _______________. ► Equivalent ► None-equivalent ► Not valid ► None of the given Question No: 17 ( Marks: 1 )

What do you mean by dead state? Question No: 18 ( Marks: 1 )

Define empty or null strings? Question No: 19 ( Marks: 2 )

Write strings that ends on "a" and strings containing exactly one "a". over Σ= {a, b} Question No: 20 ( Marks: 3 )

Let S be all string of a’s and b’s with odd length. What is S*? Question No: 21 ( Marks: 5 )

Give the transition table of an FA3 corresponding to FA1+FA2, where FA1, FA2 are given below. FA1

FA2

Page 34: CS402 FULL Material 2011

Q1 A DFA with n states must accept at least one string of length greater than n. Choices: True False Q2 FA corresponding to an NFA can be built by introducing a state corresponding to the combination of states, for a letter having Choices: no transition at certain state one transition at certain state more than one transitions at certain state none of the given options Q3 Which of the following statement is NOT true? Choices:

1. FA can be considered to be an NFA 2. FA can be considered to be an NFA with null string 3. NFA can be considered to be an TG 4. TG can be considered to be an NFA

Q4 For every three regular expressions R, S, and T, the languages denoted by R(S U T) and (RS) U (RT) are the same. Choices:

1. True 2. False

Q5 Does the empty string match the regular expression |y+a|? Choices:

1. Yes 2. No

Q6 If an FA already accepts the language expressed by the closure of certain RE, then the given FA is the required FA. Choices:

1. True 2. False

Q7 Which of the following statement is true about NFA with Null String? Choices:

1. Infinite states 2. Infinite set of letters

Page 35: CS402 FULL Material 2011

3. Infinite set of transitions 4. Transition of null string is allowed at any stage

Q8 If R is a regular language and L is some language, and L U R is a regular language, then L must be a regular language. Choices:

1. True 2. False

Q9 FA corresponding to an NFA can be built by introducing an empty state for a letter having Choices:

1. no transition at certain state 2. one transition at certain state 3. two transition at certain state 4. more than two transitions at certain state

Q10 Let FA3 be an FA corresponding to FA1FA2, then the initial state of FA3 must correspond to the initial state of Choices:

1. FA1 only 2. FA2 only 3. FA1 or FA2 4. FA1 and FA2

FAs is an FA that accepts all the string of FA1 andFA2. Union of two True False A production of the form non-terminal string of two non-terminal is called a live Production. True False DFA and PDA are equal in power. True False 4: Syntax tree or Generation tree or Derivation tree are same tree true false 5; PDA is only used to represent a regular language. True False 6: PDA is stronger than FA. True

Page 36: CS402 FULL Material 2011

False 7: Two FAs are equivalent if they have same no. of states. ture false 8: There exist exactly two different derivations in an ambiguous CFG for a word. true false Length of EVEN-EVEN language is _________

1. even 2. odd 3. sometimes even n sometimes odd 4. no such language

If r1 = (aa + bb) and r2 = (a + b) then the language (aa + bb)(a + b) will be generated by

1. (r1)(r2) 2. (r1 + r2) 3. (r2)(r1) 4. (r1)*

What is false about the term alphabet?

1. It is a finite set of symbols. 2. It is usually denoted by Greek letter sigma 3. It can be an empty set. 4. Strings are made up of its elements.

If S = {ab, bb}, then S* will not contain

1. abbbab 2. bbba 3. bbbbab 4. ababbb

If S = { x }, then S* will be

Page 37: CS402 FULL Material 2011

1. {x,xx,xxx,xxxx,…} 2. {^ ,x,xx,xxx,xxxx,…}

Let FA3 be an FA corresponding to FA1+FA2, then the final state of FA3 must correspond to the final state of

1. FA1 only 2. FA2 only (not confirmed) 3. both 4. FA1 or FA2

a* + b* = (a + b)* this expression is _________

1. true 2. false

Alphabet S = {a, bc, cc} has _______ number of letters

1. one 2. two 3. three 4. four

Which of the following statement is NOT true about TG?

1. There exists exactly one path for certain string 2. There may exist more than one paths for certain string 3. There may exist no path for certain string 4. There may be no final state

What do automata mean?

1. Something done manually 2. Something done automatically

The states in which there is no way to leave after entry are called

1. Davey John Lockers 2. Dead States 3. Waste Baskets 4. All of the given options

Page 38: CS402 FULL Material 2011

Which of the following regular expression represents same language? a. (a+ab)* b. (ba+a)* c. a*(aa*b)* d. (a*b*)*

1. a and b 2. a and c 3. c and d 4. All of the given options 5. nahi pata

If two RE’s generate same language then these RE’s are called

1. Same RE 2. Equal RE 3. Similar RE 4. Equivalent RE

Given S, Kleene star closure is denoted by

1. S* 2. S+ 3. S- 4. None of these

To obtain an RE corresponding to the given TG , TG is converted into

1. FA 2. GTG 3. NFA 4. none of given

Question # 1 of 10 ( Start time: 05:46:41 PM ) Total Marks: 1 While finding RE corresponding to TG, If TG has more than one start state then Select correct option:

1. Introduce the new start state 2. Eliminate the old start state 3. Replace the old start state with final state

Page 39: CS402 FULL Material 2011

4. Replace the old final state with new start state Question # 2 While finding RE corresponding to TG, we connect the new start state to the old start state by the transition labeled by Select correct option: a b null string None of the given options Question # 3 of 10 ( Start time: 05:49:03 PM ) Total Marks: 1 Which of the following regular expression represents same language? a. (a+ab)* b. (ba+a)* c. a*(aa*b)* d. (a*b*)* Select correct option: a and b a and c c and d Question # 4 of 10 ( Start time: 05:50:32 PM ) Total Marks: 1 (a* + b*)* = (a + b)* this expression is __________ Select correct option: True False Question # 5 of 10 ( Start time: 05:51:30 PM ) Total Marks: 1 Let FA3 be an FA corresponding to FA1+FA2, then the initial state of FA3 must correspond to the initial state of Select correct option:

1. FA1 only 2. FA2 only 3. FA1 or FA2 4. FA1 and FA2

Question # 6 of 10 ( Start time: 05:53:01 PM ) Total Marks: 1 Which of the following statement is NOT true about TG? Select correct option:

1. There exists exactly one path for certain string 2. There may exist more than one paths for certain string 3. There may exist no path for certain string 4. There may be no final state

Question # 7 of 10 ( Start time: 05:54:06 PM ) Total Marks: 1 Kleene’s theorem states Select correct option: All representations of a regular language are equivalent. All representations of a context free language are equivalent. All representations of a recursive language are equivalent Finite Automata are less powerful than Pushdown Automata. Question # 8 of 10 ( Start time: 05:55:36 PM ) Total Marks: 1 What do automata mean? Select correct option:

1. Something done manually

Page 40: CS402 FULL Material 2011

2. Something done automatically Question # 9 of 10 ( Start time: 05:56:51 PM ) Total Marks: 1 A language accepted by an FA is also accepted by Select correct option: TG only GTG only RE only All of the given Question No: 1 ( Marks: 1 ) - Please choose one

Σ={a,Aa,Abb}, then string aAaAbbAa has ________ length. ► One ► Two ► Three ► Four Question No: 2 ( Marks: 1 ) - Please choose one

Languages generated by kleene star are always ______________. ► Finite ► Infinite ► Sometimes finite & sometimes infinite ► None of the these Question No: 3 ( Marks: 1 ) - Please choose one

Let S = {aa, bb} be a set of strings then s* will have ► Λ ► abba ► aabbbaa ► bbaab Question No: 4 ( Marks: 1 ) - Please choose one

If r1 = (aa + bb) and r2 = ( a + b) then the language (aa + bb)* will be generated by ► (r1)(r2) ► (r1 + r2) ► (r2)* ► (r1)* Question No: 5 ( Marks: 1 ) - Please choose one

y a, b

x ±

a, b

Above given FA can be represented by ► ((a+ b) (a + b))* ► (a + b)(a + b)*

Page 41: CS402 FULL Material 2011

► (a + b)(a + b) ► (a + b)*(a + b)* Question No: 6 ( Marks: 1 ) - Please choose one

a,b

2+

1±a,b

Above given FA accepts ___________ strings defined over Σ={a , b} ► All ► Some ► All but not null ► None of these Question No: 7 ( Marks: 1 ) - Please choose one

If a language can be expressed through FA, then it can also be expressed through TG. ► True ► False ► Depends on language ► None of the above Question No: 8 ( Marks: 1 ) - Please choose one

b

b

3+ a

1-

a

aa

a

4+ b

2-

.b

b

ab

5 6

Above given TG has ____________________ RE. ► a+b+a(a + b)*a + b(a + b)*b ► a(a + b)*a + b(a + b)*b ► both are given ► none of the given Question No: 9 ( Marks: 1 ) - Please choose one

b

b

3+ a

1-

a

aa

a

4+ b

2-

.b

b

ab

5 6

Above given FA accepts the language in which strings ► Begins with and ends in same letter

Page 42: CS402 FULL Material 2011

► Begins with and ends in different letter ► Has length more than 2 ► None of the given Question No: 10 ( Marks: 1 ) - Please choose one

GTG can have _______________ final state. ► 0 ► 1 ► More than 1 ► All of the given Question No: 11 ( Marks: 1 ) - Please choose one

In GTG, if a state has more than one incoming transitions from a state. Then all those incoming transitions can be reduced to one transition using _____________ sign ► - ► + ► * ► None of the given Question No: 12 ( Marks: 1 ) - Please choose one

aa+bb ab+ba

ab+ba

aa+bb

Λ

4+

3- 21

Λ

If above given TG is drawn like

aa+bb

Λ

4

3 1

Λ

X

Then what will be written in place of X. ► (ab+ba)(aa+bb)(ba+ab) ► (ab+ba)(aa+bb)(ab+ba) ► (ab+ba)(aa+bb)*(ab+ba) ► (ab+ba)(aa+bb)(ab+ba)* Question No: 13 ( Marks: 1 ) - Please choose one

“One language can be expressed by more than one NFA”. This statement is ______________.

Page 43: CS402 FULL Material 2011

► False ► True ► Depends on NFA ► None of the given Question No: 14 ( Marks: 1 ) - Please choose one

a

^

1-

4+

b 5

a a a

^, b a

2

3

Above given structure is an ________. ► FA ► NFA ► NFA -^ ► TG Question No: 15 ( Marks: 1 ) - Please choose one

One FA has 3 states and 2 letters in the alphabet. Then FA will have ___________ number of transitions in the diagram ► 4 ► 5 ► 7 ► 6 Question No: 16 ( Marks: 1 ) - Please choose one

aa

b

bb

a

1-

2-

3+

4+

b

a

Above given two TG’s are _______________. ► Equivalent ► None-equivalent ► Not valid ► None of the given True or False

1. In a finite language no string is pumpable. True 2. A DFA has infinite number of states. False 3. A DFA can have more than one accepting state. True

Page 44: CS402 FULL Material 2011

4. In DFA all states have same number of transitions. True 5. Every subset of a regular language is regular. False 6. Let L4 = L1L2L3. If L1 and L2 are regular and L3 is not regular, it is possible that L4 is

regular. True 7. In a finite language no string is pumpable. True 8. If A is a nonregular language, then A must be infinite. True example palendroms 9. Every context-free language has a context-free grammarin Chomsky normal form. True 10. If A is a context-free language, then A must be nonregular. False 11. The class of regular languages is closed under intersection. True 12. If a language A is regular, then it A must be finite. False 13. Every language is Turing-recognizable. False 14. If a language is context-free, then it must be Turing-decidable. True 15. The problem of determining if a context-free grammar generates

the empty language is undecidable. False 16. The problem of determining if a Turing machine recognizes the

empty language is undecidable. True 17. The set of all languages over an alphabet is countable.False 18. There are some languages recognized by a 5-tape, nondetermin-

istic Turing machine that cannot be recognized by a 1-tape, deterministic Turing machine.False

19. The language { 0n1n | 0 ≤ n ≤ 1000 } is regular. True 20. Nonregular languages are recognized by NFAs. False 21. The class of context-free languages is closed under intersection. False 22. A language has a regular expression if and only if it

has an NFA. True 23. The regular expression (01*0 ∪ 1)*0 generates the language

consisting of all strings over {0, 1} having an odd number of 0’s. False

24. If a language A has a PDA, then A is generated by a context-free grammar in Chomsky normal form. True

25. If A is a context-free language and B is a language such that B is a subset of A, then B must be a context-free language. False

26. If a language A has an NFA, then A is nonregular. False 27. The regular expressions (a ∪ b)* and (b*a*)* generate the same language. True 28. If a language A has a regular expression, then it also has a context-free grammar. True

Regular Expressions

Describe the language denoted by the following regular expressions: a) a(a|b)*a The expression denotes the set of all strings of length two or more that start and end with an ‘a’. b) ((e|a)b*)* The expression denotes the set of all strings over the alphabet {a,b}. c) (a|b)*a(a|b)(a|b) The expression denotes the set of all strings of length 3 or more with an ‘a’ in the third position from the right. Ie of form yaxz where y is an arbitrary string , and x and z are single characters. d) a*ba*ba*ba*

Page 45: CS402 FULL Material 2011

The expression denotes the set of all strings that contain precisely 3 b’s. e) (aa|bb)*((ab|ba)(aa|bb)*(ab|ba)(aa|bb)*)* The expression denotes the set of all strings of even length. Length of a null string is supposed to be 1. ► True ► False There is no difference between Word and String ► True ► False There may be two RE representing the same language. ► True ► False NFA – null can be considered as TG and vise versa. ► True ► False ∑ = {aA, b}, length(aAbaAaAb) = 5. ► True ► False If s=abcd is a string defined over ∑ = {a,b,c,d} then reverse of s is dcba.

Page 46: CS402 FULL Material 2011

► True ► False The language equal means number of a’s and b’s are equal with no null string. ► True ► False Palindrome is a regular language. ► True ► False If s = babab then palindrome of s = rev(s). ► True ► False TG must have only one start state. ► True ► False If a language can be accepted by FA then it can be accepted by a TG as well. ► True ► False Length of output string is 1 less then that of input string is mealy machine. ► True

Page 47: CS402 FULL Material 2011

► False Formal languages are called Semantic languages. ► True ► False Every NFA can be converted to an FA ► True ► False In mealy machine output character are mentioned on the transition. ► True ► False If s=abcd is a string defined over ∑ = {a,bc,d} then reverse of s is dcba. True False ∑ = {aa, b}, length(aaaabaabb) = 5. True False Every NFA can be converted into FA. True False There can be more than one start states in TG. True False

Page 48: CS402 FULL Material 2011

A regular language can not be infinite. True False Kleene star of {1} generates {1, 11, 111, 1111, 11111 ……}. True False If a regular language is empty then we denote it like L = Ǿ (fi). True False Recursive method for defining language is only for regular languages. True False Aa* = a +? True False The language equal means number of a’s and b’s are equal with null string. True False PDA is only used to represent a regular language. ► True ► False Question No: 2 ( Marks: 1 ) - Please choose one If L is a regular language then LC is also a regular language.

Page 49: CS402 FULL Material 2011

► True ► False Question No: 3 ( Marks: 1 ) - Please choose one A production of the form non-terminal Æ string of two non-terminal is called a live Production. ► True ►False Question No: 4 ( Marks: 1 ) - Please choose one we can find a CFG corresponding to a DFA. ► True ► False Question No: 5 ( Marks: 1 ) - Please choose one START, READ, HERE and ACCEPTS are conversions of the machine (these are joints of machine) ► True ► False Question No: 6 ( Marks: 1 ) - Please choose one A CFG is said to be ambiguous if there exists at least one word of its language that can be generated by different production trees ► True ► False Syntax tree or Generation tree or Derivation tree are same tree ► True ► False Question No: 8 ( Marks: 1 ) - Please choose one

Page 50: CS402 FULL Material 2011

The symbols that cannot be replaced by anything are called terminals ► True ► False Question No: 9 ( Marks: 1 ) - Please choose one The production of the form non-terminal Æ one non-terminal is called unit production ► True ► False Question No: 10 ( Marks: 1 ) - Please choose one DFA and PDA are equal in power. ► True ► False Question No: 10 ( Marks: 1 ) - Please choose one DFA and PDA are equal in power. ► True ► False Question # 1 of 10 ( Start time: 05:46:41 PM ) Total Marks: 1 While finding RE corresponding to TG, If TG has more than one start state then Select correct option: Introduce the new start state Eliminate the old start state Replace the old start state with final state Replace the old final state with new start state Question # 2 While finding RE corresponding to TG, we connect the new start state to the old start state by the transition labeled by Select correct option: a b null string None of the given options Question # 3 of 10 ( Start time: 05:49:03 PM ) Total Marks: 1 Which of the following regular expression represents same language?

Page 51: CS402 FULL Material 2011

a. (a+ab)* b. (ba+a)* c. a*(aa*b)* d. (a*b*)* a+b)*a(a+b)*b(a+b)*+ (a+b)*b(a+b)*a(a+b)*. { x}*, { x}+, {a+b}* Select correct option: a and b a and c c and d Question # 4 of 10 ( Start time: 05:50:32 PM ) Total Marks: 1 (a* + b*)* = (a + b)* this expression is __________ Select correct option: True False Question # 5 of 10 ( Start time: 05:51:30 PM ) Total Marks: 1 Let FA3 be an FA corresponding to FA1+FA2, then the initial state of FA3 must correspond to the initial state of Select correct option: FA1 only FA2 only FA1 or FA2 FA1 and FA2 Question # 6 of 10 ( Start time: 05:53:01 PM ) Total Marks: 1 Which of the following statement is NOT true about TG? Select correct option: There exists exactly one path for certain string There may exist more than one paths for certain string There may exist no path for certain string There may be no final state Question # 7 of 10 ( Start time: 05:54:06 PM ) Total Marks: 1 Kleene’s theorem states Select correct option: All representations of a regular language are equivalent. All representations of a context free language are equivalent. All representations of a recursive language are equivalent Finite Automata are less powerful than Pushdown Automata. Question # 8 of 10 (Start time: 05:55:36 PM) Total Marks: 1 What do automata mean? Select correct option: Something done manually Something done automatically Question # 9 of 10 ( Start time: 05:56:51 PM ) Total Marks: 1 A language accepted by an FA is also accepted by Select correct option:

Page 52: CS402 FULL Material 2011

TG only GTG only RE only All of the given Question # 10 of 10 ( Start time: 05:58:16 PM ) Total Marks: 1 If r1 = (aa + bb) and r2 = (a + b) then the language (aa + bb)(a + b) will be generated by Select correct option: (r1)(r2) (r1 + r2) (r2)(r1) (r1)* Alphabet S = {a, bc, cc} has _______ number of letters

1. One 2. Two 3. Three 4. Four

If S = { x }, then S* will be

1. {x,xx,xxx,xxxx,…} 2. {^ ,x,xx,xxx,xxxx,…}

Length of even even language is

1. Even 2. Odd 3. Sometimes even & sometimes odd 4. Such languages does not exist

If S = {aa, bb}, then S* will not contain

1. Aabbaa 2. Bbaabbbb 3. Aaabbb 4. aabbaaaa

Formal is also known as _________

1. Syntactic language 2. Semantic language 3. Informal language 4. None of these

In an FA, when there is no path starting from initial state and ending in final state then that FA

1. accept null string 2. accept all strings 3. accept all non empty strings 4. does not accept any string

FA of EVEN language shows null string when

1. Initial state is final as well 2. EVEN does not accept null 3. One state is declared null 4. None of the these

Page 53: CS402 FULL Material 2011

Find the regular expression associated to the following FA. Show all steps. [Hint: use FA to GTG and GTG to RE.]

Question No. 3 Marks : ∑ = {aa, b}, length(aaaabaabb) = 5.

True False

Question No. 4 Marks : Every NFA can be converted into FA.

True False

Question No. 5 Marks : There can be more than one start states in TG.

True False

Question No. 6 Marks : A regular language can not be infinite.

True False

Question No. 7 Marks : a) Write the recursive definition of the following language. [6]

L = Defining the language {a2n b4n }, n=1,2,3,… , of strings defined over Σ={a, b}

Page 54: CS402 FULL Material 2011

b) Write a regular expression of the language having strings that either start or end with “00” and have no more zeroes. Where the alphabet is {0, 1}. [4]

Question No. 8 Marks : Kleene star of {1} generates {1, 11, 111, 1111, 11111 ……}.

True False

Question No. 9 Marks :

a) Define NFA-null. [4]

b) Draw DFA for the following NFA. [6] Question No. 10 Marks : If a regular language is empty then we denote it like L = Ǿ (fi).

True False

Question No. 11 Marks : Recursive method for defining language is only for regular languages.

True False

Question No. 12 Marks :

Page 55: CS402 FULL Material 2011

aa* = a+ ?

Page 56: CS402 FULL Material 2011

True False

Question No. 13 Marks :

The language equal means number of a’s and b’s are

equal with null string. True False

Length of a null string is supposed to be 1.

► True

► False Question No: 2 ( Marks: 1 ) - Please choose one There is no difference between Word and String

► True

► False Question No: 3 ( Marks: 1 ) - Please choose one There may be two RE representing the same language.

► True

► False Question No: 4 ( Marks: 1 ) - Please choose one NFA - null can be considered as TG and vise versa.

► True

► False Question No: 5 ( Marks: 1 ) - Please choose one ∑ = {aA, b}, length(aAbaAaAb) = 5.

► True

► False

Page 57: CS402 FULL Material 2011

Question No: 6 ( Marks: 1 ) - Please choose one If s=abcd is a string defined over ∑ = {a,b,c,d} then reverse of s is dcba.

► True

► False Question No: 7 ( Marks: 1 ) - Please choose on

Page 58: CS402 FULL Material 2011

The language equal means number of a’s and b’s are equal with no null string.

► True

► False

Page 59: CS402 FULL Material 2011

Question No: 8 ( Marks: 1 ) Palindrome is a regular language.

► True

► False Question No: 9 ( Marks: 1 )

- Please cho

- Please cho

Page 60: CS402 FULL Material 2011

If s = babab then palindrome of s = rev(s).

Page 61: CS402 FULL Material 2011

► True

Page 62: CS402 FULL Material 2011

► False

Page 63: CS402 FULL Material 2011

Question No: 10 ( Marks: 1 ) TG must have only one start state.

► True

► False Question No: 11 ( Marks: 1 )

- Please ch

- Please ch

Page 64: CS402 FULL Material 2011

If a language can be accepted by FA then it can be accepted by a TG as well.

Page 65: CS402 FULL Material 2011

► True

Page 66: CS402 FULL Material 2011

► False

Page 67: CS402 FULL Material 2011

Question No: 12 ( Marks: 1 ) - Please choose one

Page 68: CS402 FULL Material 2011

Length of output string s 1 less then that of input string is mealy machine.

Page 69: CS402 FULL Material 2011

► True

Page 70: CS402 FULL Material 2011

► False

Page 71: CS402 FULL Material 2011

Question No: 13 ( Marks: 1 ) - Please choose one

Formal languages are called Semantic languages.

Page 72: CS402 FULL Material 2011

► True

► False Question No: 14 ( Marks: 1 ) - Please choose one Every NFA can be converted to an FA

► True

► False Question No: 15 ( Marks: 1 ) - Please choose one In mealy machine output character are mentioned on the transition.

► True

► False Question No: 16 ( Marks: 8 ) Differentiate between the following terms:

• Mealy and Moore machine. • NFA and FA.

Question No: 17 ( Marks: 5 )

Build an FA corresponding to NFA given below. q1 b

a b

q0 +q3

Question No: 18 ( Marks: 7 )

Build an NFA equivalent to FA1U FA2, where FA1, FA2 are given below. FA1

Page 73: CS402 FULL Material 2011

b p-

a q

b

Page 74: CS402 FULL Material 2011

3

FA2

2 a 4

a b a a,b 1- a b 6+

b a b

3 b 5

1) For a given input, it provides the compliment of Boolean AND output. NAND box (NOT AND) DELAY box OR box AND box

2) It delays the transmission of signal along the wire by one step (clock pulse). NAND box (NOT AND) DELAY box OR box AND box

3) For the given input, it provides the Boolean OR output NAND box (NOT AND) DELAY box OR box AND box

4) For the given input, AND box provides the Boolean AND output. True False

5) The current in the wire is indicated by 1 and 0 indicates the absence of the current. True False

6) Any language that can not be expressed by a RE is said to be regular language. True False

7) If L1 and L2 are regular languages is/are also regular language(s). L1 + L2 L1L2 L1* All of above

Page 75: CS402 FULL Material 2011

8) Let L be a language defined over an alphabet Σ, then the language of strings, defined over

Σ, not belonging to L, is called Complement of the language L, denoted by Lc or L’. True False

9) To describe the complement of a language, it is very important to describe the ----------- of that language over which the language is defined.

Alphabet Regular Expression String Word

10) For a certain language L, the complement of Lc is the given language L i.e. (Lc)c = Lc True False

11) If L is a regular language then, --------- is also a regular language. Lm Ls Lx Lc

12) Converting each of the final states of F to non-final states and old non-final states of F to final states, FA thus obtained will reject every string belonging to L and will accept every string, defined over Σ, not belonging to L. is called

Transition Graph of L Regular expression of L Complement of L Finite Automata of L

13) If L1 and L2 are two regular languages, then L1 U L2 is not a regular. True False

14) De-Morgan's law for sets is expressed by, 1 2 1 2( )c c c c cL L L L∩ = ∩

1 2 1 2( )c c c c cL L L L∩ = ∩

1 2 1 2( )c c cL L L L∩ = ∩

1 2 1 2( )c c cL L L L∩ = ∪ CORRECT

15) If L1 and L2 are regular languages, then these can be expressed by the corresponding FAs. True False

16) L= language of words containing even number of a’s. Regular Expression is (a+b)*aa(a+b)* (b+ab*a)* a+bb*aab*a (a+b)*ab(a+b)*

17) The regular expression defining the language L1 U L2 can be obtained, converting and reducing the previous ------------- into a ------------ as after eliminating states.

GTG, TG

Page 76: CS402 FULL Material 2011

FA, GTG FA, TG TG, RE

18) The language that can be expressed by any regular expression is called a Non regular language.

True False

19) The languages -------------- are the examples of non regular languages. PALINDROME and PRIME PALINDROME and EVEN-EVEN EVEN-EVEN and PRIME FACTORIAL and SQURE

20) Let L be any infinite regular language, defined over an alphabet Σ then there exist three strings x, y and z belonging to Σ* such that all the strings of the form xy zn for n=1,2,3, … are the words in L. called.

Complement of L Pumping Lemma Kleene’s theorem None in given

(21) Languages are proved to be regular or non regular using pumping lemma. True False

(22) ------------------- is obviously infinite language. EQUAL-EQUAL EVEN-EVEN PALINDROME FACTORIAL

(23) If, two strings x and y, defined over Σ, are run over an FA accepting the language L, then x and y are said to belong to the same class if they end in the same state, no matter that state is final or not.

True False

(24) Myhill Nerode theorem is consisting of the followings, L partitions Σ* into distinct classes. If L is regular then, L generates finite number of classes. If L generates finite number of classes then L is regular. All of above

(25) The language Q is said to be quotient of two regular languages P and R, denoted by--- if PQ=R.

R=Q/P Q=R/P Q=P/R P=R/Q

(26) If two languages R and Q are given, then the prefixes of Q in R denoted by Pref(Q in R). True False

Page 77: CS402 FULL Material 2011

(27) Let Q = {aa, abaaabb, bbaaaaa, bbbbbbbbbb} and R = {b, bbbb, bbbaaa, bbbaaaaa}

Pref (Q in R) is equal to, {b,bbba,bbbaaa} {b,bba,bbaaa} {ab,bba,bbbaa} {b,bba,bbba}

(27) If R is regular language and Q is any language (regular/ non regular), then Pref (Q in R) is ---------. Non-regular Equal Regular Infinite

(28) "CFG" stands for _________ Context Free Graph Context Free Grammar Context Finite Graph Context Finite Grammar

(29) ___________ states are called the halt states. ACCEPT and REJECT ACCEPT and READ ACCEPT AND START ACCEPT AND WRITE

(30) The part of an FA, where the input string is placed before it is run, is called _______

State Transition Input Tape Output Tape

(31) In new format of an FA (discussed in lecture 37), This state is like dead-end non final state ACCEPT REJECT STATR READ

(32) For language L defined over {a, b}, then L partitions {a, b}* into …… classes Infinite Finite Distinct Non-distinct

(33) The major problem in the earliest computers was

Page 78: CS402 FULL Material 2011

To store the contents in the registers To display mathematical formulae To load the contents from the registers To calculate the mathematical formula

(34) Between the two consecutive joints on a path One character can be pushed and one character can be popped Any no. of characters can be pushed and one character can be popped One character can be pushed and any no. of characters can be popped Any no. of characters can be pushed and any no. of characters can be popped

(35) In pumping lemma theorem (x y^n z) the range of n is n=1, 2, 3, 4………. n=0, 1, 2, 3, 4………. n=…….-3,-2,-1, 0, 1, 2, 3, 4…… n=…….-3,-2,-1, 1, 2, 3, 4……

(36) The PDA is called non-deterministic PDA when there are more than one out going edges from……… state

START or READ POP or REJECT READ or POP PUSH or POP

(37) Identify the TRUE statement:

A PDA is non-deterministic, if there are more than one READ states in PDA A PDA is never non-deterministic Like TG, A PDA can also be non-deterministic A PDA is non-deterministic, if there are more than one REJECT states in PDA

(38) There is a problem in deciding whether a state of FA should be marked or not when the language Q is infinite. True False

(39) If an effectively solvable problem has answered in yes or no, then this solution is called --------- Decision procedure Decision method Decision problem Decision making

(40) The following problem(s) ------------- is/are called decidable problem(s). The two regular expressions define the same language The two FAs are equivalent

Page 79: CS402 FULL Material 2011

Both a and b None of given

(41) To examine whether a certain FA accepts any words, it is required to seek the paths from ------- state. Final to initial Final to final Initial to final Initial to initial

(42) The high level language is converted into assembly language codes by a program called compiler. TRUE FALSE

(43) Grammatical rules which involve the meaning of words are called --------------- Semantics Syntactic Both a and b None of given

(44) Grammatical rules which do not involve the meaning of words are called --------------- Semantics Syntactic Both a and b None of given

(45) The symbols that can’t be replaced by anything are called ----------------- Productions Terminals Non-terminals All of above

(46) The symbols that must be replaced by other things are called __________ Productions Terminals Non-terminals None of given

(47) The grammatical rules are often called_____________ Productions Terminals Non-terminals None of given

(47) The terminals are designated by ________ letters, while the non-terminals are designated by ________ letters.

Page 80: CS402 FULL Material 2011

Capital, bold Small, capital Capital, small Small, bold

(48) The language generated by __________ is called Context Free Language (CFL). FA TG CFG TGT

(49) Σ = {a,b} Productions S→XaaX X→aX X→bX X→Λ This grammar defines the language expressed by___________ (a+b)*aa(a+b)* (a+b)*a(a+b)*a (a+b)*aa(a+b)*aa (a+b)*aba+b)*

(50) S → aXb|b XaX → aX|bX|Λ The given CFG generates the language in English

__________ Beginning and ending in different letters Beginning and ending in same letter Having even-even language None of given

(51) The CFG is not said to be ambiguous if there exists atleast one word of its language that can be generated by the different production trees,

TRUE FALSE

(52) The language generated by that CFG is regular if _________

No terminal → semi word No terminal → word Both a and b None of given

(53) The production of the form no terminal → Λ is said to be null production.

TRUE FALSE

(54) A production is called null able production if it is of the form N → Λ

TRUE FALSE

(55) The productions of the form nonterminal → one nonterminal, is called _________ Null production Unit production

Page 81: CS402 FULL Material 2011

Null able production None of given (56) CNF is stands for Context Normal Form Complete Normal Form Chomsky Normal Form Compared Null Form The input string is placed, before it runs, in

1. Stack 2. Memory 3. Tape 4. Ram

Every nondeterministic finite automata can be converted into

1. Regular expression 2. Deterministic finite 3. Transition graph 4. All of the given option.

In CFG, the symbols that cannot be replaced by anything are called 1. Terminals 2. Nonterminals 3. Productions 4. None of the given options

If L1 and L2 are regular languages then which statement is NOT true?

1. L1 + L2 is always regular 2. L1 L2 is always regular 3. L1/L2 is always regular 4. L1* is always regular

The tree which produced all the strings of a language is called

1. Derivation tree 2. Ambiguous tree 3. Total language tree 4. Non ambiguous tree

By removing null and unit productions:

1. CNF can be converted into CFG 2. CFG can be converted into CNF 3. CNF can be converted into TG 4. None of the given options

Page 82: CS402 FULL Material 2011
Page 83: CS402 FULL Material 2011
Page 84: CS402 FULL Material 2011

Question: 31 (Marks 1) Can you say that string of 0’s whose length is a perfect square is not regular? Question: 32 (Marks 1) Question: 33 (Marks 2) Is the following an FA or TM? Question: 34 (Marks 2) If L is the language that accept even length strings then what strings will Lc accept? Question: 35 (Marks 3) Define Myhill Nerode theorem Question: 36 (Marks 3) If L1,L2 and L3 be any three finite languages over Sigma = {a,b}, then how will be (L1 INTERSECTION L2) Union (L2 INTERSECTION L3) ≠ Ø Question: 37 (Marks 3) How you differentiate between wanted and unwanted branches while deriving a string from in the context of CFG? Question: 38 (Marks 5) What is the difference between concatenation and intersection of two FAs and union and addition of two FAs? Question: 39 (Marks 5) Use pumping lemma II to show that following language is not regular. L = {an2 ; n =1,2,3,4…} Question: 40 (Marks 10) Draw Moore Machine equivalent to the following Mealy Machine. Question: 41 (Marks 10) Write CFG of the following PDA. Also write the stack alphabet and tape alphabet.

Page 85: CS402 FULL Material 2011

Question No: 1 ( Marks: 1 ) - Please choose one

If r1 = (aa + bb) and r2 = ( a + b) then the language (aa + bb)(a + b) will be generated by ► (r1)(r2) *► (r1 + r2) ► (r2)(r1) ► (r1)* Question No: 2 ( Marks: 1 ) - Please choose one

“One language can be expressed by more than one FA”. This statement is ______ * ► True ► False ► Some times true & sometimes false ► None of these Question No: 3 ( Marks: 1 ) - Please choose one

Who did not invent the Turing machine? ► Alan Turing *► A. M. Turing ► Turing ► None of these Question No: 4 ( Marks: 1 ) http://vustudents.ning.com - Please choose one

Which statement is true? *► The tape of turing machine is infinite. ► The tape of turing machine is finite. ► The tape of turing machine is infinite when the language is regular ► The tape of turing machine is finite when the language is nonregular. Question No: 5 ( Marks: 1 ) - Please choose one

Page 86: CS402 FULL Material 2011

A regular language: *► Must be finite ► Must be infinite ► Can be finite or infinite ► Must be finite and cannot be infinite Question No: 6 ( Marks: 1 ) - Please choose one

Every regular expression can be expressed as CFG but every CFG cannot be expressed as a regular expression. This statement is: ► Depends on the language ► None of the given options *► True ► False Question No: 7 ( Marks: 1 ) - Please choose one

ba

a

X1–

b

X2+

Above given FA corresponds RE r. then FA corresponding to r* will be

a

b

b

z3+

a

z2

z1±

a b

This statement is *► True ► False ► Depends on language ► None of these Question No: 8 ( Marks: 1 ) http://vustudents.ning.com- Please choose one

Consider the language L of strings, defined over Σ = {a,b}, ending in a ► There are finite many classes generated by L, so L is regular *► There are infinite many classes generated by L, so L is regular ► There are finite many classes generated by L, so L is non-regular ► There are infinite many classes generated by L, so L is non-regular Question No: 9 ( Marks: 1 ) - Please choose one

Page 87: CS402 FULL Material 2011

ab,ba

ab,ba

±

aa,bb aa,bb

Above given TG has _____________ RE. ► (aa+aa+(ab+ab)(aa+ab)*(ab+ba))* *► (aa+bb+(ab+ba)(aa+bb)*(ab+ba))* ► (aa+bb+(ab+ba)(aa+bb)(ab+ba))* ► None of these Question No: 10 ( Marks: 1 ) - Please choose one

The word ‘formal’ in formal languages means *► The symbols used have well defined meaning ► They are unnecessary, in reality ► Only the form of the string of symbols is significant ► None of these Question No: 11 ( Marks: 1 ) - Please choose one

Let A = {0, 1}. The number of possible strings of length ‘n’ that can be formed by the elements of the set A is http://vustudents.ning.com ► n! *► n2 ► nm ► 2n Question No: 12 ( Marks: 1 ) - Please choose one

Choose the correct statement. ► A Mealy machine generates no language as such ► A Moore machine generates no language as such *► A Mealy machine has no terminal state ► All of these Question No: 13 ( Marks: 1 ) - Please choose one

TM is more powerful than FSM because ► The tape movement is confined to one direction *► It has no finite state control ► It has the capability to remember arbitrary long sequences of input symbols ► None of these Question No: 14 ( Marks: 1 ) - Please choose one

If L1 and L2 are expressed by regular expressions r1 and r2, respectively then the language expressed by r1 + r2 will be _________ * ► Regular ► Ir-regular ► Can’t be decided

Page 88: CS402 FULL Material 2011

► Another Language which is not listed here Question No: 15 ( Marks: 1 ) - Please choose one

Like TG, a PDA can also be non-deterministic ► True *► False Question No: 16 ( Marks: 1 ) - Please choose one

The above machine is a/anTG ___________ http://vustudents.ning.com ► Finite Automata *► Turing machine ► FA ► TG Question No: 17 ( Marks: 1 ) - Please choose one

The language of all words (made up of a’s and b’s) with at least two a’s can not be described by the regular expression. ► a(a+b)*a(a+b)*(a+b)*ab* ► (a+b)* ab* a(a+b)* ► b*ab* a(a+b)* ► none of these Question No: 18 ( Marks: 1 ) - Please choose one

In FA, if one enters in a specific state but there is no way to leave it, then that specific state is called *► Dead State ► Waste Basket ► Davey John Locker ► All of these Question No: 19 ( Marks: 1 ) - Please choose one

If L is a regular language then, Lc is also a _____ language. *► Regular ► Non-regular ► Regular but finite ► None of the given Question No: 20 ( Marks: 1 ) - Please choose one

Page 89: CS402 FULL Material 2011

In CFG, the symbols that can’t be replaced by anything are called___ ► Terminal ► Non-Terminal *► Production ► All of given Question No: 21 ( Marks: 1 ) - Please choose one

Which of the following is NOT a regular language? http://vustudents.ning.com ► String of 0’s whose length is a perfect squere *► Set of all palindromes made up of 0’s and 1’s ► String of 0’s whose length is a prime number ► All of the given options Question No: 22 ( Marks: 1 ) - Please choose one

Choose the incorrect (FALSE) statement. ► A Mealy machine generates no language as such ► A Mealy machine has no terminal state *► For a given input string, length of the output string generated by a Moore machine is not more than the length of the output string generated by that of a Mealy machine ► All of these Question No: 23 ( Marks: 1 ) - Please choose one

Pumping lemma is generally used to prove that: ► A given language is infinite *► A given language is not regular ► Whether two given regular expressions of a regular language are equivalent or not ► None of these Question No: 24 ( Marks: 1 ) - Please choose one

Which of the following is a regular language? ► String of odd number of zeroes ► Set of all palindromes made up of 0’s and 1’s *► String of 0’s whose length is a prime number ► All of these Question No: 25 ( Marks: 1 ) - Please choose one

Choose the incorrect statement: ► (a+b)*aa(a+b)* generates Regular language. ► A language consisting of all strings over ∑={a,b} having equal number of a’s and b’s is a regular language ► Every language that can be expressed by FA can also be expressed by RE ► None of these Question No: 26 ( Marks: 1 ) - Please choose one

Left hand side of a production in CFG consists of: ► One terminal ► More than one terminal

Page 90: CS402 FULL Material 2011

► One non-terminal * ► Terminals and non-terminals Question No: 27 ( Marks: 2 )

Diffrentiate between Regular and Non regular languages? Ans: The main difference between regular and non regular language are as: 1. The regular language is that language which can be expressed by RE is known as regular language whereas any language which can not be expressed by RE is known as non regular language. Question No: 28 http://vustudents.ning.com ( Marks: 2 )

What is meant by a "Transition" in FA? Question No: 29 ( Marks: 2 )

What are the halt states of PDAs? Ans: There are some halts states in PDA which are as:

1. Accept or reject stat is also halt state. 2. Reject state is like dead non final state. 3. Accept state is like final state.

Question No: 30 ( Marks: 2 )

Identify the null productions and nullable productions from the following CFG: S -> ABAB A -> a | /\ B-> b | /\ Question No: 31 ( Marks: 3 )

Describe the POP operation and draw symbol for POP state in context of Push down stack. Question No: 32 ( Marks: 3 )

What does the the following tape of turing machine show?

11 abb b b READ3 READ9

ROW Number

PUSH What

POP What

READ What

TO Where

FROM Where

Ans: Arbitrary Summary Table: The arbitrary summary table shows the trip from READ9 to READ3 does not pop one letter form the STACK it adds two letters to the STACK.

Page 91: CS402 FULL Material 2011

Row11 can be concatenated with some other net style sentences e.g. row11 net(READ3, READ7, a)Net(READ7, READ1, b)Net(READ1, READ8, b) it gives the non terminal Net(READ9, READ8, b), The whole process can be written as: Net(READ9, READ8, b) ?Row11Net(READ3, READ7,a) Net(READ7, READ1, b)Net(READ1, READ8, b) This will be a production in the CFG of the corresponding row language. Question No: 33 ( Marks: 3 )

Find Pref (Q in R) for: Q = {10, 11, 00, 010} R = {01001, 10010, 0110, 10101, 01100, 001010} Question No: 34 ( Marks: 5 )

Consider the Context Free Grammar (CFG)

S à 0AS | 0 A à S1A | SS | 1a

Show that the word 0000100 can be generated by this CFG by showing the whole derivation starting from S Question No: 35 ( Marks: 5 )

Consider the language L which is EVEN-EVEN, defined over Σ = {a,b}. In how many classes does L may partition Σ*. Explain briefly. Question No: 36 ( Marks: 5 )

What are the conditions (any five) that must be met to know that PDA is in conversion form? http://vustudents.ning.com Ans: Conversion form of PDA: A PDA is in conversion form if it has following conditions: 1. The PDA must begin with the sequence 2. There is only one ACCEPT state. 3. Every edge leading out of any READ or HERE state goes directly into a POP state. 4. There are no REJECT states. 5. All branching, deterministic or nondeterministic occurs at READ or HERE states. 6. The STACK is never popped beneath this $ symbol. 7. No two POPs exist in a row on the same path without a READ or HERE. 8. Right before entering ACCEPT this symbol is popped out and left. 1.What is Row Langage. 2.What does FA stands for? 3.What are live and dead productions. 4. Given a summary table, we were required to explain it. 5.What do you mean by wanted and unwanted branches. 6.Given an FA, I had to recogize the langauge - EVEN-EVEN 7.Given the CFG, had to write the language (EQUAL)

Page 92: CS402 FULL Material 2011

8.Construct corresponding CFG for the given language (1) All words of even length but not multiple of 3. (2) Palindrome (both even and odd palindrome). (5 mark) 9.Who invented Turing m/c 10.Equivalent /non-equivalent langages 11. what are formal langages?

Q No. 1 Choose the right option: (2) A) aAbB is a string defined on an alphabet {aA, bB, aAbB}. B) aAbB is a string defined on an alphabet {aA, bB}. o B only

o A only Q No. 2 Choose the right option: (2) A) For every NFA, there may not be an FA equivalent to it B) For every NFA, there must be an FA equivalent to it o B only

o A only Q No. 3

Choose the right option: (2) A) In a Mealy machine, the set of letters and the set of output characters must be same B) In a Mealy machine, the set of letters and the set of output characters may not be same

o B only o A only

Q No. 4 Choose the right option: (2) A) Pumping Lemma version I is sufficient to test an infinite language to be regular B) To test an infinite language to be regular, Pumping Lemma version I may not help o B only

o A only

Q No. 5 Choose the right option: (2) A) For a given CFG, there may not exist any PDA accepting the language generated by the CFG B) For a given CFG, there must be a PDA accepting the language generated by the CFG

Page 93: CS402 FULL Material 2011

o B only o A only

Q No. 6

Identify the language accepted by the following PDA. Build an FA accepting the corresponding language. Write the corresponding RE as well (10)

Q No. 7 Derive any two words of length 4 from the following CFG. (5) S®XaaX, X®aX|bX|L

A Total Language Tree has

o All languages over Σ o All strings over Σ o All words of all languages over Σ

Page 94: CS402 FULL Material 2011

o All words of one language over Σ

Page 95: CS402 FULL Material 2011

Question No. 2

(a) Derive any two words of length 4 from the following CFG.

S→XaaX, X→aX|bX| . Write the corresponding RE as Well.

(b) Determine the CFG, corresponding to the following FA

a b

Page 96: CS402 FULL Material 2011

b

Page 97: CS402 FULL Material 2011

a

S- b

b Question No. 3

What Turing Machine does not have?

o Stack o Tape o Head o Word

Question No. 4

A a

a

B b

Page 98: CS402 FULL Material 2011

(a) Draw Moore Machine equivalent to following Mealy Machine. (5)

q1 1/1 1/0

0/0

q0 0/1 q3 1/0 0/0 1/0

q2

0/1

Page 99: CS402 FULL Material 2011
Page 100: CS402 FULL Material 2011

(b) Use Pumping Lemma II to show that following language is non-regular.

n2

(5)

Page 101: CS402 FULL Material 2011

i. Square ( a , for n = 1, 2, 3, ….)

Page 102: CS402 FULL Material 2011

Question No. 5 Marks : 10

Identify the language accepted by the following PDA. Build an FA accepting the corresponding language. Write the corresponding RE as well.

Question No. 6 Marks : 02

Two FAs represent same languages over some alphabet (may or may not be same for FAs), If

o They accept same words o They accept same number of words o They reject same words o None of above

Question No. 7

Marks : 02 CFG given S bS|Sb|aa represents language

o b*aa o aab* o b*aab* o b*(aa)*b*

Question No. 8 Marks : 10

Page 103: CS402 FULL Material 2011

a) Define the following terms (6)

i. Total language tree (TLT) ii. Ambiguous CFG. iii. Unit Production

(b) Find Context Free Grammar's (CFG's) for the following languages over the Σ={a, b}. (4)

i. All the words that do not contain substring abb. ii. All the words that have exactly two or three b's.

Question No. 9 Marks : 02

A Language that is finite but not regular

o Λ o (a+b)* o Φ o All strings of a's in Σ = {a,.b}

Question No. 1 Marks :

A production of the form non-terminal non-terminal is called a dead Production. 1. True 2. False

Question No. 2 Marks : 3

Semi-word is a string having some terminals and one non-terminal at the right of string.

1. True 2. False

Question No. 3 Marks : 3

Two FAs are equivalent if they have same no. of states.

1. True 2. False

Question No. 4 Marks : 1

Page 104: CS402 FULL Material 2011

There exist exactly two different derivations in an ambiguous CFG for a word.

1. True 2. False

Question No. 5 Marks :

Construct RE’s for following languages over Σ= {a, b}

i. All words which contain substring “baba”. [5]

Page 105: CS402 FULL Material 2011

ii.A ll words which never end in substrings “aa” and “ab” [5] Question No. 6 Marks : 1

Regular languages are closed under Union, Concatenation and Kleene star.

1. True 2. False

Question No. 7 Marks : 1

C FG may also represent a regular language.

1. True 2. False

Question No. 8 Marks : 1

Find the complement of the FA below, Question No. 9 Marks : 1

Page 106: CS402 FULL Material 2011

PDA is stronger than FA.

3. True 4. False

Question No. 10 Marks : 3

Page 107: CS402 FULL Material 2011

Union of two FAs is an FA that accepts all the string of FA1 and FA2. True False

Question No. 11 Marks : Given a CFG below,

a) Remove Unit productions from the CFG. [5]

S → S + T | T T → T * F | F F → ( S ) | a

b) Derive CNF corresponding to the CFG given below. [10]

S → ABa A → aab B → Ac

Question No. 12 Marks :

In non-deterministic PDA a string may be traced by more than one paths.

1. True 2. False

Question No. 13 Marks : There always exist an FA for each PDA. True False Question No. 14 Marks : a) Given an FA below, [5]

Page 108: CS402 FULL Material 2011

What is language accepted by above FA?

Page 109: CS402 FULL Material 2011

b) Draw a non-deterministic PDA for the above FA. [10]

Question No: 1 ( Marks: 1 ) - Please choose one PDA is only used to represent a regular language.

► True

► False Question No: 2 ( Marks: 1 ) - Please choose one If L is a regular language then LC is also a regular language.

► True

► False Question No: 3 ( Marks: 1 ) - Please choose one A production of the form non-terminal string of two non-terminal is called a live Production.

► True

► False Question No: 4 ( Marks: 1 ) - Please choose one we can find a CFG corresponding to a DFA.

► True

► False Question No: 5 ( Marks: 1 ) - Please choose one START, READ, HERE and ACCEPTS are conversions of the machine

► True

► False

Page 110: CS402 FULL Material 2011

Question No: 6 ( Marks: 1 ) - Please choose one A CFG is said to be ambiguous if there exists at least one word of its language that can be generated by different production trees

► True

► False Question No: 7 ( Marks: 1 ) - Please choose one

Page 111: CS402 FULL Material 2011

Syntax tree or Generation tree or Derivation tree are same tree

► True

► False Question No: 8 ( Marks: 1 ) - Please choose one The symbols that cannot be replaced by anything are called terminals

► True

► False Question No: 9 ( Marks: 1 ) - Please choose one The production of the form non-terminal one non-terminal is called unit production

► True

► False Question No: 10 ( Marks: 1 ) - Please choose one DFA and PDA are equal in power.

► True

► False Question No: 11 ( Marks: 10 )

a) Define Describe the following terms: [Note: maximum in 20 to 30 words for each]

I. CNF II. Regular Grammar

b) Convert the following CFG into CNF S → CDCD

C → 0|Λ D → 1|Λ

Question No: 12 ( Marks: 10 )

a) Construct RE’s for following languages over Σ= {0, 1} (6) i. All words in which “1” never follows “0”. ( “0” never appears before “1”)

Page 112: CS402 FULL Material 2011

ii. All words which begin and end with different letters.

b) How many minimum states can be there in an NFA of language having all word with “101” at the end? (4)

Page 113: CS402 FULL Material 2011

HINT: Build NFA for language for yourself but write only number of minimum states. No need to build NFA in software. Question No: 13 ( Marks: 10 ) a) Is this an FA or NFA? (2) b) Determine the CFG corresponding to the above FA or NFA (8) Question No: 14 ( Marks: 10 ) a) Given CFG (Context Free Grammar): (6)

S → bS | aX | Λ X → aX | bY | Λ Y → aX | Λ

Derive following strings from above CFG. Show all steps. If string cannot be derived then describe it.

i. baabab ii. ababaab

b) Describe language of following PDA (Push Down Automata): (4) [ Note: Don’t write more than two to three lines for each. Only write to the point. ]

Page 114: CS402 FULL Material 2011
Page 115: CS402 FULL Material 2011

START

0

READ

ACCEPT

Question No: 15

1

1

( Marks: 5 )

Page 116: CS402 FULL Material 2011

Given a CFG below, [5]

S → bS | aM M→ bM | aF F → bF | aM | ^ What is language accepted by above CFG?

Question No: 1 ( Marks: 1 ) - Please choose one

a* + b* = (a + b)* this expression is __________

True

False

Can t be decided

None of these

Question No: 2 ( Marks: 1 ) - Please choose one

Page 117: CS402 FULL Material 2011

a (a + b)* is the RE of language defined over

True

False

Such a language does not exist

None of these

= {a, b} ha

Page 118: CS402 FULL Material 2011

Question No: 3 ( Marks: 1 ) - Please choose one According to _________ machine, Finite set of states containing exactly one START state and some (may be none) HALT states that cause execution to terminate when the HALT states are entered.

Finite Automata

TG

Turing

Insertion

Question No: 4 ( Marks: 1 ) - Please choose one

Page 119: CS402 FULL Material 2011

finite automaton but with an unlimited and unrestricted memory

A Turing machine is a much more accurate model of a general purpose computer

Both satements are false

Both statments are true.

Question No: 8 ( Marks: 1 ) - Please choose one To determine whether a string is generated by the given CFG

CYK algorithm is used CIK algorithm is used CNK algorithm is used CNM algorithm is used

Question No: 9 ( Marks: 1 ) - Please choose one The process of finding the derivation of word generated by particular grammar is called_____

Processing

Parsing Programming Planing

Question No: 10 ( Marks: 1 ) - Please choose one Pumping Lemma II says that length(x) + length(y) should be

Less than number of states

Less than or equal to number of states

Greater than number of states

Greater than or equal to number of states

Question No: 11 ( Marks: 1 ) - Please choose one Before the PDA is converted into conversion form a new state _____ is defined which is placed in the middle of any edge.

Page 120: CS402 FULL Material 2011

, L1 L2

None of the given

Question No: 15 ( Marks: 1 ) - Please choose one

If L is a regular language then, Lc is also a _____ language.

Regular

Non-regular

Regular but finite

None of the given

Question No: 16 ( Marks: 1 ) - Please choose one Running the string abbabbba on this Moore machine. The outputs will be________

q1/0

a a q0/1

b

b b

101111010

01111010

01011110

01010101

Question No: 17 a

b q2/1

b

a

1

a

q3/0 2

( Marks: 1

a

aa a

bb

Page 121: CS402 FULL Material 2011

a b

b

ab

b a

ba a

a b b

bb

Page 122: CS402 FULL Material 2011

Above given FA has ___________ final states

1

2

3

+

Page 123: CS402 FULL Material 2011

Above given FA s are ___________

Non-equivalent

FA2 is not valid as it

has no final state.

None of these

Equivalent

Question No: 19 ( Marks: 1 ) - Please choose one

2 a 4 a

a b a,b 1 a b 6+

b a b

3 b 5

RE for the above given FA is __________________.

(a+b)* (aaa + bbb) (a+b)* OR (a+b)* (aaa) (a+b)* + (a+b)*(bbb) (a+b)*

(a+b)* (aaa + bbb) (a+b)*

(a+b)* (aaa) (a+b)* +

(a+b)*(bbb) (a+b)*

(a+b)* (aaa + bbb)*

(a+b)*

Question No: 20 ( Marks: 1 ) - Please choose one

One FA has n states and m letters in the alphabet. Then FA will have _____ number of states in the diagram.

(m)(n)

(n)(m)

(m)(n) & (n)(m)

None of these

Page 124: CS402 FULL Material 2011

Question No: 21 ( Marks: 1 ) - Please choose one Choose the incorrect statement.

For a given input string, length of the output strings generated by a Moore machine is not more than the length of the output strings generated by that of a Mealy machine

A Mealy machine generates no language as such

All of these

A Mealy machine has no terminal state

Question No: 22 ( Marks: 1 ) - Please choose one Pumping lemma is generally used for proving

A given grammar is regular

A given grammar is not regular

Whether two given regular expressions are equivalent

None of these

Question No: 23 ( Marks: 1 ) - Please choose one Which of the following pairs of regular expressions are not equivalent?

(ab)* and a*b*

x(xx)* and (xx)*x x+ and x*x+

All of these

Question No: 24 ( Marks: 1 ) - Please choose one Choose the correct statements.

A = {an bn | n = 0, 1, 2, 3, } is a regular language.

The set of B, consisting of all strings made up of only a s and b s having equal number of a s and b s defines a regular language

L(A*B*) B gives the set of A

None of these

Page 125: CS402 FULL Material 2011

Question No: 25 ( Marks: 1 ) - Please choose one Choose the incorrect statements.

A = {an bn | n = 0, 1, 2, 3, } is a regular language

The set of B, consisting of all strings made up of only a s and b s having equal number of a s and b s defines a regular language

L(A*B*) B gives the set of A

None of these

Question No: 26 ( Marks: 1 ) - Please choose one The logic of pumping lemma is a good example of

The divide and conquer technique

Recursion

Iteration

The Pigeon-hole principal

Question No: 27 ( Marks: 1 ) - Please choose one Palindrome can be recognized by FSM because

An FSM can t remember arbitrarily large

amount of information An FSM can t

deterministically fix the mid-point

Even if the mid-point is known, an FSM can t find whether the second half of the string matches the first half

None of these

Question No: 28 ( Marks: 1 ) - Please choose one The language all words (made up of a s and b s) with at least two a s can be described by the regular expression.

(a+b)* a (a+b)* a (a+b)*

(a+b)* ab* a(a+b)*

b*ab* a(a+b)*

Page 126: CS402 FULL Material 2011

All of these

Question No: 29 ( Marks: 1 ) - Please choose one The language all words (made up of a s and b s) with at least two a s can not be described by the regular expression.

a(a+b)*a(a+b)*(a+b)*ab*

(a+b)* ab* a(a+b)*

b*ab* a(a+b)*

none of these

Question No: 30 ( Marks: 1 ) - Please choose one

An alphabet of is valid if

No letter of appears in middle

of any other letter No letter of

appears at end of any other

letter

No letter of appears at start of

any other letter

All of above

Question No: 31 ( Marks: 1 ) Can you neglect the following? Pumping lemma is generally used for proving that a given grammar is regular.

Question No: 32 ( Marks: 1 ) Is it correct that the regular expression can not be used for simulating sequential circuits? Question No: 33 ( Marks: 2 ) Differentiate between containing and consisting? Question No: 34 ( Marks: 2 )

Page 127: CS402 FULL Material 2011

How can you determine that any two FAs can generate the equivalint language?

Question No: 36 ( Marks: 3 ) Find Pref (Q in R) for:

Q = {01, 10, 11, 011} R = {10011, 100100, 01010, 0111, 010100, 01011}

Question No: 37 ( Marks: 3 ) What are the Joints of PDA? Question No: 38 ( Marks: 5 ) Consider the Context Free Grammar (CFG) S aAS | a

A SbA | SS | ba Show that the word aaaabaa can be generated by this CFG by showing the whole derivation starting from S Question No: 39 ( Marks: 5 ) Construct RE for following languages over = {a, b} All words containing exactly 4 a (mean, there must be 4 a neither less nor extra)

Question No: 40 ( Marks: 10 )

Decide whether or not the word babab is generated by the following grammar using CYK algorithm. Show all steps.

S AB | CD | a | b A a B SA C DS D b

Question No: 41 ( Marks: 10 ) Explain the Emptiness Algorithm?

Question No: 1 ( Marks: 1 ) - Please choose one

Page 128: CS402 FULL Material 2011

(a+b)*a(a+b)*b(a+b)* is the RE of language defined over

and one b={a,b} having at least one a ={a,b} having at least one a

True

False

Such a language does not exist

None of these

Question No: 2 ( Marks: 1 ) - Please choose one

Page 129: CS402 FULL Material 2011

If r1 = (aa + bb) and r2 = ( a + b) then the language (a + b)* (aa + bb)* will be generated by

(r2)(r1)

(r1 + r2)*

(r2)*(r1)*

(r1)*

Question No: 3 ( Marks: 1 ) - Please choose one

In FA starting state is represented by a ________ sign.

+

-

*

S

Page 130: CS402 FULL Material 2011

Question No: 4 ( Marks: 1 ) - Please choose one Who did not invent the Turing machine?

Alan Turing

A. M. Turing

Turing

None of these

Question No: 5 ( Marks: 1 ) - Please choose one According to _________ machine, Finite set of states containing exactly one START state and some (may be none) HALT states that cause execution to terminate when the HALT states are entered.

Finite Automata

TG

Turing

Insertion

Question No: 6 ( Marks: 1 ) - Please choose one Can a turing machine's head ever be in the same location in two successive steps?

Yes

Yes but only in finite languages

No

Yes but only in infinite langauges

Question No: 7 ( Marks: 1 ) - Please choose one Examin the following CFG and select the correct choice S AB, A BSB, B CC

C SS

Page 131: CS402 FULL Material 2011
Page 132: CS402 FULL Material 2011

A a|b C b|bb

abb is a word in the corresponding CFL. abb is not the word of corresponding CFL. any word can be accept from the corresponding CFL. Non of these

Question No: 8 ( Marks: 1 ) - Please choose one To determine whether a string is generated by the given CFG

CYK algorithm is used

CIK algorithm is used

CNK algorithm is used

CNM algorithm is used

Question No: 9 ( Marks: 1 ) - Please choose one The process of finding the derivation of word generated by particular grammar is called_____

Processing Parsing Programming Planing

Question No: 10 ( Marks: 1 ) - Please choose one Converting the given CFG in CNF is the first rule of _____

CYK algorithm

CKY algorithm

KYC algorithm

Page 133: CS402 FULL Material 2011

CNK algorithm

Question No: 11 ( Marks: 1 ) - Please choose one Which statement is true?

The PDA must have one accept state

and one reject state The PDA must

have one accept state and two reject

state The PDA must have two accept

state and two reject state There is no

reject state in the PDA.

Question No: 12 ( Marks: 1 ) - Please choose one If a language can be expressed by a regular expression, then its complement cannot be expressed by a regular expression. This statement is:

True

False

Depends on language

None of the given optios

Question No: 13 ( Marks: 1 ) - Please choose one Left hand side of CFG may consist of:

One terminal

More than one terminal

One non-terminal

Terminals and non-terminals

Question No: 14 ( Marks: 1 ) - Please choose one

Page 134: CS402 FULL Material 2011

Choose the correct answer?

The set of input letters and the set of output characters in a Moore machine, may not be same

The set of input letters and the set of output characters in a Moore machine, must be same.

Question No: 15 ( Marks: 1 ) - Please choose one The symbols that can t be replaced by anything are called___

Terminal

Non-Terminal

Production

All of given

Question No: 16 ( Marks: 1 ) - Please choose one +

b(a+b)*a

- a( a+b)* b

+

Above given GTG accepts the language in which strings

Begins and ends with different letters

Begins and ends with same letters

Have length greater than 1

None of these

Question No: 17 ( Marks: 1 ) - Please choose one

Page 135: CS402 FULL Material 2011

If L1 and L2 are two regular languages, then ______ is also regular.

L1 L2

L1 L2

Both L1 L2 , L1 L2

None of the given

Question No: 18 ( Marks: 1 ) - Please choose one If L is a regular language then, Lc is also a _____ language.

Regular

Non-regular

Regular but finite

None of the given

Question No: 19 ( Marks: 1 ) - Please choose one a, b

- b 1 ^ +

Above given structure is a ______________

FA

NFA

NFA - ^

None of these

Question No: 20 ( Marks: 1 ) - Please choose one

Page 136: CS402 FULL Material 2011

a, b

2 b 4+ a

1- a,b b

3 a 5+

Above given TG represents the language____

Begins and ends with same letters

Begins and ends

with different

letters Begins with

a

None of these

Question No: 21 ( Marks: 1 ) - Please choose one A language can be defined through Transition Graph.

False

True

Depends on alphabet

None of these

Question No: 22 ( Marks: 1 ) - Please choose one The word formal in formal languages means

The symbols used have well defined meaning

They are unnecessary, in reality

Only the form of the string of symbols is significant

None of these

Page 137: CS402 FULL Material 2011

Question No: 23 ( Marks: 1 ) - Please choose one Pumping lemma is generally used for proving

A given grammar is regular

A given grammar is not regular

Whether two given regular expressions are equivalent

None of these

Question No: 24 ( Marks: 1 ) - Please choose one Choose the incorrect statements.

A = {an bn | n = 0, 1, 2, 3, } is a regular language

The set of B, consisting of all strings made up of only a s and b s having equal number of a s and b s defines a regular language

L(A*B*) B gives the set of A

None of these

Question No: 25 ( Marks: 1 ) - Please choose one The logic of pumping lemma is a good example of

The divide and conquer technique

Recursion

Iteration

The Pigeon-hole principal

Question No: 26 ( Marks: 1 ) - Please choose one Palindrome can t be recognized by FSM because.

An FSM can t remember arbitrarily large amount of information. Download Latest Papers: http://www.vumonster.com/viewPage.php?ID=Papers

Page 138: CS402 FULL Material 2011

An FSM can t deterministically fix the mid-point

Even if the mid-point is known, an FSM can t find whether the second half of the string matches the first half

All of these

Question No: 27 ( Marks: 1 ) - Please choose one Palindrome can be recognized by FSM because

An FSM can t remember arbitrarily large

amount of information An FSM can t

deterministically fix the mid-point

Even if the mid-point is known, an FSM can t find whether the second half of the string matches the first half

None of these

Question No: 28 ( Marks: 1 ) - Please choose one The FSM in the following picture is a.

Mealy machine

Moore machine

Kleene machine

None of these

Question No: 29 ( Marks: 1 ) - Please choose one Following machine is.

Download Latest Papers: http://www.vumonster.com/viewPage.php?ID=Papers

Page 139: CS402 FULL Material 2011

complement a given bit pattern

generates all strings of 0 s and 1 s

adds 1 to a given bit pattern

none of these

Question No: 30 ( Marks: 1 ) - Please choose one The language all words (made up of a s and b s) with at least two a s can not be described by the regular expression.

a(a+b)*a(a+b)*(a+b)*ab*

(a+b)* ab* a(a+b)*

b*ab* a(a+b)*

none of these

Question No: 31 ( Marks: 1 )

Is the following pairs of regular expressions are equivalent? x+ and x*x+

Question No: 32 ( Marks: 1 ) Can you neglect that the any given Moore machine has an equivalent Mealy machine? Question No: 33 ( Marks: 2 ) What is Lexical Analyzer? Question No: 34 ( Marks: 2 )

Download Latest Papers: http://www.vumonster.com/viewPage.php?ID=Papers

Page 140: CS402 FULL Material 2011

Why we use null string in FA?

Question No: 35 ( Marks: 3 ) Find Pref (Q in R) for:

Q = {01, 10, 11, 011} R = {10011, 100100, 01010, 0111, 010100, 01011}

Question No: 36 ( Marks: 3 ) What does mean the LANGUAGE IS CLOSED? Question No: 37 ( Marks: 3 ) How to differentiate between "wanted" and "unwanted branch"? Question No: 38 ( Marks: 5 ) Give Regular Expressions (REs) for the following languages. i) Let = {a, b, c}; all words that contain at least one double letter in them. ii) Let = {a, b}; having even numbers of a s and even number of b s

Note: Helpful symbol(s): Question No: 39 ( Marks: 5 ) Decide whether or not the following grammer generates any words using Emptyness algorithm discussed in the lectures. Show all steps. S AB

A SB | a B SA | b

Question No: 40 ( Marks: 10 )

Find DFA for the following CFG S bS | aY Y aY | bZ Z aY | bS | ^ Question No: 41 ( Marks: 10 )

Page 141: CS402 FULL Material 2011

Question No: 1 ( Marks: 1 ) - Please choose one

To access the element of two dimensional array we use, ► Single referencing ► Single dereferencing ► Double dereferencing ► Double referencing Question No: 2 ( Marks: 1 ) - Please choose one

setprecision is a parameter less manipulator. ► True ► False Question No: 3 ( Marks: 1 ) - Please choose one

Which of the following is NOT a preprocessor directive? ► #error ► #define ► #line ► #ndefine

Page 142: CS402 FULL Material 2011

Question No: 4 ( Marks: 1 ) - Please choose one

We can use New keyword inside of Class Constructor. ► True ► False Question No: 5 ( Marks: 1 ) - Please choose one

It is possible to return an object from a function through this pointer. ► True ► False Question No: 6 ( Marks: 1 ) - Please choose one

We can change the artiy (Number of operands required) of an operator through operator overloading ► True ► False Question No: 7 ( Marks: 1 ) - Please choose one

new and delete operators cannot be overloaded. ► True ► False Question No: 8 ( Marks: 1 ) - Please choose one

The statement cin.get (); is used to,

Page 143: CS402 FULL Material 2011

► Read a string from keyboard ► Read a character from keyboard ► Read a string from file ► Read a character from file Question No: 9 ( Marks: 1 ) - Please choose one

When an array of object is created dynamically then there is no way to provide parameterized constructors for array of objects. ► True ► False Question No: 10 ( Marks: 1 ) - Please choose one

We can delete an array of objects without specifying [] brackets if a class is not doing dynamic memory allocation internally. ► True ► False Question No: 11 ( Marks: 1 ) - Please choose one

The insertion (<<) and extraction (>>) operators are unary operators. ► True ► False

Page 144: CS402 FULL Material 2011

Question No: 12 ( Marks: 1 ) - Please choose one

What will be the correct syntax for the following function call? float square (int &); ► square (int num); ► square (&num); ► square (num); ► square (*num); Question No: 13 ( Marks: 1 ) - Please choose one

What will be the output of the following code segment? char *x = ”programming” ; cout << *(x+2) << *(x+3) << *(x+5) << *(x+8) ; ► ogai ► ramg ► prgm ► rorm Question No: 14 ( Marks: 1 ) - Please choose one

Page 145: CS402 FULL Material 2011

When an operator function is define as member function then operand on the left side of operator must be an object. ► True ► False Question No: 15 ( Marks: 1 ) - Please choose one

Increment and decrement operators are ______. ► Binary operators ► Unary operators ► Logical operators ► Conditional operators Question No: 16 ( Marks: 1 ) - Please choose one

UNIX has been developed in ________ language. ► JAVA ► B ► C ► FORTRAN Question No: 17 ( Marks: 1 ) - Please choose one

Which of the following is used with bit manipulation? ► Signed integer ► Un-signed integer

Page 146: CS402 FULL Material 2011

► Signed double ► Un-signed double Question No: 18 ( Marks: 1 ) - Please choose one

We want to access array in random order which approach is better? ► Pointers ► Array index ► Both pointers and array index are better ► None of the given options. Question No: 19 ( Marks: 1 ) - Please choose one

Which of the following is the correct C++ syntax to allocate space dynamically for an array of 10 int? ► new int(10) ; ► new int[10] ; ► int new(10) ; ► int new[10]; Question No: 20 ( Marks: 1 ) - Please choose one

Which of the following will be the correct function call for function prototype given below? int func (int &);

Page 147: CS402 FULL Material 2011

► func(int num); ► func(&num); ► func(num); ► func(*num); Question No: 21 ( Marks: 1 ) - Please choose one

For non-member operator function, object on left side of the operator may be ► Object of operator class ► Object of different class ► Built-in data type ► All of the given options Question No: 22 ( Marks: 1 ) - Please choose one

Which of the following object(s) will call the member operator function within the statement given below? obj1=obj2+obj3;

► Object obj1 ► Object obj2 ► Object obj3 ► Any of the object

Page 148: CS402 FULL Material 2011

Question No: 23 ( Marks: 1 ) - Please choose one

The static data members of a class will be ________

► shared by objects ► created for each object ► initialized within class ► initialized within main function Question No: 24 ( Marks: 1 ) - Please choose one

Which of the following is used for allocating space for static variables?

► Heap ► Static storage area ► Free store ► Stack Question No: 25 ( Marks: 1 ) - Please choose one

The default value of a parameter can be provided inside the ________________ ► function prototype ► function definition ► both function prototype or function definition ► none of the given options.

Page 149: CS402 FULL Material 2011

Question No: 26 ( Marks: 1 ) - Please choose one

Initializing the data members in the definition of the class is ___________ ► syntax error ► logical error ► not an error ► none of the given options Question No: 27 ( Marks: 1 ) - Please choose one

It is possible to define a class within another class. ► True ► False Question No: 28 ( Marks: 1 ) - Please choose one

A template function must have ► One or more than one arguments ► Only one argument ► Zero arguments ► None of the given options Question No: 29 ( Marks: 1 ) - Please choose one

Page 150: CS402 FULL Material 2011

Where we can include a header file in the program? ► any where ► in start ► at the end ► none of the given options. Question No: 30 ( Marks: 1 ) - Please choose one

Truth tables are used for analyzing ___________. ► logical expressions ► arithmetic expressions ► both logical and arithmetic expressions ► none of the given options. True or False

1. In a finite language no string is pumpable. True 2. A DFA has infinite number of states. False 3. A DFA can have more than one accepting state. True 4. In DFA all states have same number of transitions. True 5. Every subset of a regular language is regular. False 6. Let L4 = L1L2L3. If L1 and L2 are regular and L3 is not regular, it is possible that L4 is

regular. True 7. In a finite language no string is pumpable. True 8. If A is a nonregular language, then A must be infinite. True 9. Every context-free language has a context-free grammarin Chomsky normal form. True 10. If A is a context-free language, then A must be nonregular. False 11. The class of regular languages is closed under intersection. True 12. If a language A is regular, then it A must be finite. False 13. Every language is Turing-recognizable. False 14. If a language is context-free, then it must be Turing-decidable. True 15. The problem of determining if a context-free grammar generates

the empty language is undecidable. False 16. The problem of determining if a Turing machine recognizes the

empty language is undecidable. True 17. The set of all languages over an alphabet is countable.False 18. There are some languages recognized by a 5-tape, nondetermin-

istic Turing machine that cannot be recognized by a 1-tape, deterministic Turing machine.False

19. The language { 0n1n | 0 ≤ n ≤ 1000 } is regular. True

Page 151: CS402 FULL Material 2011

20. Nonregular languages are recognized by NFAs. False 21. The class of context-free languages is closed under intersection. False 22. A language has a regular expression if and only if it

has an NFA. True 23. The regular expression (01*0 ∪ 1)*0 generates the language

consisting of all strings over {0, 1} having an odd number of 0’s. False

24. If a language A has a PDA, then A is generated by a context-free grammar in Chomsky normal form. True

25. If A is a context-free language and B is a language such that B is a subset of A, then B must be a context-free language. False

26. If a language A has an NFA, then A is nonregular. False 27. The regular expressions (a ∪ b)* and (b*a*)* generate the same language. True 28. If a language A has a regular expression, then it also has a context-free grammar. True

Regular Expressions

Describe the language denoted by the following regular expressions: a) a(a|b)*a The expression denotes the set of all strings of length two or more that start and end with an ‘a’. b) ((e|a)b*)* The expression denotes the set of all strings over the alphabet {a,b}. c) (a|b)*a(a|b)(a|b) The expression denotes the set of all strings of length 3 or more with an ‘a’ in the third position from the right. Ie of form yaxz where y is an arbitrary string , and x and z are single characters. d) a*ba*ba*ba* The expression denotes the set of all strings that contain precisely 3 b’s. e) (aa|bb)*((ab|ba)(aa|bb)*(ab|ba)(aa|bb)*)* The expression denotes the set of all strings of even length. Question # 1 of 10 ( Start time: 05:46:41 PM ) Total Marks: 1 While finding RE corresponding to TG, If TG has more than one start state then Select correct option: Introduce the new start state Eliminate the old start state Replace the old start state with final state Replace the old final state with new start state Question # 2 While finding RE corresponding to TG, we connect the new start state to the old start state by the transition labeled by

Page 152: CS402 FULL Material 2011

Select correct option: a b null string None of the given options Question # 3 of 10 ( Start time: 05:49:03 PM ) Total Marks: 1 Which of the following regular expression represents same language? a. (a+ab)* b. (ba+a)* c. a*(aa*b)* d. (a*b*)* a+b)*a(a+b)*b(a+b)*+ (a+b)*b(a+b)*a(a+b)*. { x}*, { x}+, {a+b}* Select correct option: a and b a and c c and d Question # 4 of 10 ( Start time: 05:50:32 PM ) Total Marks: 1 (a* + b*)* = (a + b)* this expression is __________ Select correct option: True False Question # 5 of 10 ( Start time: 05:51:30 PM ) Total Marks: 1 Let FA3 be an FA corresponding to FA1+FA2, then the initial state of FA3 must correspond to the initial state of Select correct option: FA1 only FA2 only FA1 or FA2 FA1 and FA2 Question # 6 of 10 ( Start time: 05:53:01 PM ) Total Marks: 1 Which of the following statement is NOT true about TG? Select correct option: There exists exactly one path for certain string There may exist more than one paths for certain string There may exist no path for certain string There may be no final state Question # 7 of 10 ( Start time: 05:54:06 PM ) Total Marks: 1 Kleene’s theorem states Select correct option: All representations of a regular language are equivalent. All representations of a context free language are equivalent. All representations of a recursive language are equivalent Finite Automata are less powerful than Pushdown Automata. Question # 8 of 10 (Start time: 05:55:36 PM) Total Marks: 1 What do automata mean? Select correct option:

Page 153: CS402 FULL Material 2011

Something done manually Something done automatically Question # 9 of 10 ( Start time: 05:56:51 PM ) Total Marks: 1 A language accepted by an FA is also accepted by Select correct option: TG only GTG only RE only All of the given Question # 10 of 10 ( Start time: 05:58:16 PM ) Total Marks: 1 If r1 = (aa + bb) and r2 = (a + b) then the language (aa + bb)(a + b) will be generated by Select correct option: (r1)(r2) (r1 + r2) (r2)(r1) (r1)* Question # 4 of 10 ( Start time: 11:16:41 PM ) Total Marks: 1 If r1 = (aa + bb) and r2 = (a + b) then the language (aa + bb)(a + b) will be generated by Question # 5 of 10 ( Start time: 11:17:26 PM ) Total Marks: 1 If S = {aa, bb}, then S* will not contain

Aabbaa Bbaabbbb Aaabbb aabbaaaa Question # 6 of 10 ( Start time: 11:18:55 PM ) Total Marks: 1 Formal is also known as _________

Syntactic language Semantic language Informal language None of these Question # 7 of 10 ( Start time: 11:20:15 PM ) Total Marks: 1 In an FA, when there is no path starting from initial state and ending in final state then that FA

accept null string accept all strings accept all non empty strings does not accept any string Question # 9 of 10 ( Start time: 11:22:33 PM ) Total Marks: 1 FA of EVEN language shows null string when

Initial state is final as well EVEN does not accept null One state is declared null None of the these

Page 154: CS402 FULL Material 2011

Question # 1 of 10 ( Start time: 05:46:41 PM ) Total Marks: 1 While finding RE corresponding to TG, If TG has more than one start state then Select correct option: Introduce the new start state Eliminate the old start state Replace the old start state with final state Replace the old final state with new start state Question # 2 While finding RE corresponding to TG, we connect the new start state to the old start state by the transition labeled by Select correct option: a b null string None of the given options Question # 3 of 10 ( Start time: 05:49:03 PM ) Total Marks: 1 Which of the following regular expression represents same language? a. (a+ab)* b. (ba+a)* c. a*(aa*b)* d. (a*b*)* Select correct option: a and b a and c c and d

Page 155: CS402 FULL Material 2011

Question # 4 of 10 ( Start time: 05:50:32 PM ) Total Marks: 1 (a* + b*)* = (a + b)* this expression is __________ Select correct option: True False Question # 5 of 10 ( Start time: 05:51:30 PM ) Total Marks: 1 Let FA3 be an FA corresponding to FA1+FA2, then the initial state of FA3 must correspond to the initial state of Select correct option: FA1 only FA2 only FA1 or FA2 FA1 and FA2 Question # 6 of 10 ( Start time: 05:53:01 PM ) Total Marks: 1 Which of the following statement is NOT true about TG? Select correct option: There exists exactly one path for certain string There may exist more than one paths for certain string There may exist no path for certain string There may be no final state Question # 7 of 10 ( Start time: 05:54:06 PM ) Total Marks: 1 Kleene’s theorem states Select correct option: All representations of a regular language are equivalent. All representations of a context free language are equivalent. All representations of a recursive language are equivalent Finite Automata are less powerful than Pushdown Automata. Question # 8 of 10 ( Start time: 05:55:36 PM ) Total Marks: 1 What do automata mean? Select correct option: Something done manually Something done automatically Question # 9 of 10 ( Start time: 05:56:51 PM ) Total Marks: 1 A language accepted by an FA is also accepted by Select correct option: TG only GTG only RE only All of the given Question # 10 of 10 ( Start time: 05:58:16 PM ) Total Marks: 1 If r1 = (aa + bb) and r2 = (a + b) then the language (aa + bb)(a + b) will be generated by Select correct option: (r1)(r2) (r1 + r2)

Page 156: CS402 FULL Material 2011

(r2)(r1) (r1)* Quiz Start Time: 06:37 AM Time Left 19 sec(s) Question # 1 of 10 ( Start time: 06:37:52 AM ) Total Marks: 1 While finding RE corresponding to TG, If TG has more than one final state then Select correct option: Introduce the new final state Eliminate the old final state Replace the old final state with start state Replace the old final state with new start state Quiz Start Time: 06:37 AM Time Left 60 sec(s) Question # 2 of 10 ( Start time: 06:39:16 AM ) Total Marks: 1 If two RE’s generate same language then these RE’s are called Select correct option: Same RE Equal RE Similar RE Equivalent RE Quiz Start Time: 06:37 AM Time Left 28 sec(s) Question # 3 of 10 ( Start time: 06:39:53 AM ) Total Marks: 1 Which of the following statement is NOT true? Select correct option: FA can be considered to be an NFA FA can be considered to be an NFA with null string NFA can be considered to be an TG TG can be considered to be an NFA Quiz Start Time: 06:37 AM Time Left 82 sec(s) Question # 4 of 10 ( Start time: 06:41:17 AM ) Total Marks: 1 Two FAs are said to be equivalent, if they Select correct option: accept null string accept same language accept different language none of the given options Quiz Start Time: 06:37 AM Time Left 77 sec(s) Question # 5 of 10 ( Start time: 06:41:34 AM ) Total Marks: 1 The language having even number of a’s and even number of b’s defined over S = {a, b} is called Select correct option: EVEN-EVEN

Page 157: CS402 FULL Material 2011

ODD-ODD PALINDROME FACTORIAL Quiz Start Time: 06:37 AM Time Left 72 sec(s) Question # 6 of 10 ( Start time: 06:41:54 AM ) Total Marks: 1 Is the language {a ab aba bab} regular? Select correct option: Yes No Quiz Start Time: 06:37 AM Time Left 41 sec(s) Question # 7 of 10 ( Start time: 06:42:18 AM ) Total Marks: 1 Let FA3 be an FA corresponding to FA1+FA2, then the initial state of FA3 must correspond to the initial state of Select correct option: FA1 only FA2 only FA1 or FA2 FA1 and FA2 Quiz Start Time: 06:37 AM Time Left 69 sec(s) Question # 8 of 10 ( Start time: 06:43:21 AM ) Total Marks: 1 According to theory of automata there are _________ types of languages Select correct option: One Two Three Four Quiz Start Time: 06:37 AM Time Left 32 sec(s) Question # 9 of 10 ( Start time: 06:43:47 AM ) Total Marks: 1 What is false about the term alphabet? Select correct option: It is a finite set of symbols. It is usually denoted by Greek letter sigma It can be an empty set. Strings are made up of its elements. Quiz Start Time: 06:37 AM Time Left 38 sec(s) Question # 10 of 10 ( Start time: 06:44:54 AM ) Total Marks: 1 Every FA is a TG. Select correct option: True False

Page 158: CS402 FULL Material 2011
Page 159: CS402 FULL Material 2011
Page 160: CS402 FULL Material 2011

1*(1 + ) = 1* this statement is True False Sometimes true & sometimes false None of these Question No: 4 ( Marks: 1 ) - Please choose one a*b* = (ab)* this expression is __________ True False Can’t be assumed None of these Question No: 5 ( Marks: 1 ) - Please choose one a,b 2+ 1

a,b Above given FA can be expressed as ________ (a + b)* a* + b* (ab + ba)* None of these If a language is expressed through TG, then that language will have its RE. True False Depends on language None of these Question No: 8 ( Marks: 1 ) - Please choose one In TG there may exist more than one path for certain string. True False Depends on the language None of these Question No: 9 ( Marks: 1 ) - Please choose one In TG there may exist no paths for certain string. True False Depends on the language None of these Question No: 10 ( Marks: 1 ) - Please choose one GTG can have _______________ final state. 0 1 More than 1 All of the given Question No: 12 ( Marks: 1 ) - Please choose one b

Page 161: CS402 FULL Material 2011

–– + a,b Above given TG accepts the language in which all strings Ends in b Begins with b Ends and begins with b None of the given Question No: 14 ( Marks: 1 ) - Please choose one Every FA should be __________ Deterministic Non- Deterministic Deterministic & Non- Deterministic None of these Question No: 15 ( Marks: 1 ) - Please choose one If in an NFA, is allowed to be a label of an edge then that NFA is called _________. Will not remain NFA NFA with NFA with null string Either "NFA with null string" OR "NFA with " Question No: 17 ( Marks: 1 ) In transition diagram of an FA, how can we represent initail and final states? Question No: 18 ( Marks: 1 ) How can we say that two REs are equal? Question No: 19 ( Marks: 2 ) Can you accept the following statement? Or there is a condition to accept it? For every Mealy machine there is a Moore machine that is equivalent to it. Question No: 20 ( Marks: 3 ) Let S be all string of a’s and b’s with odd length. What is S*? Question No: 21 ( Marks: 5 ) Draw FA corresponding to following NFA? a 1- b b a 2 3 4+ Question No: 22 ( Marks: 10 ) Give the recursive deflations for the following languages over the alphabet {a, b}: (i) The language EVENSTRING of all words of even length. (ii) The language ODDSTRING of all words of odd length.

Top of Form

/wEPDwUKMTY2N

Quiz Start Time: 07:38 PM

Question # 1 of 10 ( Start time: 07:38:23 PM ) Total Marks: 1 Left hand Side of a Production in CFG may consist of ________

Select correct option:

Exactly one Nonterminal

Page 162: CS402 FULL Material 2011

More than one Nonterminals

Exactly one Terminals

More than one Terminals

Top of Form

/wEPDwUKMTY2N

Question # 2 of 10 ( Start time: 07:39:57 PM ) Total Marks: 1 Given a PDA that accepts the language L ______

Select correct option:

There exists a CFG that generates exactly L

There does not exist any CFG that generates exactly L

that PDA will also accept Language L' (complement of L)

None of given options

/wEWBgLtlK62Bw

Bottom of Form /wEWBgKJoZuiDA

Top of Form

/wEPDwUKMTY2N

Question # 3 of 10 ( Start time: 07:41:13 PM ) Total Marks: 1 Answer the following prefix expression is * * + / 6 3 9 + 3 2 1

Select correct option:

60

55

110

70

/wEWBgK3ruImAr

Top of Form

/wEPDwUKMTY2N

Page 163: CS402 FULL Material 2011

Question # 4 of 10 ( Start time: 07:42:02 PM ) Total Marks: 1 The PDA is called non-deterministic PDA when there are more than one out going edges from……… state

Select correct option:

START or READ

POP or REJECT

READ or POP

PUSH or POP

/wEWBgK39NrvDA

Top of Form

/wEPDwUKMTY2N

Question # 5 of 10 ( Start time: 07:43:34 PM ) Total Marks: 1 The derivation of a word w, generated by a CFG, such that at each step, a production is applied to the left most nonterminal in the working string, is said to be ___________.

Select correct option:

Left most derivation

Right most derivation

Left most Terminal

Right most Terminal

/wEWBgLlu8XcDw

Top of Form

/wEPDwUKMTY2N

Question # 6 of 10 ( Start time: 07:44:36 PM ) Total

Marks: 1

In conversion form of PDA there is no……… state Select correct option:

PUSH

READ

ACCEPT

REJECT

/wEWBgLzu5VsAr

Top of Form

/wEPDwUKMTY2N

Time Left

87 sec(s)

Question # 7 of 10 ( Start time: 07:45:51 PM ) Total Marks: 1

Page 164: CS402 FULL Material 2011

A _________ is the one for which every input string has a unique path through the machine.

Select correct option:

deterministic PDA

nondeterministic PDA

PUSHDOWN store

Input Tape

/wEWBgLo5KLvBA

Top of Form

/wEPDwUKMTY2N

Question # 9 of 10 ( Start time: 07:48:35 PM ) Total Marks: 1 Which of the following states is not part of PDA

Select correct option:

START

ACCEPT

WRTITE

REJECT

/wEWBgKTqtKYAg

Top of Form

/wEPDwUKMTY2N

Question # 10 of 10 ( Start time: 07:49:01 PM ) Total Marks: 1 Before the CFG corresponding to the given PDA is determined, the PDA is converted into the standard form which is called.

Select correct option:

Finite Automaton

Chomsky Normal Form (CNF)

Conversion form

None of given options

/wEWBgL4j6fiAgK

Bottom of Form Bottom of Form Bottom of Form Bottom of Form Bottom of Form Bottom of Form Bottom of Form

Page 165: CS402 FULL Material 2011

Bottom of Form

Top of Form

/wEPDwUKMTY2N

Question # 1 of 10 ( Start time: 10:20:49 PM ) Total Marks: 1 Halt states are

Select correct option:

Start and Accept

Accept and Reject

Start and Reject

Read and Reject

Top of Form

/wEPDwUKMTY2N

Question # 2 of 10 ( Start time: 10:21:30 PM ) Total Marks: 1 The language generated by the CFG is called the language ……by the CFG

Select correct option:

Defined

Derived

Produced

All of the given options

/wEWBgKG/Yz5Dg

Bottom of Form /wEWBgKvkrv/Cw

Top of Form

/wEPDwUKMTY2N

Question # 3 of 10 ( Start time: 10:23:04 PM ) Total Marks: 1 According to Myhill Nerode theorem, if L generates finite no. of classes then L is.......

Select correct option:

Finite

Infinite

Page 166: CS402 FULL Material 2011

Regular

Non regular

/wEWBgKH+qz0A

Top of Form

/wEPDwUKMTY2N

Question # 4 of 10 ( Start time: 10:24:27 PM ) Total Marks: 1 A non regular language can be represented by

Select correct option:

RE

FA

TG

None of the given options

/wEWBgLz/I/UDA

Top of Form

/wEPDwUKMTY2N

Question # 5 of 10 ( Start time: 10:24:51 PM ) Total Marks: 1 The major problem in the earliest computers was

Select correct option:

To store the contents in the registers

To display mathematical formulae

To load the contents from the registers

To calculate the mathematical formula

/wEWBgLC5+yDC

Top of Form

/wEPDwUKMTY2N

Page 167: CS402 FULL Material 2011

Question # 7 of 10 ( Start time: 10:27:11 PM ) Total Marks: 1 In nondeterministic PDA a string is supposed to be accepted, if there exists at least one path traced by the string, leading to ______ state.

Select correct option:

ACCEPT

REJECT

START

READ

Top of Form

/wEPDwUKMTY2N

Top of Form

/wEPDwUKMTY2N

Question # 10 of 10 ( Start time: 10:29:40 PM ) Total Marks: 1 If an FA has N state then it must accept the word of length

Select correct option:

N-1

N+1

N

2N

/wEWBgKkhuq4D

Top of Form

/wEPDwUKMTY2N

Question # 1 of 10 ( Start time: 10:44:30 PM ) Total Marks: 1 PDA stands for ________

Select correct option:

Push and Drop Automaton

Pop and Drop Automaton

Push Down Automaton

None of given options

/wEWBgK70cycBA

Bottom of Form

Page 168: CS402 FULL Material 2011

Top of Form

/wEPDwUKMTY2N

Question # 2 of 10 ( Start time: 10:45:45 PM ) Total Marks: 1 By removing null and unit productions:

Select correct option:

CNF can be converted into CFG

CFG can be converted into CNF

CNF can be converted into TG

None of the given options

/wEWBgL08LHOB

Bottom of Form Top of Form

/wEPDwUKMTY2N

Question # 3 of 10 ( Start time: 10:46:26 PM ) Total Marks: 1 In conversion form of PDA there is no……… state

Select correct option:

PUSH

READ

ACCEPT

REJECT

/wEWBgKf5IKcAw

Bottom of Form Top of Form

/wEPDwUKMTY2N

Question # 4 of 10 ( Start time: 10:46:54 PM ) Total Marks: 1 START, READ, HERE and ACCEPT states are called the ____ of the machine.

Select correct option:

Forks

Plugs

Page 169: CS402 FULL Material 2011

Joints

None of given options

/wEWBgLQhbvrD

Bottom of Form Top of Form

/wEPDwUKMTY2N

Question # 5 of 10 ( Start time: 10:47:29 PM ) Total Marks: 1 In a STACK:

Select correct option:

The element PUSHed first is POPed first

The element PUSHed first is POPed in the last

The element PUSHed in last is POPed in last

None of given options

/wEWBgLr7ZhEAr

Bottom of Form Top of Form

/wEPDwUKMTY2N

Question # 6 of 10 ( Start time: 10:48:44 PM ) Total Marks: 1 The tree which produced all the strings of a language is called

Select correct option:

Derivation tree

Ambiguous tree

Total language tree

Non ambiguous tree

/wEWBgLZ6KnfCQ

Bottom of Form Top of Form

/wEPDwUKMTY2N

Question # 7 of 10 ( Start time: 10:50:06 PM ) Total Marks: 1 The CFG is said to be ambiguous if there exist at least one word of its language that can be generated by the ………… production

Page 170: CS402 FULL Material 2011

trees

Select correct option:

One

Two

More than one

At most one

/wEWBgKm54TfB

Bottom of Form Top of Form

/wEPDwUKMTY2N

Question # 9 of 10 ( Start time: 10:51:43 PM ) Total Marks: 1 A PDA is in conversion form if it fulfills the following condition:

Select correct option:

There is only one ACCEPT state.

There are more than one ACCEPT states

There is only one REJECT state.

Thre are more than one REJECT states

/wEWBgKP89u8D

Bottom of Form Top of Form

/wEPDwUKMTY2N

Question # 10 of 10 ( Start time: 10:52:11 PM ) Total Marks: 1 The derivation of a word w, generated by a CFG, such that at each step, a production is applied to the left most nonterminal in the working string, is said to be ___________.

Select correct option:

Left most derivation

Right most derivation

Left most Terminal

Right most Terminal

/wEWBgLNlvOfBg

Bottom of Form

Page 171: CS402 FULL Material 2011

Bottom of Form

Top of Form

/w EPDw UKMTY2 Question # 5 of 10 ( Start time: 11:06:30 PM )

Total Marks: 1

Identify the FALSE statement about following CFG: S -> SB|AB A -> CC B -> b C -> a

Select correct option:

CFG generates NULL string

CFG is not in CNF

CFG has 8 Nonterminals

All of the given options

Question # 4 of 10 ( Start time: 11:05:39 PM )

Total Marks: 1

Before the CFG corresponding to the given PDA is determined, the PDA is converted into the standard form which is called.

Select correct option:

Finite Automaton

Chomsky Normal Form (CNF)

Conversion form

Page 172: CS402 FULL Material 2011

None of given options

Question # 6 of 10 ( Start time: 11:07:04 PM )

Total Marks: 1

The reverse of the string sbfsbb over { sb, f, b }

Select correct option:

bbsfbs

bsbfsb

sbbfsb

bsfbsb

Question # 3 of 10 ( Start time: 11:04:57 PM )

Total Marks: 1

Two languages are said to belong to same class if they end in the same state when they run over an FA, that state

Select correct option:

Must be final state

May be final state or not

May be start state or not

None of the given option

Question # 9 of 10 ( Start time: 11:04:57 PM )

Total Marks: 1

All languages can be generated by the CFG.

Select correct option:

True

False

Question # 10 of 10 ( Start time: 10:38:00 PM )

Total Marks: 1

The input string is placed, before it runs, in Select correct option:

Page 173: CS402 FULL Material 2011

Stack

Memory

Tape

Ram

Question # 4 of 10 ( Start time: 10:32:44 PM ) Total Marks: 1 In CFG, the symbols that cannot be replaced by anything are called Select correct option:

Terminals

Non terminals

Productions

None of the given options

Quiz Start Time: 10:30 PM Time Left 90

sec(s)

Question # 2 of 10 ( Start time: 10:31:15 PM ) Total Marks: 1 If L1 and L2 are regular languages then which statement is NOT true?

Select correct option:

L1 + L2 is always regular

L1 L2 is always regular

L1/L2 is always regular

L1* is always regular

Time Left 90

sec(s)

Question # 3 of 10 ( Start time: 10:31:31 PM ) Total Marks: 1

uced all the strings of a language is called

Select correct option:

Page 174: CS402 FULL Material 2011

Derivation tree

Ambiguous tree

Total language tree

Non ambiguous tree

Question # 8 of 10 ( Start time: 10:35:28 PM ) Total Marks: 1

The part of an FA, where the input string is placed before it is run, is called _______

Select correct option:

State

Transition

Input Tape

Output Tape

Question # 1 of 10 ( Start time: 10:30:58 PM ) Total Marks: 1

By removing null and unit productions:

Select correct option:

CNF can be converted into CFG

CFG can be converted into CNF

CNF can be converted into TG

None of the given options

Bottom of Form Top of Form

/wEPDwUKMTY2N

Question # 1 of 10 ( Start time: 07:38:23 PM ) Total Marks: 1 Left hand Side of a Production in CFG may consist of ________

Select correct option:

Exactly one Nonterminal

More than one Nonterminals

Page 175: CS402 FULL Material 2011

Exactly one Terminals

More than one Terminals

Top of Form

/wEPDwUKMTY2N

Question # 2 of 10 ( Start time: 07:39:57 PM ) Total Marks: 1 Given a PDA that accepts the language L ______

Select correct option:

There exists a CFG that generates exactly L

There does not exist any CFG that generates exactly L

that PDA will also accept Language L' (complement of L)

None of given options

/wEWBgLtlK62Bw

Bottom of Form /wEWBgKJoZuiDA

Top of Form

/wEPDwUKMTY2N

Question # 3 of 10 ( Start time: 07:41:13 PM ) Total Marks: 1 Answer the following prefix expression is * * + / 6 3 9 + 3 2 1

Select correct option:

60

55

110

70

/wEWBgK3ruImAr

Top of Form

/wEPDwUKMTY2N

Question # 4 of 10 ( Start time: 07:42:02 PM ) Total Marks: 1 The PDA is called non-deterministic PDA when there are more than one out going edges from……… state

Select correct option:

START or READ

POP or REJECT

READ or POP

PUSH or POP

/wEWBgK39NrvDA

Page 176: CS402 FULL Material 2011

Top of Form

/wEPDwUKMTY2N

Question # 5 of 10 ( Start time: 07:43:34 PM ) Total Marks: 1 The derivation of a word w, generated by a CFG, such that at each step, a production is applied to the left most nonterminal in the working string, is said to be ___________.

Select correct option:

Left most derivation

Right most derivation

Left most Terminal

Right most Terminal

/wEWBgLlu8XcDw

Top of Form

/wEPDwUKMTY2N

Question # 6 of 10 ( Start time: 07:44:36 PM ) Total

Marks: 1

In conversion form of PDA there is no……… state Select correct option:

PUSH

READ

ACCEPT

REJECT

/wEWBgLzu5VsAr

Top of Form

/wEPDwUKMTY2N

Question # 7 of 10 ( Start time: 07:45:51 PM ) Total Marks: 1 A _________ is the one for which every input string has a unique path through the machine.

Select correct option:

deterministic PDA

nondeterministic PDA

PUSHDOWN store

Input Tape

/wEWBgLo5KLvBA

Top of Form

/wEPDwUKMTY2N

Page 177: CS402 FULL Material 2011

Question # 9 of 10 ( Start time: 07:48:35 PM ) Total Marks: 1 Which of the following states is not part of PDA

Select correct option:

START

ACCEPT

WRTITE

REJECT

/wEWBgKTqtKYAg

Top of Form

/wEPDwUKMTY2N

Question # 10 of 10 ( Start time: 07:49:01 PM ) Total Marks: 1 Before the CFG corresponding to the given PDA is determined, the PDA is converted into the standard form which is called.

Select correct option:

Finite Automaton

Chomsky Normal Form (CNF)

Conversion form

None of given options MIDTERM FALL 2010 [email protected] Dated 08-12-2010 (3st session)

CS402 Question No: 1 (Marks: 1) - Please choose one Auto Meta mean • Manual work • Automatic work Question No: 2 (Marks: 1) - Please choose one S= {a,bc,cc} has the latters • 1 • 2 • 3 • 4 Question No: 3 (Marks: 1) - Please choose one S={a,bb,bab,baabb} set of strings then S* will not have • Baba • Baabbab • Bbaaabb • bbbaabaabb(not confirmed)

Page 178: CS402 FULL Material 2011

Question No: 4 (Marks: 1) - Please choose one One language can represents more then one RE. • True • Falss • Can’t be assumed • Non of given Question No: 5 (Marks: 1) - Please choose one

Given GTG has RE • (a+b)* (aa+bb)(a+b)* • None of option Question No: 6 (Marks: 1) - Please choose one

• b • babab • baaab • all NFA accept String Question No:7 (Marks: 1) - Please choose one

• bab • a • aba • a & aba NFA accept String Question No: 8 (Marks: 1) - Please choose one

• (a+b)* • Λ+(a+b)*a • Λ+(a+b)*a* • None of given TG has Question No: 9 (Marks: 1) - Please choose one TG can more then one initial state • True • False

Page 179: CS402 FULL Material 2011

• Depend on alphabets • None of given Question No:10 (Marks: 1) - Please choose one

• (a+b)* • (a+b)*(a*+b*) • None of the given Question No: 11 (Marks: 1) - Please choose one The clouser FA*(on an FA ) always accept _string • Null • aa • bb • None of given Question No: 12 (Marks: 1) - Please choose one In FA final state represent by sign • + • - • = • * Question No: 13 (Marks: 1) - Please choose one RE will be In FA one enter in specific stat but there is no way to leave it then state is called • Dead States • Waste Baskets • Davey John Lockers • All of above Question No: 14 (Marks: 1) - Please choose one Using tree structure final state represent by • * • - • double circle • None of given Question No: 15 (Marks: 1) - Please choose one

• a’s occur only in even clumps and that ends in three or more b’s • length larger then 2 • it does not accept any language • none of given option Question No: 16 (Marks: 1) - Please choose one

Page 180: CS402 FULL Material 2011

• Equal • Not equal • Not valid • None of given These GTG are Question No: 17 (Marks: 1) - Please choose one

to FA will • Equal • Not equal • Not valid • None of given NFA Question No: 18 (Marks: 1) - Please choose one

FA having RE K + a + b + (a+b)*(ab+ba+bb). Question No: 19 (Marks: 1) - Please choose one Question No: 20 (Marks: 1) - Please choose one Question No: 21 (Marks: 2) - Please choose one The language can express in FA then why we need NFA. Justify your answer. Question No: 22 (Marks: 2) - Please choose one

Page 181: CS402 FULL Material 2011

Names of four type of autometa. Question No: 23 (Marks: 3) - Please choose one Check the given statements or correct or not if not then correct it. 1. String in regular language can not be infinite 2. Concatenation of finite letters from alphabets called sigma 3. There cannot be more then on FA,s for same language. Question No: 24 (Marks: 3) - Please choose one How can we know, what language a certain RE represent Question No: 25 (Marks: 5) - Please choose one Explain mealy machine Question No: 26 (Marks: 5) - Please choose one Show the transition table of FA1+FA2

Answer Identify the FALSE statement about following CFG: S -> SB|AB A -> CC B -> b C -> a

Select correct option:

CFG generates NULL string

CFG is not in CNF

CFG has 8 Nonterminals

All of the given options

Question # 3 of 10 ( Start time: 10:44:58 AM ) Total Marks: 1 Answer the following prefix expression is * * + / 6 3 9 + 3 2 1

Select correct option:

60

55

110

Page 182: CS402 FULL Material 2011

70

Question # 4 of 10 ( Start time: 10:46:18 AM ) Total Marks: 1 In new format of an FA (discussed in lecture 37),This state is like a final state of an FA

Select correct option:

ACCEPT

REJECT

START

READ

Question # 5 of 10 ( Start time: 10:47:44 AM ) Total Marks: 1 The CFG which generates the regular language is called

Select correct option:

Regular expression

Finite Automata

Regular grammar

None of the given options

Question # 6 of 10 ( Start time: 10:48:56 AM ) Total Marks: 1 The locations into which we put the input letters on "Input Tap" are called __________

Select correct option:

Page 183: CS402 FULL Material 2011

words

alphabets

cells

elements

Question # 7 of 10 ( Start time: 10:50:24 AM ) Total Marks: 1Given a PDA that accepts the language L ______

Select correct option:

There exists a CFG that generates exactly L

There does not exist any CFG that generates exactly

that PDA will also accept Language L' (complement of

None of given options

Question # 8 of 10 ( Start time: 10:51:20 AM ) Total Marks: 1 Before the CFG corresponding to the given PDA is determined, the PDA is converted into the standard form which is called.

Select correct option:

Finite Automaton

Chomsky Normal Form (CNF)

Page 184: CS402 FULL Material 2011

Conversion form

None of given options

Question # 9 of 10 ( Start time: 10:52:42 AM ) Total Marks: 1 The major problem in the earliest computers was

Select correct option:

To store the contents in the registers

To display mathematical formulae

To load the contents from the registers

To calculate the mathematical formula

Question # 10 of 10 ( Start time: 10:53:33 AM ) Total Marks: 1 Consider the Following CFG: (NOTE: ^ means NULL) S->Xa X->aX|bX|^ above given CFG can be represented by RE _________

Select correct option:

a*b*

a*b*a

(a+b)*a

a(a+b)*a

Quiz No.1 Question # 1 of 10 ( Start time: 06:45:47 PM ) Total Marks: 1

Page 185: CS402 FULL Material 2011

By removing null and unit productions: Select correct option: CNF can be converted into CFG CFG can be converted into CNF CNF can be converted into TG None of the given options Question # 2 of 10 ( Start time: 06:46:29 PM ) Total Marks: 1 Null production is a Select correct option: Word String Terminal All of the given options Question # 3 of 10 ( Start time: 06:47:04 PM ) Total Marks: 1 consider the CFG given below: S->A|bb A->B|b B->S|a Unit Production(s) in above CFG is/are _______ Select correct option: S->A A->B B->S All of given options Question # 4 of 10 ( Start time: 06:48:33 PM ) Total Marks: 1 To write the expression from the tree, it is required to traverse from Select correct option: Top to bottom of the tree Left side of the tree Bottom to top of the tree Right side of the tree Question # 5 of 10 ( Start time: 06:50:02 PM ) Total Marks: 1 If a CFG has a null production, then it is ______ Select correct option: Posiible to construct another CFG without null production accepting the same language with the exception of the word ^ Not possible to construct another CFG without null production accepting the same language with the exception of the word ^ Called NULL CFG Called Chmosky Normal Form (CNF) Question # 6 of 10 ( Start time: 06:51:14 PM ) Total Marks: 1 The tree which produced all the strings of a language is called Select correct option: Derivation tree Ambiguous tree Total language tree Non ambiguous tree Question # 7 of 10 ( Start time: 06:51:39 PM ) Total Marks: 1 A PDA consists of the following: Select correct option: An alphabet (Sigma) of input letters. An input TAPE with infinite many locations in one direction One START state with only one out-edge and no in-edge All of the given options

Page 186: CS402 FULL Material 2011

Question # 8 of 10 ( Start time: 06:52:32 PM ) Total Marks: 1 The derivation of a word w, generated by a CFG, such that at each step, a production is applied to the left most nonterminal in the working string, is said to be ___________. Select correct option: Left most derivation Right most derivation Left most Terminal Right most Terminal Question # 9 of 10 ( Start time: 06:53:06 PM ) Total Marks: 1 A PDA is called nondeterministic PDA if ___________ Select correct option: There are more than one outgoing edges at READ or POP states with one label There are more than one PUSH states There are mroe than one POP states All of the given options Question # 10 of 10 ( Start time: 06:54:18 PM ) Total Marks: 1 In new format of an FA (discussed in lecture 37),This state is like a final state of an FA Select correct option: ACCEPT REJECT START READ Quiz No.2 Question # 1 of 10 ( Start time: 07:16:01 PM ) Total Marks: 1 Identify FALSE statement: Select correct option: Every Regular Expression be expressed by CFG and every CFG can be expressed by a Regular Expression Every regular expression can be expressed as CFG but every CFG cannot be expressed as a regular expression. For a PDA, there exists a CFG, that represents the same language as represented by PDA. None of the given options Question # 2 of 10 ( Start time: 07:17:29 PM ) Total Marks: 1 In a CFG the nonterminal that occurs first from the left in the working string, is said to be ________ Select correct option: Least Significant nonterminal Most Significant nonterminal Left most nonterminal Left most derivate Question # 3 of 10 ( Start time: 07:18:27 PM ) Total Marks: 1 If a CFG has only productions of the form nonterminal -> string of two nonterminals or nonterminal -> one terminal then the CFG is said to be in _________ Select correct option: PDA form Chomsky Normal Form (CNF) NULL able form Unit production form Question # 4 of 10 ( Start time: 07:18:58 PM ) Total Marks: 1

Page 187: CS402 FULL Material 2011

Consider the following CFG: (NOTE: ^ means NULL) S->a|Xb|aYa X->Y|^ Y->b|X Which Nonterminals are nullable Select correct option: S and X X and Y Y and S S,X and Y Question # 5 of 10 ( Start time: 07:20:28 PM ) Total Marks: 1 A PDA is in conversion form if it fulfills the following condition: Select correct option: There is only one ACCEPT state. There are more than one ACCEPT states There is only one REJECT state. Thre are more than one REJECT states Question # 6 of 10 ( Start time: 07:21:02 PM ) Total Marks: 1 The CFG which generates the regular language is called Select correct option: Regular expression Finite Automata Regular grammar None of the given options Question # 7 of 10 ( Start time: 07:22:17 PM ) Total Marks: 1 PDA stands for ________ Select correct option: Push and Drop Automaton Pop and Drop Automaton Push Down Automaton None of given options Question # 8 of 10 ( Start time: 07:22:41 PM ) Total Marks: 1 ___________ states are called the halt states. Select correct option: ACCEPT and REJECT ACCEPT and READ ACCEPT AND START ACCEPT AND WRITE Question # 9 of 10 ( Start time: 07:23:01 PM ) Total Marks: 1 The CFG S --> aSa | bSb | a | b | ^ represents the language Select correct option: EVEN-EVEN PALINDROM EQUAL ODD-ODD Question # 10 of 10 ( Start time: 07:24:34 PM ) Total Marks: 1 which path sequence follows the rules of "conversion form" of "PDA" Select correct option: READ -> POP -> POP POP -> POP -> POP READ -> POP -> PUSH a HERE -> PUSH a -> PUSH a Quiz No.3 Question # 1 of 10 ( Start time: 07:34:23 PM ) Total Marks: 1

Page 188: CS402 FULL Material 2011

Identify the TRUE statement about following CFG: S -> SB|AB A -> CC B -> b C -> a Select correct option: The given CFG has 8 Nonterminals The given CFG has 8 Terminals The given CFG is in CNF The given CFG is not in CNF Question # 2 of 10 ( Start time: 07:35:29 PM ) Total Marks: 1 To write the expression from the tree, it is required to traverse from Select correct option: Top to bottom of the tree Left side of the tree Bottom to top of the tree Right side of the tree Question # 4 of 10 ( Start time: 07:36:26 PM ) Total Marks: 1 A PDA is not in conversion form if ___________ Select correct option: There are more than one ACCEPT states There are more than one REJECT states Every READ or HERE is followed immediately by a PUSH All of given options Question # 5 of 10 ( Start time: 07:37:02 PM ) Total Marks: 1 The PDA is called non-deterministic PDA when there are more than one out going edges from……… state Select correct option: START or READ POP or REJECT READ or POP PUSH or POP Question # 6 of 10 ( Start time: 07:38:12 PM ) Total Marks: 1 In new format of an FA (discussed in lecture 37), This state is like dead-end non final state Select correct option: ACCEPT REJECT START READ Question # 8 of 10 ( Start time: 07:38:50 PM ) Total Marks: 1 Consider the following CFG: (NOTE: ^ means NULL) S->a|Xb|aYa X->Y|^ Y->b|X Which Nonterminal(s) is/are NOT nullable Select correct option: S X Y S,X and Y Question # 9 of 10 ( Start time: 07:39:57 PM ) Total Marks: 1 The PDA which is in the conversion form can be supposed to be the _________ with path segments in between, similar to a TG. Select correct option: Set of joints Set of Forks Set of Plugs None of given options

Page 189: CS402 FULL Material 2011

(a* + b*)* = (a + b)* this expression is __________ T F If S = { x }, then S* will be {x,xx,xxx,xxxx,…} {^ ,x,xx,xxx,xxxx,…} The states in which there is no way to leave after entry are called Davey John Lockers Dead States Waste Baskets All of the given options If S = {ab, bb}, then S* will not contain Abbbab Bbba ababbb bbbbab According to theory of automata there are _________ types of languages 1 2 3 4 What do automata mean? Something done manually Something done automatically What is false about the term alphabet? It is a finite set of symbols. It is usually denoted by Greek letter sigma It can be an empty set. Strings are made up of its elements Formal is also known as _________ Syntactic language Semantic language Informal language None of these Kleene star closure can be defined Over any set of string Over specific type of string While finding RE corresponding to TG, we connect the new start state to the old start state by the transition labeled by A B null string None of the given options 1) Can we use only the + and – symbols to show the initial and final states of the FA…… Marks2 2) State that the followings are true or false. … Marks2 a. Kleen star and Kleen closure are different. b. Length of the output of the mealy machine is one less than the input string.

Page 190: CS402 FULL Material 2011

3) For mealy machine tell about _, _ and what this machine will do. … Marks3 4) Name the two methods of the Kleen’s theorem part III. … Marks3 5) Explain Moore Machine… Marks5 6) Show that two TG accept the same language of event number of states. … Marks5 an other paper 1) State that the followings are true or false. … Marks2 a. Kleen star and Kleen closure are different. b. Length of the output of the mealy machine is one less than the input string. 2) complement melay machine (tataly) 2marks 3) one similtary and disimilarty in the DFA and FA 4) make the union of the given FAs (from hand out fist example) 5) diffrance between the TG FA and GTG

Formal is known as Syntactic language. length of even even language is always even. While finding RE corresponding to TG we connect the new start state with the old start state by transition labeled by a null string. Question # 1 of 10 ( Start time: 05:46:41 PM ) Total Marks: 1 While finding RE corresponding to TG, If TG has more than one start state then Select correct option: Introduce the new start state Eliminate the old start state Replace the old start state with final state Replace the old final state with new start state Question # 2 While finding RE corresponding to TG, we connect the new start state to the old start state by the transition labeled by

Page 191: CS402 FULL Material 2011

Select correct option: a b null string None of the given options Question # 3 of 10 ( Start time: 05:49:03 PM ) Total Marks: 1 Which of the following regular expression represents same language? a. (a+ab)* b. (ba+a)* c. a*(aa*b)* d. (a*b*)* a+b)*a(a+b)*b(a+b)*+ (a+b)*b(a+b)*a(a+b)*. { x}*, { x}+, {a+b}* Select correct option: a and b a and c c and d Question # 4 of 10 ( Start time: 05:50:32 PM ) Total Marks: 1 (a* + b*)* = (a + b)* this expression is __________ Select correct option: True False Question # 5 of 10 ( Start time: 05:51:30 PM ) Total Marks: 1 Let FA3 be an FA corresponding to FA1+FA2, then the initial state of FA3 must correspond to the initial state of Select correct option: FA1 only FA2 only FA1 or FA2 FA1 and FA2 Question # 6 of 10 ( Start time: 05:53:01 PM ) Total Marks: 1 Which of the following statement is NOT true about TG? Select correct option: There exists exactly one path for certain string There may exist more than one paths for certain string There may exist no path for certain string There may be no final state Question # 7 of 10 ( Start time: 05:54:06 PM ) Total Marks: 1 Kleene’s theorem states Select correct option: All representations of a regular language are equivalent. All representations of a context free language are equivalent. All representations of a recursive language are equivalent Finite Automata are less powerful than Pushdown Automata. Question # 8 of 10 (Start time: 05:55:36 PM) Total Marks: 1 What do automata mean?

Page 192: CS402 FULL Material 2011

Select correct option: Something done manually Something done automatically Question # 9 of 10 ( Start time: 05:56:51 PM ) Total Marks: 1 A language accepted by an FA is also accepted by Select correct option: TG only GTG only RE only All of the given Question # 10 of 10 ( Start time: 05:58:16 PM ) Total Marks: 1 If r1 = (aa + bb) and r2 = (a + b) then the language (aa + bb)(a + b) will be generated by Select correct option: (r1)(r2) (r1 + r2) (r2)(r1) (r1)* Question # 1 of 10 ( Start time: 11:12:33 PM ) Total Marks: 1 Alphabet S = {a, bc, cc} has _______ number of letters

Select correct option:

One

Two

Three

Four

Question # 2 of 10 ( Start time: 11:14:03 PM ) Total Marks: 1 If S = { x }, then S* will be

{x,xx,xxx,xxxx,…} {^ ,x,xx,xxx,xxxx,…}

Question # 3 of 10 ( Start time: 11:15:11 PM ) Total Marks: 1 Length of EVEN-EVEN language is _________

Select correct option:

Page 193: CS402 FULL Material 2011

Even

Odd

Sometimes even & sometimes odd

Such language doesn’t exist

Question # 4 of 10 ( Start time: 11:16:41 PM ) Total Marks: 1 If r1 = (aa + bb) and r2 = (a + b) then the language (aa + bb)(a + b) will be generated by Question # 5 of 10 ( Start time: 11:17:26 PM ) Total Marks: 1 If S = {aa, bb}, then S* will not contain

Aabbaa Bbaabbbb Aaabbb aabbaaaa Question # 6 of 10 ( Start time: 11:18:55 PM ) Total Marks: 1 Formal is also known as _________

Syntactic language Semantic language Informal language None of these Question # 7 of 10 ( Start time: 11:20:15 PM ) Total Marks: 1 In an FA, when there is no path starting from initial state and ending in final state then that FA

accept null string accept all strings accept all non empty strings does not accept any string Question # 9 of 10 ( Start time: 11:22:33 PM ) Total Marks: 1 FA of EVEN language shows null string when

Initial state is final as well EVEN does not accept null One state is declared null None of the these

Page 194: CS402 FULL Material 2011

NEW Modified

CS402-Theory of Automata MCQs Lecture 23- 35 SOLVED By 0300-6986459

21) For a given input, it provides the compliment of Boolean AND output. NAND box (NOT AND) DELAY box OR box AND box

22) It delays the transmission of signal along the wire by one step (clock pulse). NAND box (NOT AND) DELAY box OR box AND box

23) For the given input, it provides the Boolean OR output NAND box (NOT AND) DELAY box OR box AND box

Page 195: CS402 FULL Material 2011

24) For the given input, AND box provides the Boolean AND output.

True False

25) The current in the wire is indicated by 1 and 0 indicates the absence of the current.

True False

26) Any language that can not be expressed by a RE is said to be regular language. True False

27) If L1 and L2 are regular languages is/are also regular language(s). L1 + L2 L1L2 L1* All of above

28) Let L be a language defined over an alphabet Σ, then the language of strings, defined over Σ, not belonging to L, is called Complement of the language L, denoted by Lc or L’.

True False

29) To describe the complement of a language, it is very important to describe the ----------- of that language over which the language is defined.

Alphabet Regular Expression String Word

30) For a certain language L, the complement of Lc is the given language L i.e. (Lc)c = Lc

True False

31) If L is a regular language then, --------- is also a regular language. Lm Ls Lx Lc

32) Converting each of the final states of F to non-final states and old non-final states of F to final states, FA thus obtained will reject every string belonging to L and will accept every string, defined over Σ, not belonging to L. is called

Transition Graph of L Regular expression of L Complement of L Finite Automata of L

33) If L1 and L2 are two regular languages, then L1 U L2 is not a regular. True False

Page 196: CS402 FULL Material 2011

34) De-Morgan's law for sets is expressed by, 1 2 1 2( )c c c c cL L L L∩ = ∩

1 2 1 2( )c c c c cL L L L∩ = ∩

1 2 1 2( )c c cL L L L∩ = ∩

1 2 1 2( )c c cL L L L∩ = ∪ CORRECT

35) If L1 and L2 are regular languages, then these can be expressed by the corresponding FAs.

True False

36) L= language of words containing even number of a’s. Regular Expression is (a+b)*aa(a+b)* (b+ab*a)* a+bb*aab*a (a+b)*ab(a+b)*

37) The regular expression defining the language L1 U L2 can be obtained, converting and reducing the previous ------------- into a ------------ as after eliminating states.

GTG, TG FA, GTG FA, TG TG, RE

38) The language that can be expressed by any regular expression is called a Non regular language.

True False

39) The languages -------------- are the examples of non regular languages. PALINDROME and PRIME PALINDROME and EVEN-EVEN EVEN-EVEN and PRIME FACTORIAL and SQURE

40) Let L be any infinite regular language, defined over an alphabet Σ then there exist three strings x, y and z belonging to Σ* such that all the strings of the form xy zn for n=1,2,3, … are the words in L. called.

Complement of L Pumping Lemma Kleene’s theorem None in given

(21) Languages are proved to be regular or non regular using pumping lemma. True False

Page 197: CS402 FULL Material 2011

(22) ------------------- is obviously infinite language. EQUAL-EQUAL EVEN-EVEN PALINDROME FACTORIAL

(23) If, two strings x and y, defined over Σ, are run over an FA accepting the language L, then x and y are said to belong to the same class if they end in the same state, no matter that state is final or not.

True False

(29) Myhill Nerode theorem is consisting of the followings, L partitions Σ* into distinct classes. If L is regular then, L generates finite number of classes. If L generates finite number of classes then L is regular. All of above

(30) The language Q is said to be quotient of two regular languages P and R, denoted by--- if PQ=R.

R=Q/P Q=R/P Q=P/R P=R/Q

(31) If two languages R and Q are given, then the prefixes of Q in R denoted by Pref(Q in R). True False

(27) Let Q = {aa, abaaabb, bbaaaaa, bbbbbbbbbb} and R = {b, bbbb, bbbaaa, bbbaaaaa} Pref (Q in R) is equal to, {b,bbba,bbbaaa} {b,bba,bbaaa} {ab,bba,bbbaa} {b,bba,bbba}

(32) If R is regular language and Q is any language (regular/ non regular), then Pref (Q in R) is ---------. Non-regular Equal Regular Infinite

(33) "CFG" stands for _________ Context Free Graph Context Free Grammar Context Finite Graph Context Finite Grammar

Page 198: CS402 FULL Material 2011

(29) ___________ states are called the halt states. ACCEPT and REJECT ACCEPT and READ ACCEPT AND START ACCEPT AND WRITE

(30) The part of an FA, where the input string is placed before it is run, is called _______

State Transition Input Tape Output Tape

(35) In new format of an FA (discussed in lecture 37), This state is like dead-end non final state ACCEPT REJECT STATR READ

(36) For language L defined over {a, b}, then L partitions {a, b}* into …… classes Infinite Finite Distinct Non-distinct

(37) The major problem in the earliest computers was To store the contents in the registers To display mathematical formulae To load the contents from the registers To calculate the mathematical formula

(38) Between the two consecutive joints on a path One character can be pushed and one character can be popped Any no. of characters can be pushed and one character can be popped One character can be pushed and any no. of characters can be popped Any no. of characters can be pushed and any no. of characters can be popped

(35) In pumping lemma theorem (x y^n z) the range of n is n=1, 2, 3, 4………. n=0, 1, 2, 3, 4……….

Page 199: CS402 FULL Material 2011

n=…….-3,-2,-1, 0, 1, 2, 3, 4…… n=…….-3,-2,-1, 1, 2, 3, 4……

(36) The PDA is called non-deterministic PDA when there are more than one out going edges from……… state

START or READ POP or REJECT READ or POP PUSH or POP

(49) Identify the TRUE statement:

A PDA is non-deterministic, if there are more than one READ states in PDA A PDA is never non-deterministic Like TG, A PDA can also be non-deterministic A PDA is non-deterministic, if there are more than one REJECT states in PDA

(50) There is a problem in deciding whether a state of FA should be marked or not when the language Q is infinite. True False

(51) If an effectively solvable problem has answered in yes or no, then this solution is called --------- Decision procedure Decision method Decision problem Decision making

(52) The following problem(s) ------------- is/are called decidable problem(s). The two regular expressions define the same language The two FAs are equivalent Both a and b None of given

(53) To examine whether a certain FA accepts any words, it is required to seek the paths from ------- state. Final to initial Final to final Initial to final Initial to initial

(54) The high level language is converted into assembly language codes by a program called compiler. TRUE FALSE

Page 200: CS402 FULL Material 2011

(55) Grammatical rules which involve the meaning of words are called --------------- Semantics Syntactic Both a and b None of given

(56) Grammatical rules which do not involve the meaning of words are called --------------- Semantics Syntactic Both a and b None of given

(57) The symbols that can’t be replaced by anything are called ----------------- Productions Terminals Non-terminals All of above

(58) The symbols that must be replaced by other things are called __________ Productions Terminals Non-terminals None of given

(47) The grammatical rules are often called_____________ Productions Terminals Non-terminals None of given

(59) The terminals are designated by ________ letters, while the non-terminals are designated by ________ letters.

Capital, bold Small, capital Capital, small Small, bold

(60) The language generated by __________ is called Context Free Language (CFL). FA TG CFG TGT

Page 201: CS402 FULL Material 2011

(49) Σ = {a,b} Productions S→XaaX X→aX X→bX X→Λ

This grammar defines the language expressed by___________ (a+b)*aa(a+b)* (a+b)*a(a+b)*a (a+b)*aa(a+b)*aa (a+b)*aba+b)*

(50) S → aXb|b XaX → aX|bX|Λ The given CFG generates the language in

English __________ Beginning and ending in different letters Beginning and ending in same letter Having even-even language None of given

(51) The CFG is not said to be ambiguous if there exists atleast one word of its language that can be generated by the different production trees,

TRUE FALSE

(54) The language generated by that CFG is regular if _________

No terminal → semi word No terminal → word Both a and b None of given

(55) The production of the form no terminal → Λ is said to be null production.

TRUE FALSE

(54) A production is called null able production if it is of the form N → Λ

TRUE FALSE

(55) The productions of the form nonterminal → one nonterminal, is called _________

Null production Unit production Null able production None of given (56) CNF is stands for Context Normal Form

Page 202: CS402 FULL Material 2011

Complete Normal Form Chomsky Normal Form Compared Null Form

FINALTERM EXAMINATION CS402- Theory of Automata (Session - 1)

Question No: 1 ( Marks: 1 ) - Please choose one

If r1 = (aa + bb) and r2 = ( a + b) then the language (aa + bb)(a + b) will be generated by ► (r1)(r2) *► (r1 + r2) ► (r2)(r1) ► (r1)* Question No: 2 ( Marks: 1 ) - Please choose one

“One language can be expressed by more than one FA”. This statement is ______ * ► True ► False ► Some times true & sometimes false ► None of these Question No: 3 ( Marks: 1 ) - Please choose one

Who did not invent the Turing machine? ► Alan Turing *► A. M. Turing ► Turing ► None of these Question No: 4 ( Marks: 1 ) - Please choose one

Which statement is true? *► The tape of turing machine is infinite. ► The tape of turing machine is finite. ► The tape of turing machine is infinite when the language is regular ► The tape of turing machine is finite when the language is nonregular. Question No: 5 ( Marks: 1 ) - Please choose one

A regular language: *► Must be finite ► Must be infinite ► Can be finite or infinite ► Must be finite and cannot be infinite Question No: 6 ( Marks: 1 ) - Please choose one

Every regular expression can be expressed as CFG but every CFG cannot be expressed as a regular expression. This statement is: ► Depends on the language ► None of the given options

Page 203: CS402 FULL Material 2011

*► True ► False Question No: 7 ( Marks: 1 ) - Please choose one

ba

a

X1–

b

X2+

Above given FA corresponds RE r. then FA corresponding to r* will be

a

b

b

z3+

a

z2

z1±

a b

This statement is *► True ► False ► Depends on language ► None of these Question No: 8 ( Marks: 1 ) - Please choose one

Consider the language L of strings, defined over Σ = {a,b}, ending in a ► There are finite many classes generated by L, so L is regular *► There are infinite many classes generated by L, so L is regular ► There are finite many classes generated by L, so L is non-regular ► There are infinite many classes generated by L, so L is non-regular Question No: 9 ( Marks: 1 ) - Please choose one

ab,ba

ab,ba

±

aa,bb aa,bb

Above given TG has _____________ RE. ► (aa+aa+(ab+ab)(aa+ab)*(ab+ba))* *► (aa+bb+(ab+ba)(aa+bb)*(ab+ba))* ► (aa+bb+(ab+ba)(aa+bb)(ab+ba))* ► None of these Question No: 10 ( Marks: 1 ) - Please choose one

Page 204: CS402 FULL Material 2011

The word ‘formal’ in formal languages means *► The symbols used have well defined meaning ► They are unnecessary, in reality ► Only the form of the string of symbols is significant ► None of these Question No: 11 ( Marks: 1 ) - Please choose one

Let A = {0, 1}. The number of possible strings of length ‘n’ that can be formed by the elements of the set A is ► n! *► n2 ► nm ► 2n Question No: 12 ( Marks: 1 ) - Please choose one

Choose the correct statement. ► A Mealy machine generates no language as such ► A Moore machine generates no language as such *► A Mealy machine has no terminal state ► All of these Question No: 13 ( Marks: 1 ) - Please choose one

TM is more powerful than FSM because ► The tape movement is confined to one direction *► It has no finite state control ► It has the capability to remember arbitrary long sequences of input symbols ► None of these Question No: 14 ( Marks: 1 ) - Please choose one

If L1 and L2 are expressed by regular expressions r1 and r2, respectively then the language expressed by r1 + r2 will be _________ * ► Regular ► Ir-regular ► Can’t be decided ► Another Language which is not listed here Question No: 15 ( Marks: 1 ) - Please choose one

Like TG, a PDA can also be non-deterministic ► True *► False Question No: 16 ( Marks: 1 ) - Please choose one

Page 205: CS402 FULL Material 2011

The above machine is a/anTG ___________ ► Finite Automata *► Turing machine ► FA ► TG Question No: 17 ( Marks: 1 ) - Please choose one

The language of all words (made up of a’s and b’s) with at least two a’s can not be described by the regular expression. ► a(a+b)*a(a+b)*(a+b)*ab* ► (a+b)* ab* a(a+b)* ► b*ab* a(a+b)* ► none of these Question No: 18 ( Marks: 1 ) - Please choose one

In FA, if one enters in a specific state but there is no way to leave it, then that specific state is called *► Dead State ► Waste Basket ► Davey John Locker ► All of these Question No: 19 ( Marks: 1 ) - Please choose one

If L is a regular language then, Lc is also a _____ language. *► Regular ► Non-regular ► Regular but finite ► None of the given Question No: 20 ( Marks: 1 ) - Please choose one

In CFG, the symbols that can’t be replaced by anything are called___ ► Terminal ► Non-Terminal *► Production ► All of given Question No: 21 ( Marks: 1 ) - Please choose one

Page 206: CS402 FULL Material 2011

Which of the following is NOT a regular language? ► String of 0’s whose length is a perfect squere *► Set of all palindromes made up of 0’s and 1’s ► String of 0’s whose length is a prime number ► All of the given options Question No: 22 ( Marks: 1 ) - Please choose one

Choose the incorrect (FALSE) statement. ► A Mealy machine generates no language as such ► A Mealy machine has no terminal state *► For a given input string, length of the output string generated by a Moore machine is not more than the length of the output string generated by that of a Mealy machine ► All of these Question No: 23 ( Marks: 1 ) - Please choose one

Pumping lemma is generally used to prove that: ► A given language is infinite *► A given language is not regular ► Whether two given regular expressions of a regular language are equivalent or not ► None of these Question No: 24 ( Marks: 1 ) - Please choose one

Which of the following is a regular language? ► String of odd number of zeroes ► Set of all palindromes made up of 0’s and 1’s *► String of 0’s whose length is a prime number ► All of these Question No: 25 ( Marks: 1 ) - Please choose one

Choose the incorrect statement: ► (a+b)*aa(a+b)* generates Regular language. ► A language consisting of all strings over ∑={a,b} having equal number of a’s and b’s is a regular language ► Every language that can be expressed by FA can also be expressed by RE ► None of these Question No: 26 ( Marks: 1 ) - Please choose one

Left hand side of a production in CFG consists of: ► One terminal ► More than one terminal ► One non-terminal * ► Terminals and non-terminals Question No: 27 ( Marks: 2 )

Page 207: CS402 FULL Material 2011

Diffrentiate between Regular and Non regular languages? Ans: The main difference between regular and non regular language are as: 1. The regular language is that language which can be expressed by RE is known as regular language whereas any language which can not be expressed by RE is known as non regular language. Question No: 28 ( Marks: 2 )

What is meant by a "Transition" in FA? Question No: 29 ( Marks: 2 )

What are the halt states of PDAs? Ans: There are some halts states in PDA which are as:

1. Accept or reject stat is also halt state. 2. Reject state is like dead non final state. 3. Accept state is like final state.

Question No: 30 ( Marks: 2 )

Identify the null productions and nullable productions from the following CFG: S -> ABAB A -> a | /\ B-> b | /\ Question No: 31 ( Marks: 3 )

Describe the POP operation and draw symbol for POP state in context of Push down stack. Question No: 32 ( Marks: 3 )

What does the the following tape of turing machine show?

11 abb b b READ3 READ9

ROW Number

PUSH What

POP What

READ What

TO Where

FROM Where

Ans: Arbitrary Summary Table: The arbitrary summary table shows the trip from READ9 to READ3 does not pop one letter form the STACK it adds two letters to the STACK.

Page 208: CS402 FULL Material 2011

Row11 can be concatenated with some other net style sentences e.g. row11 net(READ3, READ7, a)Net(READ7, READ1, b)Net(READ1, READ8, b) it gives the non terminal Net(READ9, READ8, b), The whole process can be written as: Net(READ9, READ8, b) ?Row11Net(READ3, READ7,a) Net(READ7, READ1, b)Net(READ1, READ8, b) This will be a production in the CFG of the corresponding row language. Question No: 33 ( Marks: 3 )

Find Pref (Q in R) for: Q = {10, 11, 00, 010} R = {01001, 10010, 0110, 10101, 01100, 001010} Question No: 34 ( Marks: 5 )

Consider the Context Free Grammar (CFG)

S à 0AS | 0 A à S1A | SS | 1a

Show that the word 0000100 can be generated by this CFG by showing the whole derivation starting from S Question No: 35 ( Marks: 5 )

Consider the language L which is EVEN-EVEN, defined over Σ = {a,b}. In how many classes does L may partition Σ*. Explain briefly. Question No: 36 ( Marks: 5 )

What are the conditions (any five) that must be met to know that PDA is in conversion form? Ans: Conversion form of PDA: A PDA is in conversion form if it has following conditions: 1. The PDA must begin with the sequence 2. There is only one ACCEPT state. 3. Every edge leading out of any READ or HERE state goes directly into a POP state. 4. There are no REJECT states. 5. All branching, deterministic or nondeterministic occurs at READ or HERE states. 6. The STACK is never popped beneath this $ symbol. 7. No two POPs exist in a row on the same path without a READ or HERE. 8. Right before entering ACCEPT this symbol is popped out and left

Page 209: CS402 FULL Material 2011

/wEWBgL4j6fiAgK

MIDTERM EXAMINATION Spring 2009

CS402- Theory of Automata (Session - 1) Question No: 1 ( Marks: 1 ) - Please choose one Alphabet S = {a,bc,cc} has _______ number of letters. One Two Three Four Question No: 2 ( Marks: 1 ) - Please choose one In which of the following language Rev(s)=s EQUAL INTEGER PALINDROME FACTORIAL Question No: 3 ( Marks: 1 ) - Please choose one If S = {ab, bb}, then S* will not contain abbbab bbba bbbbab ababbb Question No: 4 ( Marks: 1 ) - Please choose one

a,b

1 – 2 +

a,b

Page 210: CS402 FULL Material 2011

Above given FA generates the language having strings of _________ ODD length EVEN length Equal number of a’s and b’s None of these Question No: 5 ( Marks: 1 ) - Please choose one

a+b

a+b aa+bb

- +

Above given GTG accepts the language in which strings Contains double a or double b Contains both a and double b Depends on the alphabet None of these Question No: 6 ( Marks: 1 ) - Please choose one

aa+bb

aa+bb ab+ba

3- 2 1

ab+ba 4+

If above given TG is drawn like aa+bb

3 1 X

-

Page 211: CS402 FULL Material 2011

4 +

Then what will be written in place of X. (ab+ba)(aa+bb)(ba+ab) (ab+ba)(aa+bb)(ab+ba) (ab+ba)(aa+bb)*(ab+ba) (ab+ba)(aa+bb)(ab+ba)* Question No: 7 (Marks: 1) - Please choose one FA3 expresses r1r2. Then initial state of FA3 will consist of Initial state of FA2 Initial state of FA1 Initial states of both FA1 & FA2 Depends on FA’s Question No: 8 ( Marks: 1 ) - Please choose one FA3 expresses r1r2. Then there will be at least one final state of FA3 that consist of final state of FA1 and initial state of FA2. True False Depends on language None of these Question No: 9 ( Marks: 1 ) - Please choose one Two machines are said to be equivalent if they print the same output string when the different input string is run on them True False

Page 212: CS402 FULL Material 2011

Depends on language May be or may not be Question No: 10 ( Marks: 1 ) - Please choose one Running the string abbabbba on this Moore machine. The outputs will be________

b

q1/0 q2 /1 a b

a q0/1 a

b a

q3/1 1 b

b a

2

q3 /0 101111010 01111010 01011110 01010101 Question No: 11 ( Marks: 1 ) - Please choose one

4 a

2 a

a a, b a, b

• 1 – 6+

a,b a,b

Page 213: CS402 FULL Material 2011

o b o b

aaa,bbb

b -

5 3 +

Above given TG’s are ______________. None of these Equivalent Non-equivalent TG’s are not valid Question No: 12 ( Marks: 1 ) - Please choose one TG can have more than one initial state. True False Depends on alphabets None of these Question No: 13 ( Marks: 1 ) - Please choose one

a

a

+

– –

a

b b

b

Above given FA accepts null string. True False

Page 214: CS402 FULL Material 2011

FA is not valid None of these Question No: 14 ( Marks: 1 ) - Please choose one If in an NFA, is allowed to be a label of an edge then that NFA is called _________. Will not remain NFA NFA with NFA with null string Either "NFA with null string" OR "NFA with " Question No: 15 ( Marks: 1 ) - Please choose one One FA has n states and m letters in the alphabet. Then FA will have _____ number of transitions in the diagram. (n)+(m) (m)(n) OR (n)(m) None of the given options (m)-(n) Question No: 16 ( Marks: 1 ) - Please choose one (a+b)*a(a+b)*b(a+b)* is the RE of language defined over S={a,b} having at least one a and one b True False Such a language does not exist None of the given options Question No: 17 ( Marks: 1 ) Is the following statement true? A regular language can not be infinite. Ans : If Regular language is infinite then RE is also infinite it depends on language

Page 215: CS402 FULL Material 2011

Question No: 18 ( Marks: 1 ) Can you say that for a certain string there may be more than one paths in a TG? Ans : TG there is only one certain path state but in GTG there is lot of states and paths Question No: 19 ( Marks: 2 ) If a language can be accepted by an FA then it can be accepted by a TG as well. What are the other two statements of kleenes’s theorem? Ans : TG and FA are same but TG is also considered as FA and FA is also Considered as a TG as well Question No: 20 (Marks: 3 ) Describe the method of NFA corresponding to Concatenation of FAs. Ans : NFA build with FA there is TWO FA concatenate with each other and some useless state can be eliminate then NFA Question No: 21 ( Marks: 5 ) Draw FA corresponding to following NFA?

2

b a

1- 4+

a

b 3

Question No: 22 ( Marks: 10 ) Let L be any language. Let us define the transpose of L to be the language of exactly those words that are the words in L spelled backward. If w L then reverse (w) L. for example, if L = {a, abb, bbaab, bbbaa}Then Transpose (L) = {a, bba, baabb, aabbb, Prove that if there is an FA that accepts L, then there is a TG that accepts the transpose of L.

Automata _______________are conventional names of the command line parameters of the ‘main()’ function. Select correct option:

Page 216: CS402 FULL Material 2011

1. ‘argb’ and ‘argv’ 2. ‘argc’ and ‘argv’ 3. ‘argc’ and ‘argu’ 4. None of the given

In_________, we try to have a precise problem statement Select correct option:

1. Analysis 2. Design 3. Coding 4. None of the given

Pointers are a special type of __________in which a memory address is stored Select correct option:

1. variables 2. Location 3. Characters 4. None of the given

At the design phase, we try to break up the problem into___________ Select correct option:

1. functional units 2. non-functional units 3. small units 4. None of the given

char name [] = “Hello World” ; In the above statement, a memory of _________ characters will be allocated Select correct option:

1. 13

Page 217: CS402 FULL Material 2011

2. 11 3. 12 4. 10

Pointers work by pointing to a particular___________ Select correct option:

1. Value 2. variable 3. data type(doubtful) 4. None of the given

___________ Returns true if c is a digit and false otherwise. Select correct option:

1. int isalpha( int c ) 2. int isalnum( int c ) 3. int isxdigit( int c ) 4. int isdigit( int c )

The ASCHI code of null character is___________ Select correct option:

1. 000 2. 010 3. 111 4. 110

The increment of a pointer depends on its___________. Select correct option:

1. variable 2. value 3. data type

Page 218: CS402 FULL Material 2011

4. None of the given

At the___________, we try to break up the problem into functional units Select correct option:

1. analysis phase 2. design phase 3. Implementation phase 4. None of the given

To get the value stored at a memory address, we use the________________ Select correct option:

1. referencing operator 2. dereferencing operator 3. simple operator 4. None of the given

suppose we have int y[10]; To access the 4th element of the array we write_________ Select correct option:

1. y[4]; 2. y[3]; 3. y[2]; 4. none of given

A character is stored in the memory in _________ Select correct option:

1. byte 2. integer 3. string 4. None of the given

Page 219: CS402 FULL Material 2011

QNo1.What is the difference between the strings and the words of a language?

A string is any combination of the letters of an alphabet where as the words of a language are the strings that are always made according to certain rules used to define that language.

For example if we take

Alphabet Σ = { a , b }

Here a , b are the letters of this alphabet.

As you can see we can make a lot of strings from these letters a and b.

For example

a,b,aa,ab,ba,bb,aaa,aab,aba,baa,............................................................ and so on.

But when we define a language over this alphabet having no a's and only odd number of b's.

Then the words of this language would have only those strings that have only odd number of b's and no a's.

some example words of our defined language are

b , bbb , bbbbb , bbbbbbb ,...................................and so on.

So we can say that all the words are strings but all the strings may not be the words of a language.

So strings are any combination of letters of an alphabet and the words of a language are strings made according to some rule.

QNo.2 What is the difference between an Alphabet and an element of a set. Whether Alphabet is an element of a set or it is a set itself?

An Alphabet is a set in itself. The elements of an Alphabet are called letters .

For example

Binary Alphabet Σ = {0,1}

Here 0,1 are the letters of binary alphabet.

Binary Alphabet is very important because it the Alphabet used by the computer.

Page 220: CS402 FULL Material 2011

Set of Natural Numbers

N={1,2,3,4,5,.........................................}

Here 1,2,3........................................... are the elements of set of Natural Numbers.

QNo.3 What is Null String (Λ) ?

The string with zero occurrences of symbols (letters) from ∑.

It is denoted by (Small Greek letter Lambda) λ or (Capital Greek letter Lambda) Λ, is called an empty string or null string.

The capital lambda will mostly be used to denote the empty string, in further discussion.

QNo.4 What is PALINDROME ?

The language consisting of Λ (Null String) and the strings s defined over an Alphabet Σ such that

Rev(s)=s.

Some example words of this language are

aa

As Rev(aa) = aa

aba

As Rev(aba) = aba

bbb

As Rev(bbb) = bbb

aabaa

As Rev(aabaa) = aabaa

bbbaaabbb

As Rev( bbbaaabbb ) = bbbaaabbb

It is to be noted that the words of PALINDROME are called palindromes.

Page 221: CS402 FULL Material 2011

QNo5.What is the concept of valid and invalid alphabets ?

While defining an alphabet of letters consisting of more than one symbols, no letter should be started with any other the letter of the same alphabet i.e. one letter should not be the prefix of another. However, a letter may be ended in the letter of same alphabet i.e. one letter may be the suffix of another.

Σ= { a , b } ( Valid Alphabet) Σ= { a , b , cd } ( Valid Alphabet) Σ= { a , b , ac } ( Invalid Alphabet)

QNo 6. What is ALGOL ?

ALGOL (ALGOrithmic Language) is one of several high level languages designed specifically for programming scientific computations. It started out in the late 1950's, first formalized in a report titled ALGOL 58, and then progressed through reports ALGOL 60, and ALGOL 68. It was designed by an international committee to be a universal language. Their original conference, which took place in Zurich, was one of the first formal attempts to address the issue of software portability. ALGOL's machine independence permitted the designers to be more creative, but it made implementation much more difficult. Although ALGOL never reached the level of commercial popularity of FORTRAN and COBOL, it is considered the most important language of its era in terms of its influence on later language development. ALGOL’s lexical and syntactic structures became so popular that virtually all languages designed since have been referred to as "ALGOL - like"; that is they have been hierarchical in structure with nesting of both environments and control structures.

QNo 8.What is Non-Determinism and Determinism and what is the difference between them ?

Determinism means that our computational model (machine) knows what to do for every possible inputs. Non determinism our machine may or may not know what it has to do on all possible inputs.

As you can conclude from above definition that Non-Deterministic machine can not be implemented ( used ) on computer unless it is converted in Deterministic machine.

QNo 9. What is meant by equivalent FA's ?

FA's that accept the same set of languages are called Equivalent FA's.

QNo11.Define Kleene Star?

Page 222: CS402 FULL Material 2011

Given Σ, then the Kleene Star Closure of the alphabet Σ, denoted by Σ*, is the collection of all strings defined over Σ, including Λ

It is to be noted that Kleene Star Closure can be defined over any set of strings.

Examples

If Σ = {x}

Then Σ* = {Λ, x, xx, xxx, xxxx, ….}

If Σ = {0,1}

Then Σ* = {Λ, 0, 1, 00, 01, 10, 11, ….}

If Σ = {aaB, c}

Then Σ* = {Λ, aaB, c, aaBaaB, aaBc, caaB, cc, ….}

Note:

Languages generated by Kleene Star Closure of set of strings, are infinite languages. (By infinite language, it is supposed that the language contains infinite many words, each of finite length)

QNo12.Valid/In-Valid alphabets?

Any alphabet is valid if any of its letter does not appear in the start of any other letter otherwise it is invalid.

QNo13.What is Reverse of a string?

Alphabet provides only a set of symbols. A string is a concatenation of these symbols. Reverse of the string means to write the string in reverse order. It has no effect on alphabet. Alphabet will remain same.

QNo14.Differentiate Kleene Star Closure and PLUS?

Given Σ, then the Kleene Star Closure of the alphabet Σ, denoted by Σ*, is the collection of all strings defined over Σ, including Λ.

Plus Operation is same as Kleene Star Closure except that it does not generate Λ (null string), automatically.

You can use other symbol for alphabet but we are mostly use sigma symbol.

Page 223: CS402 FULL Material 2011

QNo15.Define Regular Expression?

Regular Expression is the generalized form of any regular language through which you can construct any string related to that language.

Take an example from your handouts

L1 = {Λ, a, aa, aaa, …} and L2 = {a, aa, aaa, aaaa, …} can simply be expressed by a* and a+, respectively.

so a* and a+ are the generalized form of Languages L1, L2.

And a* and a+ are called the regular expressions (RE) for L1 and L2 respectively.

Bottom of Form Bottom of Form Bottom of Form Bottom of Form Bottom of Form Bottom of Form Bottom of Form Bottom of Form

Time Left 90 sec(s)

Question # 10 of 10 ( Start time: 10:38:00 PM )

Total Marks: 1

The input string is placed, before it runs, in Select correct option:

Stack

Memory

Tape

Ram

Question # 4 of 10 ( Start time: 10:32:44 PM )

Total Marks: 1

In CFG, the symbols that cannot be replaced by anything are called Select correct option:  

Terminals

Page 224: CS402 FULL Material 2011

Non terminals

Productions

None of the given options

Quiz Start Time: 10:30 PM Time Left 90

sec(s)

Question # 2 of 10 ( Start time: 10:31:15 PM )

Total Marks: 1

If L1 and L2 are regular languages then which statement is NOT true?

Select correct option:

L1 + L2 is always regular

L1 L2 is always regular

L1/L2 is always regular

L1* is always regular

Time Left 90

sec(s)

Question # 3 of 10 ( Start time: 10:31:31 PM ) Total Marks: 1

uced all the strings of a language is called

Select correct option:

Derivation tree

Ambiguous tree

Total language tree

Non ambiguous tree

Question # 8 of 10 ( Start time: 10:35:28 PM ) Total Marks: 1

The part of an FA, where the input string is placed before it is run, is called _______

Page 225: CS402 FULL Material 2011

Select correct option:

State

Transition

Input Tape

Output Tape

Question # 1 of 10 ( Start time: 10:30:58 PM ) Total Marks: 1

By removing null and unit productions:

Select correct option:

CNF can be converted into CFG

CFG can be converted into CNF

CNF can be converted into TG

None of the given options

QNo1.What is the difference between the strings and the words of a language?

A string is any combination of the letters of an alphabet where as the words of a language are the strings that are always made according to certain rules used to define that language.

For example if we take

Alphabet Σ = { a , b }

Here a , b are the letters of this alphabet.

As you can see we can make a lot of strings from these letters a and b.

For example

a,b,aa,ab,ba,bb,aaa,aab,aba,baa,............................................................ and so on.

But when we define a language over this alphabet having no a's and only odd number of b's.

Then the words of this language would have only those strings that have only odd number of b's and no a's.

Page 226: CS402 FULL Material 2011

some example words of our defined language are

b , bbb , bbbbb , bbbbbbb ,...................................and so on.

So we can say that all the words are strings but all the strings may not be the words of a language.

So strings are any combination of letters of an alphabet and the words of a language are strings made according to some rule.

QNo.2 What is the difference between an Alphabet and an element of a set. Whether Alphabet is an element of a set or it is a set itself?

An Alphabet is a set in itself. The elements of an Alphabet are called letters .

For example

Binary Alphabet Σ = {0,1}

Here 0,1 are the letters of binary alphabet.

Binary Alphabet is very important because it the Alphabet used by the computer.

Set of Natural Numbers

N={1,2,3,4,5,.........................................}

Here 1,2,3........................................... are the elements of set of Natural Numbers.

QNo.3 What is Null String (Λ) ?

The string with zero occurrences of symbols (letters) from ∑.

It is denoted by (Small Greek letter Lambda) λ or (Capital Greek letter Lambda) Λ, is called an empty string or null string.

The capital lambda will mostly be used to denote the empty string, in further discussion.

QNo.4 What is PALINDROME ?

The language consisting of Λ (Null String) and the strings s defined over an Alphabet Σ such that

Rev(s)=s.

Some example words of this language are

aa

As Rev(aa) = aa

aba

Page 227: CS402 FULL Material 2011

As Rev(aba) = aba

bbb

As Rev(bbb) = bbb

aabaa

As Rev(aabaa) = aabaa

bbbaaabbb

As Rev( bbbaaabbb ) = bbbaaabbb

It is to be noted that the words of PALINDROME are called palindromes.

QNo5.What is the concept of valid and invalid alphabets ?

While defining an alphabet of letters consisting of more than one symbols, no letter should be started with any other the letter of the same alphabet i.e. one letter should not be the prefix of another. However, a letter may be ended in the letter of same alphabet i.e. one letter may be the suffix of another.

Σ= { a , b } ( Valid Alphabet) Σ= { a , b , cd } ( Valid Alphabet) Σ= { a , b , ac } ( Invalid Alphabet)

QNo 6. What is ALGOL ?

ALGOL (ALGOrithmic Language) is one of several high level languages designed specifically for programming scientific computations. It started out in the late 1950's, first formalized in a report titled ALGOL 58, and then progressed through reports ALGOL 60, and ALGOL 68. It was designed by an international committee to be a universal language. Their original conference, which took place in Zurich, was one of the first formal attempts to address the issue of software portability. ALGOL's machine independence permitted the designers to be more creative, but it made implementation much more difficult. Although ALGOL never reached the level of commercial popularity of FORTRAN and COBOL, it is considered the most important language of its era in terms of its influence on later language development. ALGOL’s lexical and syntactic structures became so popular that virtually all languages designed since have been referred to as "ALGOL - like"; that is they have been hierarchical in structure with nesting of both environments and control structures.

QNo7. What are the Sequential Operators?

Sequencing Operators: Sequencing operators a >> b Sequence Match a and b in sequence

a && b Sequential-and Sequential-and. Same as above, match a and b in sequence

Page 228: CS402 FULL Material 2011

a || b Sequential-or Match a or b in sequence

The sequencing operator >> can alternatively be thought of as the sequential-and operator. The expression a && b reads as match a and b in sequence. Continuing this logic, we can also have a sequential-or operator where the expression a || b reads as match a or b and in sequence. That is, if both a and b match, it must be in sequence; this is equivalent to a >> !b | b.

QNo 8.What is Non-Determinism and Determinism and what is the difference between them ?

Determinism means that our computational model (machine) knows what to do for every possible inputs. Non determinism our machine may or may not know what it has to do on all possible inputs.

As you can conclude from above definition that Non-Deterministic machine can not be implemented ( used ) on computer unless it is converted in Deterministic machine.

QNo 9. What is meant by equivalent FA's ?

FA's that accept the same set of languages are called Equivalent FA's.

QNo 10. What is the difference between Palindrome and Reverse function?

It is to be denoted that the words of PALINDROME are called palindromes.

Reverse (w) = w

Example: Σ={a,b},

PALINDROME={Λ , a, b, aa, bb, aaa, aba, bab, bbb, ...}

If a is a word in some language L, then reverse (a) is the same string of letters spelled backwards, called the reverse of a.

e.g

reverse (xxx) = xxx

reverse (623) = 326

reverse (140) = 041

QNo11.Define Kleene Star?

Given Σ, then the Kleene Star Closure of the alphabet Σ, denoted by Σ*, is the collection of all strings defined over Σ, including Λ

It is to be noted that Kleene Star Closure can be defined over any set of strings.

Examples

Page 229: CS402 FULL Material 2011

If Σ = {x}

Then Σ* = {Λ, x, xx, xxx, xxxx, ….}

If Σ = {0,1}

Then Σ* = {Λ, 0, 1, 00, 01, 10, 11, ….}

If Σ = {aaB, c}

Then Σ* = {Λ, aaB, c, aaBaaB, aaBc, caaB, cc, ….}

Note:

Languages generated by Kleene Star Closure of set of strings, are infinite languages. (By infinite language, it is supposed that the language contains infinite many words, each of finite length)

QNo12.Valid/In-Valid alphabets?

Any alphabet is valid if any of its letter does not appear in the start of any other letter otherwise it is invalid.

QNo13.What is Reverse of a string?

Alphabet provides only a set of symbols. A string is a concatenation of these symbols. Reverse of the string means to write the string in reverse order. It has no effect on alphabet. Alphabet will remain same.

QNo14.Differentiate Kleene Star Closure and PLUS?

Given Σ, then the Kleene Star Closure of the alphabet Σ, denoted by Σ*, is the collection of all strings defined over Σ, including Λ.

Plus Operation is same as Kleene Star Closure except that it does not generate Λ (null string), automatically.

You can use other symbol for alphabet but we are mostly use sigma symbol.

QNo15.Define Regular Expression?

Regular Expression is the generalized form of any regular language through which you can construct any string related to that language.

Take an example from your handouts

L1 = {Λ, a, aa, aaa, …} and L2 = {a, aa, aaa, aaaa, …} can simply be expressed by a* and a+, respectively.

so a* and a+ are the generalized form of Languages L1, L2.

And a* and a+ are called the regular expressions (RE) for L1 and L2 respectively.

Page 230: CS402 FULL Material 2011

Q No.1 What is the concept of FA also known as FSM ( Finite State Machine) ?

FA (Finite Automaton) is a finite state machine that recognizes a regular language. In computer science, a finite-state machine (FSM) or finite-state automaton (FSA) is an abstract machine that has only a finite, constant amount of memory. The internal states of the machine carry no further structure. This kind of model is very widely used in the study of computation and languages.

Q No.2 What is the difference between FA , TG , GTG. ?

In FA we mark transitions with single letter of the given alphabet but in TG transitions can be marked with letters or strings ( combination of letters).

In every FA, every state shows transition for all letters of given alphabet but in any TG it is not necessary to show all transition for all letters of given alphabet. In TG, we may or may not show all letter transitions according to requirement. We can also show transitions on reading any strings in TGs but it is not possible in FA's. In GTG Directed edges connecting some pair of states are labeled with regular expressions . It may be noted that in GTG, the labels of transition edges are corresponding regular expressions. In TG we write strings and in GTG we are bound to write RE. Every FA is also a TG but not every TG is FA.

Q No.3 What is the difference between FA's and TG's .Why we need TG's when we have FA's?

The Transition Graphs (TG) differ from FA in the following areas

TG's are generalizations of FA's.

TG's can change state without an input ( Null transition).

Can read more than one letter (words of the language they are accepting ) along the transition edges at a time.

Can have a regular expression as a edge label.

Can have more then one start state.

We have been given more freedom in TG's. But this freedom is on the cost of more memory and processing power it means that if we implement TG's on computer using some programming language it will need more memory and processing power of computer than used in the implementation of FA's.

Q No.4 What is the concept of the Union of FA's ?

When we take Union of two FA's it means that resultant FA's should accept all the words that were accepted by the two FA's individually. It is like taking union of two sets, the resultant set contain members of both sets.

Page 231: CS402 FULL Material 2011

For example

Let A ={1,3,5,7,9}

and

B = {0,2,4,6,8,10}

then, A U B = { 0,1,2,3,4,5,6,7,8,9,10 }

you can see that A U B contain elements of both sets similar is the case with FA's.

Q No.5 What is the difference between is TG and GTG ?

In TG, there are transitions for the strings. While in GTG, one can write whole RE as a transition from one state to another one.

Q No.6 How one can create RE of a particular language?

First thing about RE and FA is that there is no hard and fast formula or method to generate these. One can generate them by its mental approach. And this mental approach can be acquired through only PRACTICE.

Here are some useful tips to write RE's,

If we have a finite language( language having countable words ) then its RE will not have * in it

e.g.

Let our language consist of the words of length three exactly over alphabet Σ= {a,b}

then it consists of the words

L = {aaa, aab, aba,abb,baa,bab,bba,bbb}.

Its RE can be simply written as

RE = aaa + aab + aba + abb + baa + bab + bba + bbb

which simply means that our language consists of only these words.

So we can make RE for a finite language by writing its all words with + operator between them.

If we have an infinite language, then there will be * in it’s RE.

We should also keep the null string in our mind. If our language generates null string than our RE should also generate it)

For example language having all the words of even length has null string in it as well so we can write its RE as follows

Page 232: CS402 FULL Material 2011

RE = ((a+b)(a+b))*

This RE also generates null string.

If a language generates all strings starting with a. then strings will be of type

a , aa, ab, aab, aaa, aba, abb,….

Here RE should start with ‘a’ and then all strings including null. So this will be (a + b)* and complete RE is a (a+ b)*.

Similarly languages of strings ending in b will have RE (a + b)*b.

Q No.7 What is the diagrammatically difference between FA's and TG's?

The main differences between FA’s and TG’s are as follows

• In FA there can be maximum one initial or starting state while in TG there may be more than one initial state.

• In FA there can be transition for letters only while in TG transitions can be marked with letters or strings as well.

• In FA there must be transition from each state for each letter (deterministic) while in TG there may be no transition for specific letter from a state and there may be more than one path for a string or letter from a state.

Q No.8 What is the corresponding FA for RE =aa((a+b)(a+b))*

RE is aa((a + b)(a + b))*. Its corresponding FA is as follows.

Q No.9 What is difference between FA's and NFA's. Are they opposite to each other ?

FA stands for finite automata while NFA stands for non-deterministic finite automata

In FA there must be a transition for each letter of the alphabet from each state. So in FA number of transitions must be equal to (number of states * number of letter in alphabet).

While in NFA there may be a transition for a letter from a state. In NFA there may be more than one transition for a letter from a state. And finally every FA is an NFA while every NFA may be an FA or not.

Q No.10 Differentiate between (a,b) and (a+b)?

Page 233: CS402 FULL Material 2011

(a, b) = Represents a and b. (a + b) = Represents either a or b.

Q No.1 What is the difference between how’s FA and TG .Why we need TG's when we have FA's?

The Transition Graphs (TG) differ from FA in the following areas

TG's are generalizations of FA's.

TG's can change state without an input ( Null transition).

Can read more than one letter (words of the language they are accepting ) along the transition edges at a time.

Can have a regular expression as a edge label.

Can have more then one start state.

We have been given more freedom in TG's. But this freedom is on the cost of more memory and processing power it means that if we implement TG's on computer using some programming language it will need more memory and processing power of computer than used in the implementation of FA's.

Q No.2 What is the concept of the Union of FA's ?

When we take Union of two FA's it means that resultant FA's should accept all the words that were accepted by the two FA's individually. It is like taking union of two sets the resultant set contain members of both sets.

For example

Let A ={1,3,5,7,9}

and

B = {0,2,4,6,8,10}

then, A U B = { 0,1,2,3,4,5,6,7,8,9,10 }

you can see that A U B contain elements of both sets similar is the case with FA's.

Q No.3 What is the difference between GT and GTG ?

Page 234: CS402 FULL Material 2011

In TG, there are transitions for the strings. While in GTG, one can write whole RE as a transition from one state to another one.

Q No.4 How to create a RE of a particular Language?

Regular expression is used to express the infinite or finite language, these RE are made in such a way that these can generate the strings of that unique language also for the cross check that the defined RE is of a specified language that RE should accept all the string of that language and all language strings should be accepted by that RE.

Q No.5 How diagrams of FA's are created ?

It depends upon the question how many states involve in a FA. There is not any formal procedure to design FA for a language. This ability just improves with time and practice. Every FA is also a TG but not every TG is FA. In every FA, every state shows transition of all letters of given alphabet but in any TG it is not must. In TG, we may or may not show all letters transition according to requirement. We can also show transitions on reading any strings in TGs but it is not possible in FAs.

Q No.6 How one can create RE of a particular language?

First thing about RE and FA is that there is no hard and fast formula or method to generate these. One can generate them by their mental approach. And this mental approach can be acquired through only PRACTICE.

I am giving you few tips. I hope those will help you.

If we have a finite language then it will always be regular and will not have * in RE.

e.g. L={aaa, aba, bb}. L language generates given three strings then its RE will be

(aaa + aba + bb}. So in finite language + of all strings can be it’s RE.

If we have an infinite language, then there will be * in it’s RE.

We should also keep the null string in our mind.

Page 235: CS402 FULL Material 2011

For practice just try to create RE of simple languages. Don’t try to confuse yourself with complex languages.

For example if a language generates all strings starting with a. then strings will be of type

a , aa, ab, aab, aaa, aba, abb,….

Here RE should start with ‘a’ and then all strings including null. So this will be (a + b)* and complete RE is a (a+ b)*.

Similarly languages of strings ending in b will have RE (a + b)*b.

I hope now you will be able to generate the RE of simpler languages. Gradually, increase the complexity of languages to become a perfect in RE’s.

Now as similar to RE, FA of finite language will not have any loop in it.

If language is infinite then there will always be at least one loop in its FA.

From RE, if you want to generate its FA, then first get the smallest strings and generate their FA and then gradually get the strings of bigger length and keep amending the created FA. After some practice, you will be able to generate the FA’s.

And the last thing nobody can do the new task accurately for the first time. Practice is the key to success. In the start you will have lot of mistakes but after practice you will be able to clear all of them.

Q No.7 What is the difference between FA's ,and TG's ?

There are two or three big differences between FA’s and TG’s.

In FA there can be maximum one initial or starting state while in TG there may be more than one initial state.

In FA there can be transition for letters only while in TG transitions from a state to another one can be for strings.

In FA there must be transition from each state for each letter (deterministic) while in TG there may be no transition for specific letter from a state and there may be more than one path for a string or letter from a state.

Q No.8 What is the exact definition of FA ?

Definition:

Page 236: CS402 FULL Material 2011

A Finite automaton (FA), is a collection of the followings

Finite number of states, having one initial and some (maybe none) final states.

Finite set of input letters (Ó) from which input strings are formed.

Finite set of transitions i.e. for each state and for each input letter there is a transition showing how to move from one state to another.

Q No.9 What is the difference between TG and GTG ?

In TG, there are transitions for the strings. While in GTG, one can write whole RE as a transition from one state to another one.

For RE =aa((a+b)(a+b))* what will be its corresponding FA ?

RE is aa((a + b)(a + b))*. Its corresponding FA is as follows.

Q No.10 What is the difference between FA and NFA ?

FA stands for finite automata while NFA stands for non-deterministic finite automata

In FA there must be a transition for each letter of the alphabet from each state. So in FA number of transitions must be equal to (number of states * number of letter in alphabet).

While in NFA there may be a transition for a letter from a state. In NFA there may be more than one transition for a letter from a state. And finally every FA is an NFA while every NFA may be an FA.

Page 237: CS402 FULL Material 2011

FA:

NFA:

Q No.11 What is the method to understanding FA's and NFA's

Firstly we know that an FA is used to describe a language. Now a language consists of strings. FA will describe the specific language only if it accepts all the strings of that particular language and all the strings generated by the FA are in the language. So confirmation is of two ways.

Now, how to traverse the FA. It is very easy. Every FA has one initial state (state with -sign). From every state of FA there is one transition for every letter of the alphabet. Read the string letter by letter and move according to transitions from state to state. If the string ends in the final state (state with a + sign), that particular string will be accepted otherwise rejected.

So, every string ending in final state will be accepted by FA and will be a word of the language.

Page 238: CS402 FULL Material 2011

For NFA, there may be no path or more than one path for a letter from a specific state. As similar to FA just start traversing from the initial state and if the string ends in the final state, it will be accepted.

Remember, as there may be more than one path for a letter from a state. So any path can be used. Goal is to reach the final state. Remaining theory is same to the FA.

Practice is the key to success. Just try simple FA's and NFA's in the start.

Q No 1.What is the concept of Nondeterministic Finite Automaton (NFA) ?

Nondeterminism plays a key role in the theory of computing. A nondeterministic finite state automaton is one in which the current state of the machine and the current input do not uniquely determine the next state. This just means that a number of subsequent states (zero or more) are possible next states of the automaton at every step of a computation.

Of course, nondeterminism is not realistic, because in real life, computers must be deterministic. Still, we can simulate nondeterminism with deterministic programs. Furthermore, as a mathematical tool for understanding computability, nondeterminism is invaluable.

As with deterministic finite state automata, a nondeterministic finite state automaton has five components.

1. a set of states 2. a finite input alphabet from which input strings can be constructed 3. a transition function that describes how the automaton changes states as it

processes an input string 4. a single designated starting state 5. a set of accepting states

The only difference lies in the transition function, which can now target subsets of the states of the automaton rather than a single next state for each state, input pair.

Q No 2. If a language can be expressed in the form of FA than why it is needed to use NFA ?

NFA stands for non-deterministic FA and this sort of structure has relaxation compared with FA. So it is rather more easy to represent a language using NFA.

Page 239: CS402 FULL Material 2011

We have methods to convert NFA into FA's so sometimes it is easier to build NFA of a given language and than convert its NFA into FA using these methods rather than directly building an FA for a language which may be very difficult.

Q No 3.How to made NFA corresponding to the closure of an FA ?

While generating NFA corresponding to closure of an FA one should take care of the null string. Simple way to accept null string is declare initial state, final as well. But in this way a lot of other strings will also be accepted. Therefore, accurate way is draw another state. Declare the new state initial as well as final. Connect the new state with the states originally connected with the old start state with the same transitions as the old start state. Newly drawn diagram will be an NFA representing the language closure of the given FA

Q No 4.What is the difference between Union of two FA’s , Concatenation of two FA’s and closure of two FA’s ?

Consider two FA's given below

Page 240: CS402 FULL Material 2011

Here FA1 accepts all strings ending in a and FA2 accepts all strings ending b.

An FA corresponding to FA1UFA2 will accept all the strings ending in a or ending in b. for example, aba,bbaaab,bbb

An FA corresponding to FA1FA2 will accept all the strings whose first substring belongs to FA1 and second substring belongs to FA2. for example, ababab, bbabbb.

An FA corresponding to FA1* will accepts all the strings of FA1 including null string. if FA1 represents RE r1 then FA1* will correspond to RE r1*.

(NFA) : An NFA is a TG with a unique start state and a property of having single letter as label of transitions. An NFA is a collection of three things 1) Finite many states with one initial and some final states 2) Finite set of input letters, say, S = {a, b, c} 3) Finite set of transitions, showing where to move if a letter is input at

certain state (Ù is not a valid transition), there may be more than one transition for certain letters and there may not be any transition for certain letters.

A Mealy machine consists of the following 1. A finite set of states q0, q1, q2, … where q0 is the initial state. 2. An alphabet of letters � = {a,b,c,…} from which the input strings are formed. 3. An alphabet G={x,y,z,…} of output characters from which output strings are

generated. 4. A pictorial representation with states and directed edges labeled by an input letter

along with an output character. The directed edges also show how to go from one state to another corresponding to every possible input letter.

(It is not possible to give transition table in this case.)

Page 241: CS402 FULL Material 2011

Note

It is to be noted that since, similar to Moore machine, in Mealy machine no state is designated to be a final state, so there is no question of accepting any language by Mealy machine. However in some cases the relation between an input string and the corresponding output string may be identified by the Mealy machine. Moreover, the state to be initial is not important as if the machine is used several times and is restarted after some time, the machine will be started from the state where it was left off.

Automata Theory by Muhammad Ishfaq FAQ's about Lectures 1 to 5 QNo1.What is the difference between the strings and the words of a language? QNo.2 What is the difference between an Alphabet and an element of a set . Whether Alphabet is an element of a set or it is a set itself ? QNo.3 What is Null String (Λ) ? QNo.4 What is PALINDROME ? QNo5.What is the concept of valid and invalid alphabets ? QNo 6. What is ALGOL ? QNo7. What are the Sequential Operators? QNo 8.What is Non-Determinism and Determinism and what is the difference between them ?QNo 9. What is meant by equivalent FA's ? QNo 10. What is the difference between Palindrome and Reverse function? QNo11.Define Kleene Star? QNo12.Valid/In-Valid alphabets? QNo13.What is Reverse of a string? QNo14.Differentiate Kleene Star Closure and PLUS? QNo15.Define Regular Expression? QNo1.What is the difference between the strings and the words of a language? A string is any combination of the letters of an alphabet where as the words of a language are the strings that are always made according to certain rules used to define that language. For example if we take Alphabet Σ = { a , b } Here a , b are the letters of this alphabet. As you can see we can make a lot of strings from these letters a and b. For example a,b,aa,ab,ba,bb,aaa,aab,aba,baa,............................................................ and so on. But when we define a language over this alphabet having no a's and only odd number of b's. Then the words of this language would have only those strings that have only odd number of b's and no a's. some example words of our defined language are b , bbb , bbbbb , bbbbbbb ,...................................and so on. So we can say that all the words are strings but all the strings may not be the words of a language. So strings are any combination of letters of an alphabet and the words of a language are strings madeaccording to some rule.

Page 242: CS402 FULL Material 2011

QNo.2 What is the difference between an Alphabet and an element of a set. Whether Alphabet is an element of a set or it is a set itself? An Alphabet is a set in itself. The elements of an Alphabet are called letters . For example Binary Alphabet Σ = {0,1} Here 0,1 are the letters of binary alphabet. Binary Alphabet is very important because it the Alphabet used by the computer. Set of Natural Numbers N={1,2,3,4,5,.........................................} Here 1,2,3........................................... are the elements of set of Natural Numbers. QNo.3 What is Null String (Λ) ? The string with zero occurrences of symbols (letters) from Σ. It is denoted by (Small Greek letter Lambda) λ or (Capital Greek letter Lambda) Λ, is called an empty string or null string. The capital lambda will mostly be used to denote the empty string, in further discussion. QNo.4 What is PALINDROME ? The language consisting of Λ (Null String) and the strings s defined over an Alphabet Σ such that Rev(s)=s. Some example words of this language are aa As Rev(aa) = aa aba As Rev(aba) = aba bbb As Rev(bbb) = bbb aabaa As Rev(aabaa) = aabaa bbbaaabbb As Rev( bbbaaabbb ) = bbbaaabbb It is to be noted that the words of PALINDROME are called palindromes. QNo5.What is the concept of valid and invalid alphabets ? While defining an alphabet of letters consisting of more than one symbols, no letter should be started with any other the letter of the same alphabet i.e. one letter should not be the prefix of another. However, a letter may be ended in the letter of same alphabet i.e. one letter may be the suffix of another. Σ= { a , b } ( Valid Alphabet) Σ= { a , b , cd } ( Valid Alphabet) Σ= { a , b , ac } ( Invalid Alphabet) QNo 6. What is ALGOL ? ALGOL (ALGOrithmic Language) is one of several high level languages designed specifically for programming scientific computations. It started out in the late 1950's, first formalized in a report titled ALGOL 58, and then progressed through reports ALGOL 60, and ALGOL 68. It was designed by aninternational committee to be a universal language. Their original conference, which took place in Zurich, was one of the first formal attempts to address the issue of software portability. ALGOL's machine independence permitted the designers to be more creative, but it made implementation much more difficult. Although ALGOL never reached the level of commercial popularity of FORTRAN and COBOL, it is

Page 243: CS402 FULL Material 2011

considered the most important language of its era in terms of its influence on later language development. ALGOL‟s lexical and syntactic structures became so popular that virtually all languages designed since have been referred to as "ALGOL - like"; that is they have been hierarchical in structure with nesting of both environments and control structures. QNo7. What are the Sequential Operators? Sequencing Operators: Sequencing operators a >> b Sequence Match a and b in sequence a && b Sequential-and Sequential-and. Same as above, match a and b in sequence a || b Sequential-or Match a or b in sequence The sequencing operator >> can alternatively be thought of as the sequential-and operator. The expression a && b reads as match a and b in sequence. Continuing this logic, we can also have a sequential-or operator where the expression a || b reads as match a or b and in sequence. That is, if both a and b match, it must be in sequence; this is equivalent to a >> !b | b. QNo 8.What is Non-Determinism and Determinism and what is the difference between them ?Determinism means that our computational model (machine) knows what to do for every possible inputs. Non determinism our machine may or may not know what it has to do on all possible inputs. As you can conclude from above definition that Non-Deterministic machine can not be implemented ( used ) on computer unless it is converted in Deterministic machine. QNo 9. What is meant by equivalent FA's ? FA's that accept the same set of languages are called Equivalent FA's. QNo 10. What is the difference between Palindrome and Reverse function? It is to be denoted that the words of PALINDROME are called palindromes. Reverse (w) = w Example: Σ={a,b}, PALINDROME={Λ , a, b, aa, bb, aaa, aba, bab, bbb, ...} If a is a word in some language L, then reverse (a) is the same string of letters spelled backwards, called the reverse of a. e.g reverse (xxx) = xxx reverse (623) = 326 reverse (140) = 041 QNo11.Define Kleene Star? Given Σ, then the Kleene Star Closure of the alphabet Σ, denoted by Σ*, is the collection of all strings defined over Σ, including Λ It is to be noted that Kleene Star Closure can be defined over any set of strings. Examples If Σ = {x} Then Σ* = {Λ, x, xx, xxx, xxxx, ….} If Σ = {0,1}

Page 244: CS402 FULL Material 2011

Then Σ* = {Λ, 0, 1, 00, 01, 10, 11, ….} If Σ = {aaB, c} Then Σ* = {Λ, aaB, c, aaBaaB, aaBc, caaB, cc, ….} Note: Languages generated by Kleene Star Closure of set of strings, are infinite languages. (By infinite language, it is supposed that the language contains infinite many words, each of finite length) QNo12.Valid/In-Valid alphabets? Any alphabet is valid if any of its letter does not appear in the start of any other letter otherwise it is invalid. QNo13.What is Reverse of a string? Alphabet provides only a set of symbols. A string is a concatenation of these symbols. Reverse of the string means to write the string in reverse order. It has no effect on alphabet. Alphabet will remain same. QNo14.Differentiate Kleene Star Closure and PLUS? Given Σ, then the Kleene Star Closure of the alphabet Σ, denoted by Σ*, is the collection of all strings defined over Σ, including Λ. Plus Operation is same as Kleene Star Closure except that it does not generate Λ (null string), automatically. You can use other symbol for alphabet but we are mostly use sigma symbol. QNo15.Define Regular Expression? Regular Expression is the generalized form of any regular language through which you can construct any string related to that language. Take an example from your handouts L1 = {Λ, a, aa, aaa, …} and L2 = {a, aa, aaa, aaaa, …} can simply be expressed by a* and a+, respectively. so a* and a+ are the generalized form of Languages L1, L2.

And a* and a+ are called the regular expressions (RE) for L1 and L2 respectively. Question: FAQ's about Lectures 6 to 10

Answer: Automata Theory FAQ's about Lectures 6 to 10 Q No.1 What is the concept of FA also known as FSM ( Finite State Machine) ? Q No.2 What is the difference between FA , TG , GTG. ? Q No.3 What is the difference between FA's and TG's .Why we need TG's when we have FA's? Q No.4 What is the concept of the Union of FA's ? Q No.5 What is the difference between is TG and GTG ? Q No.6 How one can create RE of a particular language? Q No.7 What is the diagrammatically difference between FA's and TG's? Q No.8 What is the corresponding FA for RE = aa((a+b)(a+b))* Q No.9 What is difference between FA's and NFA's. Are they opposite to each other ? Q No.10 Differentiate between (a,b) and (a+b)? Q No.1 What is the concept of FA also known as FSM ( Finite State Machine) ? FA (Finite Automaton) is a finite state machine that recognizes a regular language. In computer science, a finite-state machine (FSM) or finite-state automaton (FSA) is an abstract machine that has only a finite, constant amount of memory. The internal states of the machine carry no further structure. This kind of model is very widely used in the study of computation and languages. Q No.2 What is the difference between FA , TG , GTG. ? In FA we mark transitions with single letter of the given alphabet but in TG transitions can be

Page 245: CS402 FULL Material 2011

marked with letters or strings ( combination of letters). In every FA, every state shows transition for all letters of given alphabet but in any TG it is not necessary to show all transition for all letters of given alphabet. In TG, we may or may not show all letter transitions according to requirement. We can also show transitions on reading any strings in TGs but it is not possible in FA's. In GTG Directed edges connecting some pair of states are labeled with regular expressions . It may be noted that in GTG, the labels of transition edges are corresponding regular expressions. In TG we write strings and in GTG we are bound to write RE. Every FA is also a TG but not every TG is FA. Q No.3 What is the difference between FA's and TG's .Why we need TG's when we have FA's? The Transition Graphs (TG) differ from FA in the following areas TG's are generalizations of FA's. TG's can change state without an input ( Null transition). Can read more than one letter (words of the language they are accepting ) along the transition edges at a time. Can have a regular expression as a edge label. Can have more then one start state. We have been given more freedom in TG's. But this freedom is on the cost of more memory and processing power it means that if we implement TG's on computer using some programming language it will need more memory and processing power of computer than used in the implementation of FA's. Q No.4 What is the concept of the Union of FA's ? When we take Union of two FA's it means that resultant FA's should accept all the words that were accepted by the two FA's individually. It is like taking union of two sets, the resultant set contain members of both sets. For example Let A ={1,3,5,7,9} and B = {0,2,4,6,8,10} then, A U B = { 0,1,2,3,4,5,6,7,8,9,10 } you can see that A U B contain elements of both sets similar is the case with FA's. Q No.5 What is the difference between is TG and GTG ? In TG, there are transitions for the strings. While in GTG, one can write whole RE as a transition from one state to another one. Q No.6 How one can create RE of a particular language? First thing about RE and FA is that there is no hard and fast formula or method to generate these. One can generate them by its mental approach. And this mental approach can be acquired through only PRACTICE. Here are some useful tips to write RE's, If we have a finite language( language having countable words ) then its RE will not have * in it e.g. Let our language consist of the words of length three exactly over alphabet Σ= {a,b} then it consists of the words L = {aaa, aab, aba,abb,baa,bab,bba,bbb}. Its RE can be simply written as RE = aaa + aab + aba + abb + baa + bab + bba + bbb which simply means that our language consists of only these words. So we can make RE for a finite language by writing its all words with + operator between them. If we have an infinite language, then there will be * in it‟s RE. We should also keep the null string in our mind. If our language generates null string than our RE should also generate it)

Page 246: CS402 FULL Material 2011

For example language having all the words of even length has null string in it as well so we can write its RE as follows RE = ((a+b)(a+b))* This RE also generates null string. If a language generates all strings starting with a. then strings will be of type a , aa, ab, aab, aaa, aba, abb,…. Here RE should start with „a‟ and then all strings including null. So this will be (a + b)* and complete RE is a (a+ b)*. Similarly languages of strings ending in b will have RE (a + b)*b. Q No.7 What is the diagrammatically difference between FA's and TG's? The main differences between FA‟s and TG‟s are as follows • In FA there can be maximum one initial or starting state while in TG there may be more than one initial state. • _____In FA there can be transition for letters only while in TG transitions can be marked with letters or strings as well. • In FA there must be transition from each state for each letter (deterministic) while in TG there may be no transition for specific letter from a state and there may be more than one path for a string or letter from a state. Q No.8 What is the corresponding FA for RE =aa((a+b)(a+b))* RE is aa((a + b)(a + b))*. Its corresponding FA is as follows. Q No.9 What is difference between FA's and NFA's. Are they opposite to each other ? FA stands for finite automata while NFA stands for non-deterministic finite automata In FA there must be a transition for each letter of the alphabet from each state. So in FA number of transitions must be equal to (number of states * number of letter in alphabet). While in NFA there may be a transition for a letter from a state. In NFA there may be more than one transition for a letter from a state. And finally every FA is an NFA while every NFA may be an FA or not. Q No.10 Differentiate between (a,b) and (a+b)? (a, b) = Represents a and b. (a + b) = Represents either a or b. Question: FAQ's about Lectures 11 to 15

Answer: Automata Theory FAQ's about Lectures 11 to 15 Q No.1 What is the difference between how’s FA and TG .Why we need TG's when we have FA's? Q No.2 What is the concept of the Union of FA's ? Q No.3 What is the difference between GT and GTG ? Q No.4 How to create a RE of a particular Language? Q No.5 How diagrams of FA's are created ? Q No.6 How one can create RE of a particular language? Q No.7 What is the difference between FA's ,and TG's ? Q No.8 What is the exact definition of FA ? Q No.9 What is the difference between TG and GTG ? Q No.10 What is the difference between FA and NFA ? Q No.11 What is the method to understanding FA's and NFA's? Q No.1 What is the difference between how’s FA and TG .Why we need TG's when we have FA's? The Transition Graphs (TG) differ from FA in the following areas TG's are generalizations of FA's. TG's can change state without an input ( Null transition). Can read more than one letter (words of the language they are accepting ) along the transition edges at a time.

Page 247: CS402 FULL Material 2011

Can have a regular expression as a edge label. Can have more then one start state. We have been given more freedom in TG's. But this freedom is on the cost of more memory and processing power it means that if we implement TG's on computer using some programming language it will need more memory and processing power of computer than used in the implementation of FA's. Q No.2 What is the concept of the Union of FA's ? When we take Union of two FA's it means that resultant FA's should accept all the words that were accepted by the two FA's individually. It is like taking union of two sets the resultant set contain members of both sets. For example Let A ={1,3,5,7,9} and B = {0,2,4,6,8,10} then, A U B = { 0,1,2,3,4,5,6,7,8,9,10 } you can see that A U B contain elements of both sets similar is the case with FA's. Q No.3 What is the difference between GT and GTG ? In TG, there are transitions for the strings. While in GTG, one can write whole RE as a transition from one state to another one. Q No.4 How to create a RE of a particular Language? Regular expression is used to express the infinite or finite language, these RE are made in such a way that these can generate the strings of that unique language also for the cross check that the defined RE is of a specified language that RE should accept all the string of that language and all language strings should be accepted by that RE. Q No.5 How diagrams of FA's are created ? It depends upon the question how many states involve in a FA. There is not any formal procedure to design FA for a language. This ability just improves with time and practice. Every FA is also a TG but not every TG is FA. In every FA, every state shows transition of all letters of given alphabet but in any TG it is not must. In TG, we may or may not show all letters transition according to requirement. We can also show transitions on reading any strings in TGs but it is not possible in FAs. Q No.6 How one can create RE of a particular language? First thing about RE and FA is that there is no hard and fast formula or method to generate these. One can generate them by their mental approach. And this mental approach can be acquired through only PRACTICE. I am giving you few tips. I hope those will help you. If we have a finite language then it will always be regular and will not have * in RE. e.g. L={aaa, aba, bb}. L language generates given three strings then its RE will be (aaa + aba + bb}. So in finite language + of all strings can be it‟s RE. If we have an infinite language, then there will be * in it‟s RE. We should also keep the null string in our mind. For practice just try to create RE of simple languages. Don‟t try to confuse yourself with complex languages. For example if a language generates all strings starting with a. then strings will be of type a , aa, ab, aab, aaa, aba, abb,…. Here RE should start with „a‟ and then all strings including null. So this will be (a + b)* and complete RE is a (a+ b)*. Similarly languages of strings ending in b will have RE (a + b)*b. I hope now you will be able to generate the RE of simpler languages. Gradually, increase the complexity of languages to become a perfect in RE‟s. Now as similar to RE, FA of finite language will not have any loop in it. If language is infinite then there will always be at least one loop in its FA. From RE, if you want to generate its FA, then first get the smallest strings and generate their

Page 248: CS402 FULL Material 2011

FA and then gradually get the strings of bigger length and keep amending the created FA. After some practice, you will be able to generate the FA‟s. And the last thing nobody can do the new task accurately for the first time. Practice is the key to success. In the start you will have lot of mistakes but after practice you will be able to clear all of them. Q No.7 What is the difference between FA's ,and TG's ? There are two or three big differences between FA‟s and TG‟s. In FA there can be maximum one initial or starting state while in TG there may be more than one initial state. In FA there can be transition for letters only while in TG transitions from a state to another one can be for strings. In FA there must be transition from each state for each letter (deterministic) while in TG there may be no transition for specific letter from a state and there may be more than one path for a string or letter from a state. Q No.8 What is the exact definition of FA ? Definition: A Finite automaton (FA), is a collection of the followings Finite number of states, having one initial and some (maybe none) final states. Finite set of input letters (Ó) from which input strings are formed. Finite set of transitions i.e. for each state and for each input letter there is a transition showing how to move from one state to another. Q No.9 What is the difference between TG and GTG ? In TG, there are transitions for the strings. While in GTG, one can write whole RE as a transition from one state to another one. For RE =aa((a+b)(a+b))* what will be its corresponding FA ? RE is aa((a + b)(a + b))*. Its corresponding FA is as follows. Q No.10 What is the difference between FA and NFA ? FA stands for finite automata while NFA stands for non-deterministic finite automata In FA there must be a transition for each letter of the alphabet from each state. So in FA number of transitions must be equal to (number of states * number of letter in alphabet). While in NFA there may be a transition for a letter from a state. In NFA there may be more than one transition for a letter from a state. And finally every FA is an NFA while every NFA may be an FA. FA: NFA: Q No.11 What is the method to understanding FA's and NFA's Firstly we know that an FA is used to describe a language. Now a language consists of strings. FA will describe the specific language only if it accepts all the strings of that particular language and all the strings generated by the FA are in the language. So confirmation is of two ways. Now, how to traverse the FA. It is very easy. Every FA has one initial state (state with -sign). From every state of FA there is one transition for every letter of the alphabet. Read the string letter by letter and move according to transitions from state to state. If the string ends in the final state (state with a + sign), that particular string will be accepted otherwise rejected. So, every string ending in final state will be accepted by FA and will be a word of the language. For NFA, there may be no path or more than one path for a letter from a specific state. As similar to FA just start traversing from the initial state and if the string ends in the final state, it will be accepted. Remember, as there may be more than one path for a letter from a state. So any path can be used. Goal is to reach the final state. Remaining theory is same to the FA. Practice is the key to success. Just try simple FA's and NFA's in the start. Question: FAQ's about Lectures 16 to 20

Page 249: CS402 FULL Material 2011

Answer: Automata Theory FAQ's about Lectures 16 to 20 Q No 1. What is the concept of Nondeterministic Finite Automaton (NFA) ? Q No 2. If a language can be expressed in the form of FA than why it is needed to use NFA ? Q No 3 .How to made NFA corresponding to the closure of an FA ? Q No 4 .What is the difference between Union of two FA’s , Concatenation of two FA’s and closure of two FA’s ? Q No 1.What is the concept of Nondeterministic Finite Automaton (NFA) ? Nondeterminism plays a key role in the theory of computing. A nondeterministic finite state automaton is one in which the current state of the machine and the current input do not uniquely determine the next state. This just means that a number of subsequent states (zero or more) are possible next states of the automaton at every step of a computation. Of course, nondeterminism is not realistic, because in real life, computers must be deterministic. Still, we can simulate nondeterminism with deterministic programs. Furthermore, as a mathematical tool for understanding computability, nondeterminism is invaluable. As with deterministic finite state automata, a nondeterministic finite state automaton has five components. 1. a set of states 2. a finite input alphabet from which input strings can be constructed 3. a transition function that describes how the automaton changes states as it processes an input string 4. a single designated starting state 5. a set of accepting states The only difference lies in the transition function, which can now target subsets of the states of the automaton rather than a single next state for each state, input pair. Q No 2. If a language can be expressed in the form of FA than why it is needed to use NFA ? NFA stands for non-deterministic FA and this sort of structure has relaxation compared with FA. So it is rather more easy to represent a language using NFA. We have methods to convert NFA into FA's so sometimes it is easier to build NFA of a given language and than convert its NFA into FA using these methods rather than directly building an FA for a language which may be very difficult. Q No 3.How to made NFA corresponding to the closure of an FA ? While generating NFA corresponding to closure of an FA one should take care of the null string. Simple way to accept null string is declare initial state, final as well. But in this way a lot of other strings will also be accepted. Therefore, accurate way is draw another state. Declare the new state initial as well as final. Connect the new state with the states originally connected with the old start state with the same transitions as the old start state. Newly drawn diagram will be an NFA representing the language closure of the given FA Q No 4.What is the difference between Union of two FA’s , Concatenation of two FA’s and closure of two FA’s ? Consider two FA's given below a a b b a b a

Page 250: CS402 FULL Material 2011

b Y2+ Y1- X2+ X1- FA1 FA2 Here FA1 accepts all strings ending in a and FA2 accepts all strings ending b. An FA corresponding to FA1UFA2 will accept all the strings ending in a or ending in b. for example, aba,bbaaab,bbb An FA corresponding to FA1FA2 will accept all the strings whose first substring belongs to FA1 and second substring belongs to FA2. for example, ababab, bbabbb. An FA corresponding to FA1* will accepts all the strings of FA1 including null string. if FA1 represents RE r1 then FA1* will correspond to RE r1*. Question: FAQ's about Lectures 21 to 25

Answer: Automata Theory FAQ's about Lectures 21 to 25 Q No 1.How Moore and Mealy machine works in Computer Memory what is their importance in Computing ? Q No 2.What is sequential circuit ? Q No 1.How Moore and Mealy machine works in Computer Memory what is their importance in Computing ? Mealy & Moore Machines work in computing as incrementing machine & 1's complement machine etc. These operations as basic computer operations so these machines are very important. Q No 2.What is sequential circuit ? Sequential Circuit: 1. A sequential circuit contains a memory component. 2. The memory component provides a state input. A flip-flop is often used as a memory component. 3. The state variable indicates the states of the sequential machine, i.e. the status or stage or progress of the whole event. 4. The state of a sequential circuit is indicated by the output of a flip-flop. A single flipflop can be used to indicate two states (q=0 and q=1). When there are more than two states, additional flip-flops are used. Given n flip-flops, a total of 2n states can be represented. 5. In other words, a sequential machine can be put into a number of different states depending on the particular inputs given. 6. The output is a function of both the Present Inputs and the Present States. 7. In addition to the outputs, the circuit must also generate an update to the memory components so that the state of the machine can also be changed with respect to the new inputs. The update is called the Next State Function and is also a function of the Present Inputs and the Present States. 8. Both the output functions and the Next State Functions are combinational circuits. Z=f(X,St) S=g(X,St) 9. The superscript t indicates the present time period while the superscript (t+1) indicates the next time period. 10. The characteristic of a sequential circuit is completely defined by a state transition diagram that enumerates all possible transitions for every possible input combination. FAQ's about Lectures 26 to 30

Page 251: CS402 FULL Material 2011

Answer: Automata Theory FAQ's about Lectures 26 to 30 Q No 1.What is the concept of Pumping Lemma I and II and what is the difference between pumping Lemma 1 and pumping Lemma 2 ? Q No 2. What is the significance of Pumping Lemma II ? Q No 3.Moore and Mealy machine? Q No 1.What is the concept of Pumping Lemma I and II and what is the difference between pumping Lemma 1 and pumping Lemma 2 ? In fact PLI & PLII are same (A way to recognize Non Regular language). The only difference is that the conditions in pumping lemma II are more stricter than Pumping Lemma I some language that are difficult to proof Non Regular by Pumping Lemma I are proved Non Regular by pumping Lemma II easily. Further mare in pumping lemma I we have to generate all words to of a language but in Pumping Lemma II we have to generate a single word to prove a language non regular. Explanation: Some languages like PALINDROME that are proved to be regular by first version due to some of their symmetrical words when we pump these words they remain to be the parts of the language like bbabb By pumping lemma 1 Let y = a Now repeating y three times results in bbaaabb That is also a valid word of PALINDROME so by pumping lemma I PALINDROME can not be proved non regular, so there was the need of pumping lemma version version 2. Now consider for the word bbabb if we take N=2 Then by pumping y (let we take it b ) two times results in bbbbabb That word is not in PALINDROME. But if we take N=3 and y = a Then by pumping y two times results in bbaaabb That word is in PALINDROME. So be careful in taking total no of states of the FA and also the repeating factor (y) to prove an infinite language non regular you need to prove only one word that is not part of the language. Q No 2. What is the significance of Pumping Lemma II ? The significance of 2nd version of 'pumping lemma' is that there are some infinite non regular languages like PALINDROME we can built FA that can accept there certain words but if we increase the length of their words that FA don't accept these words so by pumping lemma version I it is very difficult to prove them non regular but with the second version we can prove that a language is Non regular even it's some words may be accepted by some FA's.

Page 252: CS402 FULL Material 2011

See page 195 of the book for further example. Q No 3.Moore and Mealy machine? 1. In order to run a string on a Mealy or Moore machine, you can take directions from transition table. Running string on Mealy or Moore machine is similar to running string on a FA. For example, if want to run abba on the machine, take start from initial state. Check what is the transition for a, what state it goes. After that check what is the path of b from that state and so on. In this way you will be able to run whole of the string. Note that there is no final state in Mealy or Moore machine. So there is no case of acceptance or rejection of string. You just have to determine what the output is. I hope that will clear your mind forfurther clarification please listens to your lecture carefully. 2. The string is taken for the testing purposes. You can take any sort of string and determine its output using machine. Question: FAQ's about Lectures 31 to 35 Answer:

Automata Theory FAQ's about Lectures 31 to 35 Q No 1.What is the difference between semiword and word please also give me any example regarding this? Q No 2.What does mean the LANGUAGE IS CLOSED? Q No 3.What are the Productions? Q No 4.What is the difference between concatenation and intersection of two FA's also what is the difference among Union of two FA's and addition of them? Q No 1.What is the difference between semiword and word please also give an example regarding this? Word: A word is complete combinations of terminals only e.g. abba or ab or a or null string. Semiword: A semiword is a string of terminals (may be none) concatenated with exactly one nonterminal on the right i.e. a semi word, in general, is of the following form (terminal)(terminal) ------------- (terminal)(nonterminal) For example aaaaaaB , aabbaaaA , A. What is the difference between derivation tree and total tree ? A Derivation tree is the one that shows how to derive any specific word of the language described by CFG but Total Language Tree shows all words of the Language described by CFG on it Q No 2.What does mean the LANGUAGE IS CLOSED? When we say that a Language is closed it is always with respect to certain operation. A simple example may be that the set of integers is closed under addition. It means when we take two numbers from set of integers say 3, 7 the result of their addition would also be in the set of integers.

Page 253: CS402 FULL Material 2011

Similarly if the result of an operation on the words of a language results in the word of the same language we say that the language is closed under that operation. Q No 3.What are the Productions? Productions are the grammatical rules and regulations. These rules express the behavior of CFG. Using production in CFG terminals are converted into non-terminals and when all the terminals are converted using productions, a word is acquired. Q No 4.What is the difference between concatenation and intersection of two FA's also what is the difference among Union of two FA's and addition of them? In intersection of two FA's only those strings are accepted which are independently accepted by both FA‟s, while in concatenation of two FA‟s only those strings will be accepted in which first part of string is accepted by first FA and remaining part of string is accepted by the second FA. While taking union of two FA‟s one can represent it using + sign. So (FA1 U FA2) and (FA + FA2) both are same. There is no difference between them. Question: FAQ's about Lectures 36 to 40

Answer: Automata Theory FAQ's about Lectures 36 to 40 Q No 1.What is the Difference between Nullable and Null production? How to make eliminate Nullable and for Null Productions from the CFG ? Q No 2. Is it possible to make CFG for infix and postfix expression's using derivation tree ? Q No 3 what is the uses of push down automata in computing ? Q No 4 What is difference between PUSH DOWN STACK and PUSH DOWN STORE ? Q No 5 How we can distinguish between "CFG" and "CNF" in the questions ? Q No 6.What is meant by the terms stack consistence and input tape consistence ? Q No 7 What is the concept of unit production ? Q No 8 Why Context Free Grammars are called "Context Free? Q No 9. What is Unit Production? Q No 10.What is Left most Derivation in CFG? Q No 1.What is the Difference between Nullable and Null production? How to make eliminate Nullable and for Null Productions from the CFG ? The production of the form nonterminal ® L is said to be null production. Example: Consider the following CFG S ® aA|bB|L, A ® aa|L, B ® aS Here S ® L and A ® L are null productions. A production is called nullable production there is a derivation that starts at Non Terminal and leads to L i.e. S -----------> aA | bB | aa A-------------> C | bb C--------------> L Here A nullable Non Terminal due to Nullable production A---------------> C as C leads to null. Example: Consider the following CFG S ® XY, X ® Zb, Y ® bW Z ® AB, W ® Z, A ® aA|bA|L B ®Ba|Bb|L.

Page 254: CS402 FULL Material 2011

Here A ® L and B ® L are null productions, while Z ® AB, W ® Z are nullable productions. Method: Delete all the Null productions and add new productions e.g. Consider the following productions of a certain CFG X ® aNbNa, N ® L, delete the production N ® L and using the production X ® aNbNa, add the following new productions X ® aNba, X ® abNa and X ® aba Thus the new CFG will contain the following productions X ® Nba|abNa|aba|aNbNa Note: It is to be noted that X ® aNbNa will still be included in the new CFG. Method: Consider the following CFG S ® XY, X ® Zb, Y ® bW Z ® AB, W ® Z, A ® aA|bA|L B ®Ba|Bb|L. Here A ® L and B ® L are null productions, while Z ® AB, W ® Z are nullable productions. The new CFG after, applying the method, will be S ® XY X ® Zb|b Y ® bW|b Z ® AB|A|B W ® Z A ® aA|a|bA|b B ®Ba|a|Bb|b Note: While adding new productions all Nullable productions should be handled with care. All Nullable productions will be used to add new productions, but only the Null production will be deleted Q No 2. Is it possible to make CFG for infix and postfix expression's using derivation tree ? Derivation tree is only used to derive words of language that is described by a CFG. Yes, we can create CFG for languages infix expressions, postfix expressions. Q No 3 what is the uses of push down automata in computing ? PDA is just an enhancement in FAs. i.e Memory is attached with machine that recognizes some language. FA is basic structure for most advanced electronic machines such as computer etc. Q No 4 What is difference between PUSH DOWN STACK and PUSH DOWN STORE ? No difference at all. Both terms are used to describe memory structure attached with FAs to store some characters in it. Q No 5 How we can distinguish between "CFG" and "CNF" in the questions ? Chomsky Normal Form (CNF) If a CFG has only productions of the form nonterminal --------- string of two nonterminals or Nonterminal ----------- one terminal Then the CFG is said to be in Chomsky Normal Form (CNF). Thus if the given CFG is in the form specified above it will be called in CNF. Q No 6.What is meant by the terms stack consistence and input tape consistence ? Term Stack consistent means we can pop any character from the top of the stack only. PDA should not be able to pop any character other than that is present on the top of the stack. Term Tape consistent means we can read only the first letter on the tape not any other letter of the tape after the first one. Q No 7 What is the concept of unit production ? The productions of the form one Nonterminal -------- one Nonterminal Are called unit productions. For example S -------- A (Unit Produciton) A-------- a | b Here there is no need of Unit Production S→ A. we can directly write S -------- a | b Q No 8 Why Context Free Grammars are called "Context Free? Context Free Grammars are called context free because the words of the languages of Context Free Grammars have words like “aaabbb”(PALINDROME). In these words the value of letters (a , b) is the same on whatever position they appear. On the other hand in context sensitive grammars their value depend on the position they

Page 255: CS402 FULL Material 2011

appear in the word a simple example may be as follows Suppose we have a decimal number 141 in our language . When compiler reads it, it would be in the form of string. The compiler would calculate its decimal equivalent so that we can perform mathematical functions on it. In calculating its decimal value , weight of first “1” is different than the second “1” it means it is context sensitive (depends on in which position the “1” has appeared). i.e. 1*102 + 4*101 + 1* 100 = 14 (value of one is 100) (value of one is just one) That is not the case with the words of Context Free Languages. (The value of “a” is always same in whatever position “a” appears). Q No 9. What is Unit Production? The production in which one non-terminal leads to only one non-terminal. Q No 10.What is Left most Derivation in CFG? It is a method of generation of strings from a CFG starting from left most letter of the string. Question: FAQ's about Lectures 41 to 45 FAQ's about Lectures 41 to 45 Q No 1.Give an example of converting a CFG to CNF? Q No 2.In the lecture 41 's example, we have converted PDA to conversion form and a word 'aaaabb' is derived from this conversion form PDA. What are the derivation steps. Q No 3.How to differentiate between "wanted" and "unwanted branch" ? Q No 4.What is the difference between intersection and union of a language? Q No 5.What is the difference between Context free languages and regular languages? Q No 6.What is the difference between Moore and Mealey machines? Q No 7.What does the following terms mean ? i. STACK Consistent ii. Y-able Paths iii. Working string iv. Semi Word Q No 1.Give a example of converting a CFG to CNF? Consider the CFG given below S→ ABC A→ aa | b B→ c C→d Its CNF will be S→ DC D → AB A→ EE | b E→a B→c C→d Q No 2.In the lecture 41 's example, we have converted PDA to conversion form and a word 'aaaabb' is derived from this conversion form PDA. What are the derivation steps. The PDA converted to conversion form has some specific features that are important to understand first. These features are The states named START, READ, HERE and ACCEPT are called joints of the machine. With the help of the conversion form we have been able to achieve that POP state has only one path out of it and the path taking (multiple paths) decisions take place only on the READ state. The word 'aaaabb' is generated as follows from the PDA START-POP4-PUSH $ This step pops $ and then pushes it to ensure that stack contains $ at the beginning.

Page 256: CS402 FULL Material 2011

READ1-POP6-PUSH $-PUSH a As first time after reading "a" there is $ at the top of stack so we will follow path segment READ1-POP6-PUSH $-PUSH a READ1-POP5-PUSH a-PUSH a Now a is on the top of the stack so we will follow READ1-POP5-PUSH a-PUSH a READ1-POP5-PUSH a-PUSH a Again following same segment for a READ1-POP5-PUSH a-PUSH a Again following same segment for a READ1-POP1- HERE-POP2 As we read b on input tape. READ2-POP1-HERE-POP2 As we read b on input tape. READ2-POP3-ACCEPT. As we read Δ from the input tape Q No 3.How to differentiate between "wanted" and "unwanted branch" ? When we derive a word in Top down parsing beginning with the starting Non Terminal the branches of the tree that do not lead to our required word are left aside these branches are called unwanted branches. For example for CFG S----->AA A----->a | b If we want to generate the word "aa" we will leave the branch generated by the production A- ----->b. Q No 4.What is the difference between intersection and union of a language? Intersection of two languages will consist of all those words which are in both languages while union of two languages will consist of all those words which are present in at least one language. Symbol for intersection is ∩ and for union is U. Q No 5.What is the difference between Context free languages and regular languages? Regular languages can be represented by FA‟s because we do not need any memory to recognize (accept or reject them on FA) them but there is another class of languages that can not be represented by FA‟s because these languages require that we have some memory (with the help of memory we can store letters of the string we are checking so that we can compare them with next coming letters in the string). For example language anbn requires that we must store a‟s and then compare their count with next coming b‟s so that we can check whether a‟s are equal to b‟s or not. Due to this reason we use Context Free Grammars to represent them because we can5t write RE‟s for them. So Context Free Languages represent a broader category this category also include regular languages as subcategory. It means that context free languages include regular languages as well as some other languages. Q No 6.What is the difference between Moore and Mealey machines? In Mealy Machine we read input string letters and generate output while moving along the paths from one state to another while in Moore machine we generate output on reaching the state so the output pattern of Moore machine contains one extra letter because we generated output for state q0 where we read nothing. Q No 7.What does the following terms mean i. STACK Consistent ii. Y-able Paths iii. Working string

Page 257: CS402 FULL Material 2011

iv. Semi Word means Stack consistence means that in the PDA converted in the conversion form, when we follow a path segment (which is formed by combining start, read or here state with next read, here or accept state on the path) along the PDA its pop state should have the path for the same letter that is present on the top of the stack at that stage. If this doesn‟t happen our PDA will crash because in conversion form of the PDA the pop state has only one letter path, so if we could not be able to find that letter on the top of the stack our PDA will crash (if will not find path where to go from that state) Working string means the string present on the input tape. Y-able Paths means that when we follow a certain sequence of rows from the row table to generate a path for a word form start state to accept state. The path (sequence of rows) should be stack as well as joint consistent it means that rows should end at the same read or here state (join consistency ) and the rows should be able to pop the letter from the top that is indicated in the pop state of the row. Semi word is the string of terminals it may be null string ending with a Non terminals on the right. For example some semi words are aaS aabbA B Question: Is Automata Theory is a Programming Subject or theoretical? Answer: Automata theory is the study of abstract computing devices, or "machines". This topic goes back to the days before digital computers and describes what is possible to compute using an abstract machine. These ideas directly apply to creating compilers, programming languages, and designing applications. They also provide a formal framework to analyze new types of computing devices, e.g. biocomputers or quantum computers Question: What are practical Examples of the implications of Automata Theory and the formal Languages? Answer: Grammars and languages are closely related to automata theory and are the basis of many important software components like: – Compilers and interpreters – Text editors and processors – Text searching – System verification Question: What are the Types of Automata? Answer: The Types of Automata Theory are 1. Finite Automata 2. Regular Languages 3. Linear-bounded Automata 4. Context Sensitive Languages 5. Push-Down Automata 6. Context Free Languages 7. Turing Machines 8. Recursively innumerable languages There are others as well like, Random Access Machines Parallel Random Access Machines Arrays of Automata

Page 258: CS402 FULL Material 2011

Question: How types of Automata Differ? Answer: They differ in the following areas 1. Complexity (or Simplicity) 2. Power 3. In the function that can be computed. 4. In the languages that can be accepted. Question: What is the difference between the alphabet and an element of a set? Answer: Alphabets is a set of letters nothing else but a set of strings (elements) can have more than one letters in one string. Question: Difference between Palindrome and Reverse function? Answer: The language consisting of Λ and the strings s defined over Σ such that Rev(s)=s. It is to be denoted that the words of PALINDROME are called palindromes. Reverse (w) = w Example: Σ={a,b}, PALINDROME={Λ , a, b, aa, bb, aaa, aba, bab, bbb, ...} If a is a word in some language L, then reverse (a) is the same string of letters spelled backwards, called the reverse of a. e.g reverse (xxx) = xxx reverse (623) = 326 reverse (140) = 041 Question: Define Strings? Answer: Concatenation of finite letters from the alphabet is called a string. e.g If Σ= {a,b} then a language L can be defined as L = {a, abab, aaabb, ababababababababab,...............} it's mean all words with a's more or equal to b's Question: Define empty or null strings? Answer: Concatenation of finite letters from the alphabet is called a string. Sometimes a string with no symbol at all is used, denoted by (Small Greek letter Lambda) λ or (Capital Greek letter Lambda) Λ, is called an empty string or null string. Question: Difference between string and word? Answer: Any combination of letters of alphabet that follows rules of language is called a word. A string is a finite sequence of symbols from an alphabet. Question: There are as many palindromes of length 2n as there are of length 2n-1, please explain? Answer: If we try to create palindromes then middle elements (2 in even palindromes & 1 in odd palindrome) does not cause any change in no. of palindromes Defining the language PALINDROME, of length 2n and 2n-1 defined over S = {a,b} e.g if we take n= 2 for 2n Length (2n) = 4 and string can be written as {aaaa, abba, baab, bbbb} And if we take n = 2 for 2n-1 Length (2n-1) = 3 and string can be written as {aaa, aba, bab, bbb} Question: Define Kleene Star? Answer: Given Σ, then the Kleene Star Closure of the alphabet Σ, denoted by Σ*, is the collection of all strings defined over Σ, including Λ. It is to be noted that Kleene Star Closure can be defined over any set of strings. Examples If Σ = {x} Then Σ* = {Λ, x, xx, xxx, xxxx, ….} If Σ = {0,1} Then Σ* = {Λ, 0, 1, 00, 01, 10, 11, ….}

Page 259: CS402 FULL Material 2011

If Σ = {aaB, c} Then Σ* = {Λ, aaB, c, aaBaaB, aaBc, caaB, cc, ….} Note: Languages generated by Kleene Star Closure of set of strings, are infinite languages. (By infinite language, it is supposed that the language contains infinite many words, each of finite length). Question: Why do not we can write" ba" in the set of PALINDROME while it is reverse of "ab". Answer: The language consisting of Λ and the strings s defined over Σ such that Rev(s)=s. It is to be denoted that the words of PALINDROME are called palindromes. Example For Σ={a,b}, PALINDROME={Λ , a, b, aa, bb, aaa, aba, bab, bbb, ...} All two length string cannot satisfied the palindrome. aa and bb in palindrome but ba and ab are not in palindrome. Question: What are the steps of Recursive Definition of Languages? Answer: A recursive definition is characteristically a three-step process. First, we specify some basic objects in the set. Second, we give rules for constructing more objects in the set from ones we already know. Third, we declare that no objects except those constructed in this way are allowed in the set. Question: Strings that ending in "a " and strings containing exactly one "a". Answer: Its means all string ending in a e.g Σ= {a, b} {a, aa, ba, aba, baa,…….} Exactly a, defined over Σ= {a, b} {ab, ba, abb, bba,……... } Question: What is Lexical Analyzer? Answer: The first phase of the compiler is the lexical analyzer, also known as the scanner, which recognizes the basic language units, called tokens. • The exact characters in a token is called its lexeme. • Tokens are classified by token types, e.g. identifiers, constant literals, strings, operators, punctuation marks, and key words. • Different types of tokens may have their own semantic attributes (or values) which must be extracted and stored in the symbol table. • The lexical analyzer may perform semantic actions to extract such values and insert them in the symbol table. Question: What is accepting string language? Answer: The strings which follow rules for the language are accepted in language. • Let u and v be strings. Then uv denotes the string obtained by concatenating u with v, that is, uv is the string obtained by appending the sequence of symbols of v to that of u. For example if u = aab and v = bbab, then uv = aabbbab. Note that vu = bbabaab uv. We are going to use first few symbols of English alphabet such as a and b to denote symbols of an alphabet and those toward the end such as u and v for strings. Question: What is transition table? Answer: A complete transition table contains one column for each character. To save space, table compression may be used. Only non-error entries are explicitly represented in the table, using hashing, indirection or linked structures. Tabular representation of a function that takes two arguments and returns a value 0 1 q0 q2 q0

*q1 q1 q1

Page 260: CS402 FULL Material 2011

q2 q2 q1 • Rows correspond to states • Columns correspond to inputs • Entries correspond to next states • The start state is marked with an arrow • The accepting states are marked with a star Question: What does it means by the transition? Answer: Transition means which letter, after being read, is transfer from which place to which place. It is necessary to show transition of every letter from each and every state. Question: What is Null? Answer: Λ is a string having no letter in it. e.g ( A box having no object in it). Let us observe that if the alphabet has no letters, then its closure is the language with the null string as its only word, because Λ is always a word in a Kleen closure. Symbolically, we write if Σ = {the empty set} then Σ* = {Λ}, This is not the same as if S = {Λ} then S* = {Λ} which is also true but for a different reason, that is ΛΛ = Λ. Example If L is any language, then LΛ = ΛL = L If Λ string concatenates with any string S, it does not cause any change in the string S, if we use Λ in any string then it generates some result that is below here Λ for both side then string is ΛaaΛ = aa b for left and Λ for right then string is baaΛ = baa Λ for left and b for right then string is Λaab = abb Question: What is the difference between Regular Languages and Non Regular Languages? Answer: The language determined by a regular expression is regular otherwise non regular. Question: What is NFA? Answer: Nondeterminism plays a key role in the theory of computing. A nondeterministic finite stateautomaton is one in which the current state of the machine and the current input do not uniquely determine the next state. This just means that a number of subsequent states (zero or more) are possible next states of the automaton at every step of a computation. Of course, nondeterminism is not realistic, because in real life, computers must be deterministic. Still, we can simulate nondeterminism with deterministic programs. Furthermore, as a mathematical tool for understanding computability, nondeterminism is invaluable. As with deterministic finite state automata, a nondeterministic finite state automaton has five components. • a set of states • a finite input alphabet from which input strings can be constructed • a transition function that describes how the automaton changes states as it processes an input string • a single designated starting state • a set of accepting states The only difference lies in the transition function, which can now target subsets of the states of the automaton rather than a single next state for each state, input pair. Question: What is a main difference between NFA and FA? Answer: Finite Automata (FA)

Page 261: CS402 FULL Material 2011

• A finite automaton with unique transitions from each state. • There are no choices • There is only 1 letter of the alphabet per transition (the label on the edges in the graph is limited to 1) • Λ transitions are not allowed. • No implied trap states. That is, if the letter of alphabet has n letters in it, every state will have n edges coming out of it. If the letters are not part of a valid word, then the edges will go into a special state, called the trap states. Trap states are the NO states. Nondeterministic Finite Automaton (NFA) • Has the freedom to do various different moves when in a state and seeing some input • This is modeled mathematically as The ability to be in various states at once Accepting a string whenever at least one of those states is accepting. Question: How to obtain 9's complement? Answer: The (r – 1)‟s Complement Given a positive number N is base r with an integer part of n digits and a fraction part of m digits, the (r-1)‟s complements of N is defined as rn –r-m – N. Some numerical examples follow: The 9‟s complement of (52520)10 is (105 – 1 – 52520) = 99999 – 52520 = 47479. No fraction part, so 10-m = 100 = 1. The 9‟s complement of (0.3267)10 is (1 – 10-4 – 0.3267) = 0.9999 – 0.3267 = 0.6732 No integer part, so 10n = 100 = 1. The 9‟s complement of (25.639)10 is (102 – 10-3 – 25.639) = 99.9999 - 25.63967 = 74.360 Question: What is DELAY box? Answer: It is a component which held input for some time and then forwards it just a holder. Question: What is the difference between pumping Lemma 1 and pumping Lemma 2? Answer: Infact PLI & PLII are same (A way to recognize Non Regular language). The only difference is in PLII we take care about the substring x & y that length (x) + length (y) less than or equal no. of state of machine. This is because through PLI palindrome (that is Non Regular) is proved to be regular and through PLII this problem is fixed. Question: What is pumping lemma? And what is history? Answer: A theorem to check validity (Regularity) of an infinite language should not be used with finite languages. Whenever an infinite is regular then there must be a loop (circuit) because without a loop means infinite no. of states that is not possible practically. (Machine can have finite states only) Question: What is the difference between semi word and word? Answer: A word is complete combinations of terminals only e.g. abba or ab or a or null string. Semiword: A semiword is a string of terminals (may be none) concatenated with exactly one nonterminal on the right i.e. a semiword, in general, is of the following form (terminal)(terminal)… (terminal)(nonterminal) Question: What is the difference between derivation tree and total tree? Answer: A Derivation tree is the one that shows how to derive any specific word of the language described by CFG but Total Language Tree shows all words of the Language described by CFG on it. Question: How to identify a production by it, ambiguity will be removed? Answer: It is a matter of practice that one can know how to remove ambiguity from it, only practice makes you efficient enough to do it in less time. Question: Difference between Nullable and Null production? How to make CFG for Nullable and forNull?

Page 262: CS402 FULL Material 2011

Answer: The production of the form nonterminal ® L is said to be null production. Example: Consider the following CFG S ® aA|bB|L, A ® aa|L, B ® aS Here S ® L and A ® L are null productions. A production is called nullable production if it is of the form N ® L or there is a derivation that starts at N and leads to L i.e. N1 ® N2, N2 ® N3, N3 ® N4, …, Nn ® L, where N, N1, N2, …, Nn are non terminals. Example: Consider the following CFG S ® XY, X ® Zb, Y ® bW Z ® AB, W ® Z, A ® aA|bA|L B ®Ba|Bb|L. Here A ® L and B ® L are null productions, while Z ® AB, W ® Z are nullable productions. Method: Delete all the Null productions and add new productions e.g. Consider the following productions of a certain CFG X ® aNbNa, N ® L, delete the production N ® L and using the production X ® aNbNa, add the following new productions X ® aNba, X ® abNa and X ® aba Thus the new CFG will contain the following productions X ® Nba|abNa|aba|aNbNa Note: It is to be noted that X ® aNbNa will still be included in the new CFG. Method: Consider the following CFG S ® XY, X ® Zb, Y ® bW Z ® AB, W ® Z, A ® aA|bA|L B ®Ba|Bb|L. Here A ® L and B ® L are null productions, while Z ® AB, W ® Z are nullable productions. The new CFG after, applying the method, will be S ® XY X ® Zb|b Y ® bW|b Z ® AB|A|B W ® Z A ® aA|a|bA|b B ®Ba|a|Bb|b Note: While adding new productions all Nullable productions should be handled with care. All Nullable productions will be used to add new productions, but only the Null production will be deleted. Question: Is it possible to make CFG for infix and postfix expression‟s using derivation tree? Answer: Derivation tree is only used to derive words of language that is described by a CFG. Yes, we can create CFG for languages infix expressions, postfix expressions.

Page 263: CS402 FULL Material 2011

Question: What are the uses of push down automata in computing? Answer: PDA is just an enhancement in FAs. i.e Memory is attached with machine that recognizes some language. FA is basic structure for most advanced electronic machines such as computer etc. Question: What is difference between PUSH DOWN STACK and PUSH DOWN STORE? Answer: No difference at all. Both terms are used to describe memory structure attached with FAs tostore some characters in it. Question: How to accommodate NULL string if it is part of language during converting from CFG toCNF and building FA's? Answer: When we convert CFG to CNF and Null is a part of language then null string is not part of language in CNF. This is the only change a language gets in CNF. When we draw an FA for a CFG, there is no change in language and simply draws FA that accepts the language of CFG. Question: How to accommodate NULL string if it is part of language during converting from CFG toCNF and in building PDA? Answer: When we convert CFG to CNF and Null is a part of language then null string is not part of language in CNF. This is the only change a language gets in CNF. When we draw an PDA for a CFG, there is no change in language and simply draws PDA that accepts the language of CFG. Question: What is Push down Automata? Answer: Pushdown Automaton (PDA), consists of the following • An alphabet S of input letters. • An input TAPE with infinite many locations in one direction. Initially the input string is placed in it starting from first cell; the remaining part of the TAPE is empty. • An alphabet G of STACK characters. • A pushdown STACK which is initially empty, with infinite many locations in one direction. Initially the STACK contains blanks. • One START state with only one out-edge and no in-edge. • Two halt states i.e. ACCEPT and REJECT states, with in-edges and no out-edges. • A PUSH state that introduces characters onto the top of the STACK. • A POP state that reads the top character of the STACK (may contain more than one out-edges with same label). • A READ state that reads the next unused letter from the TAPE (may contain more than one out-edges with same label). Question: Why we study Automata? Answer: Automata theory is the study of abstract computing devices, or "machines". This topic goes back to the days before digital computers and describes what is possible to compute using an abstract machine. These ideas directly apply to creating compilers, programming languages, and designing applications. They also provide a formal framework to analyze new types of computing devices, e.g. biocomputers or quantum computers. Finally, the course should help to turn you into mathematically mature computer scientists capable of precise and formal reasoning. More precisely, we'll focus primarily on the following topics. Don't worry about what all the terms mean yet, we'll cover the definitions as we go: 1. Finite state automata: Deterministic and non-deterministic finite state machines; regular expressions and languages. Techniques for identifying and describing regular languages; techniques for showing that a language is not regular. Properties of such languages. 2. Context-free languages: Context-free grammars, parse trees, derivations and ambiguity. Relation to pushdown automata. Properties of such languages and techniques for showing that a language is not context-free.

Page 264: CS402 FULL Material 2011

3. Turing Machines: Basic definitions and relation to the notion of an algorithm or program. Power of Turing Machines. 4. Undecidability: Recursive and recursively enumerable languages. Universal Turing Machines. Limitations on our ability to compute; undecidable problems. 5. Computational Complexity: Decidable problems for which no sufficient algorithms are known. Polynomial time computability. The notion of NPcompleteness and problem reductions. Examples of hard problems. Question: What is valid and invalid alphabets explain with example? Answer: Example 1 If s=abc is a string defined over Σ= {a,b,c} then Rev(s) or sr = cba Σ= {a,b} s=abbaa Rev(s)=aabba When more then letter in the alphabet you have to be quite careful that don‟t reverse the symbols however you write the letter from right to left. Example 2 Σ= {B, aB, bab, d} s=BaBbabBd Rev(s)=dBbabaBB Example 3 Σ= {ab, b, aa} s=abbaa Rev(s)=aabab Σ1= {B, aB, bab, d} is valid alphabet as there is no letter in Σ1 that lies in start of any other letter means all the tokens of any word (string) will be unique. Whereas in Σ2= {B, Ba, bab, d} letter B lies in start of letter Ba. This makes it difficult to decide which token to select at some point if B occurs in any string. Question: Why we use Capital Letters for Languages. Is it possible to combine two languages together like EVEN-EVEN & EQUAL, and so on? Answer: We use capital letter for our convenient and yes you can combine two languages. Question: What are the rules to form WORDS in languages developed by Automata? Are strings notfollowing any rule? Answer: Rules are different for different languages. e.g Σ={a,b} The language L of strings of even length, defined over Σ= {a,b}, can be written as Valid for even length L= {aa, bb, aabb, bbaa, baab, abba …..} Invalid for even length L= {a, b, aaa, bbb, aba, bab, …….} The language L of strings of odd length, defined over Σ= {a,b}, can be written as Valid for odd length L1= {a, b, aaa, bbb, aba, bab, …….} Invalid for odd length L= {aa, bb, aabb, bbaa, baab, abba …..} Strings cannot follow any rule. Question: What are graphs of palindromes of length 2n and length 2n-1? Answer: Palindromes of even length are always symmetric about the middle line and palindromes ofodd length are always symmetric about middle letter. If we try to create palindromes then middle elements (2 in even palindromes & 1 in odd palindrome) does not cause any change in no. of palindromes Defining the language PALINDROME, of length 2n and 2n-1 defined over S = {a,b} e.g if we take n= 2 for 2n Length (2n) = 4 and string can be written as {aaaa, abba, baab, bbbb}

Page 265: CS402 FULL Material 2011

And if we take n = 2 for 2n-1 Length (2n-1) = 3 and string can be written as {aaa, aba, bab, bbb} Question: How can we write a RE for a given number of words? Answer: In example let us consider a finite language L that contains all the strings of a‟s and b‟s of length three exactly: L = {aaa aab aba abb baa bab bba bbb} The first letter of each word in L is either an a or a b. The second letter of each word in L is either an a or a b. The third letter of each word in L is either an a or a b. So, we may write L = language ((a+b)(a+b)(a+b)) Or L = language ((a+b)3) If we want to define the set of all seven-letter strings of a‟s and b‟s, we could write (a+b)7 . In general, if we want to refer to the set of all possible strings of a‟s and b‟s of any length whatsoever, we could write (a+b)* This is the set of all possible strings of letters from the alphabet Σ = {a, b} including the null string. This is a very important expression and we shall use it often. Again, this expression represents a language. If we choose that * stands for 5, then (a+b)* gives (a+b)5 = (a+b)(a+b)(a+b)(a+b)(a+b) We now have to make five more choices: either a or b for the first letter, either a or b for second letter, and so on. 21. Please explain that in some expression having more then one plus sign the resulting string is only one from them or it can be more then one? For example if there is an expression: a +b + c, with out any small bracket between them the resultant string is "a or b or c" OR it cans both "a or b and c”,"a and b or c" The resulting string is only one from them. Whenever we put + signs between n words that means one option (only) out of all available. Question: One Language generates many REs? Answer: Sometimes we generate many Regular Expressions (RE) for one language these REs are called Equal RE. Example: Consider the following regular expressions r1= (a + b)* (aa + bb) r2= (a + b)*aa + ( a + b)*bb then both regular expressions define the language of strings ending in aa or bb. This RE (aa+bb) is separated by +. Whenever RE is separated by +, two possibilities occur 1. Before + part 2. After + part (a+b)*aa comes before + part, means RE generate all strings that end with aa. (a+b)*bb comes after + part this means RE generate all strings that end with bb. In short we can say r2 generates the language of strings ending either aa or bb this is equal to r1. Question: Rules for determining RE for a given language defined on a set? Answer: The following rules define the language associated with any regular expression: Rule 1: The language associated with the regular expression that is just a single letter is that one-letter word alone and the language associated with null is just {null}, a one-word language. Rule 2: If r1 is a regular expression associated with the language L1 and r2 is regular

Page 266: CS402 FULL Material 2011

expression associated with the language L2, then: • The regular expression (r1)(r2) is associated with the product L1L2 that is the language L1 times L2

language (r1r2) = L1L2

• The regular expression r1 + r2 is associated with the language formed by the union of the sets L1 and L2:

language (r1 + r2) = L1 + L2

• The language associated with the regular expression (r1)* is L1*, the Kleene closure of the set L1 as a set of words: language(r1*) = L1* Once again, this collection of rules proves recursively that there is some language associated with every regular expression. As we build up a regular expression from the rules, we simultaneously are building up the corresponding language. Question: What is EVEN - EVEN LANGUAGE? Answer: Even-Even means count of a's is even and cout of b's is also even. Even + Even = Even (Proved) So we can divide any string excluding Λ which is also in Even-Even in substrings of length 2 each. It gives us following combinations aa, bb makes no change in string status ab, ba create disorder in string status so (aa+bb+(ab+ba)(aa+bb)*(ab+ba))*. Question: What is tokenizing string? Answer: Tokenize a string means make its valid units. Question: What is whole star? Answer: Whole star of any RE means all possible combinations of that RE including Λ. Question: How to use + operator in Automata? Answer: Plus Operation is same as Kleene Star Closure except that it does not generate Λ (null string), automatically. Question: How to know what is RE? Answer: It is a matter of practice that you come to know what does an RE represent. You may start with simpler REs and later you will be able to recognize different REs gradually. Question: Why we use null string in FA? Answer: If null string is part of our language then we have to handle it in FA, its not compulsion. Question: What is tree structure? Answer: A tree is a connected undirected graph with no simple circuits. Since a tree cannot have a simple circuit, a tree cannot contain multiple edges or loops. Therefore any tree must be a simple graph. Question: What is difference between (a, b) & (a + b)? Answer: (a, b) & (a + b) are same and both represents either a or b. Question: Difference between FA & TG? Answer: Finite Automata (FA) · A finite automaton with unique transitions from each state. · There are no choices · There is only 1 letter of the alphabet per transition (the label on the edges in the graph is limited to 1) · Λ transitions are not allowed. · No implied trap states. That is, if the letter of alphabet has n letters in it, every state will have n edges coming out of it. If the letters are not part of a valid word, then the edges will go into a special state, called the trap states. Trap states are the NO states.

Page 267: CS402 FULL Material 2011

Transition Graphs (TG) ·TG are generalizations of FA. · Can change state without an input. · Can read more than one letter at a time. · Can have a regular expression as a edge label. · Can have more then one start state. We are not bound in TG. We are only given a freedom or relation which we are not forced to use. We may or may not use it on will. In fact we enjoy freedom of staying at multiple places at one time in TGs while reading any letter strings which provides us a facility that any one available path it leads us to final state, word is accepted. Question: Difference between (a+b)+ and (a+b)*? Answer: (a + b)+ means, we repeat RE a + b infinite (any) no. of times but minimum once, whereas (a + b)* means we may repeat a + b any no. of times even zero times. () are only used to clear (distinguish) the one RE from some other RE. Question: What is length of string? Answer: The length of a string indicates how many symbols are in that string. For example, the string 0101 using the binary alphabet has a length of 4. The standard notation for a string w is to use |w|. For example: Length of string: |0101| is 4. Length of string: |0010| = 4, |aa| = 2, | |= 0 Question: After looking the on diagram how can we say it is TG or is FA? Answer: Every FA is also a TG but not every TG is FA. In every FA, every state shows transition of all letters of given alphabet but in any TG it is not must. In TG, we may or may not show all letters transition according to requirement. We can also show transitions on reading any strings in TGs but it is not possible in FAs. Question: Differentiate between FA, TG and GTG? Answer: Every FA is also a TG but not every TG is FA. In every FA, every state shows transition of all letters of given alphabet but in any TG it is not must. In TG, we may or may not show all letters transition according to requirement. We can also show transitions on reading any strings in TGs but it is not possible in FAs. In GTG Directed edges connecting some pair of states labeled with regular expression.It may be noted that in GTG, the labels of transition edges are corresponding regular expressions. In TG we write strings and in GTG we are bound to write RE. Question: Difference between even clumps and odd clumps? Answer: Letters may be a's (for example) in even count at one place. e.g. aab = valid baa = valid aba = invalid abab = invalid Question: Difference between containing and consisting? Answer: Containing something (e.g. R1) means R1 is there (must), whatever other things are, we don‟t care. Consisting something (e.g. R1) means only R1 is there all other things should be rejected. Question: Define the main formula of Regular expressions? Define the back ground of regular expression? Answer: Regular expressions are a notation that you can think of similar to a programming language.

Page 268: CS402 FULL Material 2011

In fact, regular expressions are quite fundamental in some programming languages like perl and applications like grep or lex. Regular expressions are similar to NFA and end up describing the same things we can express with a finite automaton. However, regular expressions are declarative in what strings are accepted, while automata are machines that accept strings. We use Regular expressions for defining the languages. Say that R is a regular expression if R is: 1. a for some a in the alphabet Σ, standing for the language {a} 2. Λ , standing for the language { Λ} 3. R1+R2 where R1 and R2 are regular expressions, and + signifies union 4. R1R2 where R1 and R2 are regular expressions and this signifies concatenation 5. R* where R is a regular expression and signifies closure 6. (R) where R is a regular expression, then a parenthesized R is also a regular expression A set of strings from an alphabet. The set may be empty, finite or infinite. The building blocks of regular languages are symbols, concatenation of symbols to make strings (words), set union of strings and Kleene closure (denoted as *, also called the Kleene star, it should be typed as a superscript but this is plain text.) Informally, we use a syntax for regular expressions. Using sigma as the set {0, 1} (an alphabet of two symbols) 01110 is a string starting with the symbol 0 and then concatenating 1, then 1, then 1, and finally concatenating 0. No punctuation is used between symbols or strings that are concatenated. (01+10) is a union of the two strings 01 and 10. The set {01, 10} (00+11)* is the Kleene closure of the union of 0 concatenated with 0 and 1 concatenated with 1. The Kleene closure (star) is defined as the concatenation of none, one, two, or any countable number strings it applies to. Examples of Kleene star: 1* is the set of strings {Λ, 1, 11, 111, 1111, 11111, etc. } This set is infinite. (1100)* is the set of strings {Λ, 1100, 11001100, 110011001100, etc. } (00+11)* is the set of strings {Λ, 00, 11, 0000, 0011, 1100, 1111, 000000, 000011, 001100, etc. } Note how the union ( + symbol) allows all possible choices of ordering when used with the Kleene star. (0+1)* is all possible strings of zeros and ones, often written as Σ * where Σ = {0, 1}(0+1)* (00+11) is all strings of zeros and ones that end with either 00 or 11. Note that concatenation does not have an operator symbol. (w)+ is a shorthand for (w)(w)* w is any string or expression and the superscript plus, + , means one or more copies of w are in the set defined by this expression. Question: Are S* and S+ same? Answer: No because S+ means same as Kleene Star Closure except that it does not generate Λ (null string), automatically. So in the above example, there is no null string. Concatenation of finite letters from the alphabet is called a string. If we have S={a, bb, bab, abaab}, first we factorize the string like (a) (bb) (bab) (abaab) then concatenate to each other and make more string to its concatenation but the string abbabaabab is not in S* because the last member (ab) of the group does not belong to S, so abbabaabab is not in S. Question: What is set? Answer: Set is a collection of distinct objects. Question: How many Methods of defining the languages? Answer: 1. You can describe a language in English like statement 2. You can define a language by putting all its words in a set

Page 269: CS402 FULL Material 2011

3. You can define a language in a mathematical way 4. You can define a language by Recursive Definition 5. You can define a language by Regular Expression 6. You can define a language by Finite Automata 7. You can define a language by Transition Graph 8. You can define a language by Grammar Question: What is difference between Palindrome, Kleene star closure and plus operation? Answer: The language consisting of Λ and the strings s defined over Σ such that Rev(s)=s. or A string x is a palindrome if xR=x. It is to be denoted that the words of PALINDROME are called palindromes. Reverse (w) = w Example: Σ={a,b}, PALINDROME={Λ , a, b, aa, bb, aaa, aba, bab, bbb, ...} If a is a word in some language L, then reverse (a) is the same string of letters spelled backwards, called the reverse of a. e.g reverse (xxx) = xxx reverse (623) = 326 reverse (140) = 041 Given Σ, then the Kleene Star Closure of the alphabet Σ, denoted by Σ*, is the collection of all strings defined over Σ, including Λ. Plus Operation is same as Kleene Star Closure except that it does not generate Λ (null string), automatically. Question: What is inside language? Answer: Any language contains words in it and certain rules to validate strings for that language. Question: What is Equal RE? Answer: Sometimes we generate many REs for one language these are called Equal RE. Question: How can we make Finite Automaton from a language and a language from FA? Answer: There is not any formal procedure to design FA for a language. This ability just improves with time and practice. Question: Could we just use +, - symbols with x not with y in FA? Answer: Yes, you can use only + or – for the place of x and y, but remember when you don't write +or –, So you should write start and final at the beginning or ending state Or you should indicated by an arrow and a final state by drawing box or another circle around its circle because if you don't write how can we indicate the start and final state. Question: Explain the language L of string, defined over Σ= {0,1}, having double 0's and double 1's?Answer: Language of strings with 00 or 11 means string that have substrings 00 or 11 in them at least. Minimum words which are included in this language are 00 and 11. This language does not accept null and it also does not accept 0 or 1. Question: What are the difference between single 1 and 0 and double 1's and 0's? Answer: 1. Consider the language L of strings, defined over If Σ={0, 1}, having words with either 0‟s or 1‟s without null. The language L may be expressed by RE (0 + 1)+

When you make string by above RE you have all possible combination of 0‟s and 1‟s except null i.e {0, 1, 00, 01, 10, 11,……….}. Minimum words which are included in this language are 0 and 1. 2. Consider the language L of strings, defined over If Σ={0, 1}, having double 0‟s or double 1‟s, The language L may be expressed by the RE

Page 270: CS402 FULL Material 2011

(0+1)* (00 + 11) (0+1)* Double 1‟s and 0‟s means clumps of letter which will always come together. Minimum words which are included in this language are 00 and 11. Question: On what basis we select initial and final states? Answer: It depends on the expression given to us. Question: How we know that the given expression has how many states? Answer: There is not any formal procedure to know the number of states. This ability just improves with time and practice. Question: How will we develop the rules of transition? Answer: Transition means which letter, after being read, is transfer from which place to which place. It is necessary to show transition of every letter from each and every state. Question: Can we accept the strings going from final to initial? Answer: It is to be noted that if any state start from the final state it does not accept any string. Even it does not accept the null string, because there is no path starting from initial state and ending in final state. Question: What are the basic rules to build FA? Answer: One and only rule is to build a Finite Automata (FA) should accept all words of the language and reject all the words which are not part of the language. Any FA that ensures these above things is the right FA for the language. Note: One language can have many FA. Question: What is Dead state? Answer: The DEAD STATE is introduced to be able to make an automaton complete without altering

its behavior.Bottom of Form

Bottom of Form

Bottom of Form Bottom of Form Bottom of Form

Page 271: CS402 FULL Material 2011

Filename: mcq cs402 compile.doc Directory: H:\2.CS402 Template:

C:\Users\Memoona\AppData\Roaming\Microsoft\Templates\Normal.dotm

Title: Subject: Author: Project Keywords: Comments: Creation Date: 11/28/2010 1:40:00 AM Change Number: 35 Last Saved On: 2/18/2011 11:10:00 PM Last Saved By: Memoona Total Editing Time: 179 Minutes Last Printed On: 2/18/2011 11:10:00 PM As of Last Complete Printing Number of Pages: 270 Number of Words: 45,147 (approx.) Number of Characters: 257,343 (approx.)