0% found this document useful (0 votes)
32 views10 pages

2022 Afl End Regular Question

Uploaded by

aksad1991
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views10 pages

2022 Afl End Regular Question

Uploaded by

aksad1991
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

KIIT Deemed to be University

Online End Semester Examination(Spring Semester-2022)

Subject Name & Code: AFL (CS-2010) Applicable to Courses:

Full Marks: 50 Time: 2 Hours

SECTION-A(Answer All Questions. Each question carries 2 Marks)

Time:30 Minutes (7×2=14 Marks)

Que Questi Question CO Answer Key


stio on Map (For MCQ
n No Type ping Questions only)
(MCQ/
SAT)
Q.N MCQ Which of the following strings is accepted by Conc D. All from the
o:1 the following FA. ept 1 list.

(A) 111000
(B) 000111
(C) 010101
(D) All from the list.
Which of the strings is not accepted by the Conc C. 010001
following FA. ept 1

(A) 111000
(B) 000111
(C) 010001
(D) 010011
A regular expression for the below FA is: Conc C.
ept 1 10+(0+11)0*1.

(A) 10+(0+1)0*1.
(B) 11+(0+11)0*1.
(C) 10+(0+11)0*1.
(D) None
Which of the following language is regular? Conc B. {ak bk |
(A) {an bn | n>=0} ept 1 0<k<5}
(B){ak bk | 0<k<5}
(C) {am bm | m>=1}
(D)None
Q.N MCQ Consider the following two statements: Conc D. Both S1 and
o:2 ept 2 S2 false
S1. The minimal number of states required to
construct a DFA to accept set of all strings of
length greater than equal to 5 is ≥ 5.
S2. The minimal number of states required to
construct a DFA to accept set of all strings of
length exactly 6 is 7.
Which one of the following is correct?

(A) Both S1 and S2 True.


(B) S1 True and S2 false
(C) S1 False and S2 True
(D) Both S1 and S2 false
The language generated by the grammar Conc B. All odd length
S-> aSa | bSb | a | b , ept 2 palindromes
over the alphabet {a, b} is the set of:
(A) All even length palindromes
(B) All odd length palindromes
(C) All odd and even length palindromes
(D) Strings that begin and end with the
same symbol
Select the correct statement for the regular Conc C.
expression: (a+ λ)(b+ba)* ept 2 Generating
(A) Generating a set of strings which ends strings which do
with a. not contain any
(B) Generating a set of strings which ends consecutive a’s.
with b.
(C) Generating strings which do not
contain any consecutive a’s.
(D) Generating strings which do not
contain any consecutive b’s.
Select the correct statement for the regular Conc C.
expression: (b+ab)* (a+ λ) ept 2 Generating
(A) Generating a set of strings which ends strings which do
with a. not contain any
(B) Generating a set of strings which ends consecutive a’s.
with b.
(C) Generating strings which do not
contain any consecutive a’s.
(D) Generating strings which do not
contain any consecutive b’s.
Q.N The language generated by the grammar Conc A. All even
o:3 S-> aSa | bSb| λ ept 3 length
over the alphabet {a, b} is the set of: palindromes
(A) All even length palindromes
(B) All odd length palindromes
(C) All odd and even length palindromes
(D) Strings that begin and end with the
same symbol
The language {an bn cm dm| n, m ≥ 0} ∪{ an bm Conc C. Inherentl
cm dn| n, m ≥ 0} is ept 3 y
(A) Unambiguous ambiguo
(B) Cannot be determined us
(C) Inherently ambiguous
(D) Not a CFL

Consider the given grammar. Conc A. S->aA,


ept 3 A->aA|a
S-> aA | bB
A-> aA|a
B->bB
D->ab|Ea
E->aC|d
The equivalent grammar after eliminating the
useless symbols and productions:
(A) S->aA, A->aA|a
(B) S->aS|bA|C, A->a, C->aCd
(C) S->aA|bB, A->aA|a, B->bB
(D) Cannot remove useless symbol

Conc B. an cm bn (n, m
ept 3 ≥1)
The language generated by the grammar
S-> aSb | aAb
A->cA|c is:
(A) an bn cn (n, m ≥1)
(B) an cm bn (n, m ≥1)
(C) an bn cm, (n, m ≥1)
(D) am cm bn (n, m ≥1)

Q.N Which one of the following is not a CFL ? Conc A. {am bm cm


o:4 ept 4 m≥0}
(A) {am bm cm : m≥0}
(B) {an bn : n≥0}
(C) {am+n bm cn : m≥0 and n≥0}
(D) {am bm cn dn : m≥0 and n≥0}
Let L1={am bm :m≥0} and L2=={ambm : Conc B. Context
0<m<50}. Then L1∩L2 is: ept 4 free
(A) Regular
(B) Context free
(C) Regular but not context free
(D) Not context-free
Consider the language L1={an bn:n≥0} and Conc A. Context free
L2=={a100 b100}. The relation L1∩L2 ept 4
(A) Context free
(B) Regular
(C) Regular but not context free
(D) Not context-free
Which of the following is / are not necessarily Conc C. iii, iv
CFL? ept 4
i. L1(CFL)∩ L2(Regular language)
ii. L1(CFL) ∪ L2(Regular language)
iii. L1(CFL) ∩ L2(CFL)
iv. �2 if L2(CFL)
(A) All
(B) ii, iii
(C) iii, iv
(D) i, iii, iv
Q.N Consider the following statements: Conc B. S1 is true
o:5 ept 5 and S2 is
S1. A CFG is unambiguous if it a simple false
grammar

S2. A CFG is unambiguous if it is in Greibach


Normal form
Which of the following is True?

(A) S1 and S2 are true


(B) S1 is true and S2 is false
(C) S1 is false and S2 is true
true
(D) S1 and S2 both are false
Consider the following statements: Conc D. S1 and S2
ept 5 D. S1 and S2
S1. A CFG is unambiguous if it is in CNF. both are false

S2. A CFG is unambiguous if it is in GNF.

Which one of the following is True?

(A) S1 and S2 both are true


(B) S1 true and S2 false
(C) S1 false and S2 true
(D) S1 and S2 both are false
Consider the following statements: Conc D. S1 is true and
ept 5 S2 is false
S1. If the CFG(G)does not have any
λ-productions (lambda-productions), then
L(G) does not contain the empty string λ.

S2. If the CFG(G) has λ-productions


(lambda-productions), then L(G) must contain
the empty string λ.

Which one of the following is true?

(A) S1 and S2 both are true


(B) S1 and S2 both are false
(C) S1 is false and S2 is true
(D) S1 is true and S2 is false
Consider the following statements Conc C. S1 and S2
ept 5 both are false
S1. If two CFGs are equivalent, then either
both of them are unambiguous or both of
them are ambiguous

S2: The grammar S->aB|AB, A->aB|a, B->b,


is in Chomsky Normal Form:

(A) S1 and S2 both are true


(B) S1 true and S2 false
(C) S1 and S2 both are false
(D) S1 false and S2 true
Q.N Which of the following pairs of family are not Conc B. NPDA and
o:6 equivalent? ept 6 DPDA

(A) NFA and DFA


(B) NPDA and DPDA
(C) Deterministic single tape TM and
Nondeterministic single tape TM
(D) Single tape TM and Multi tape TM
Which one of the following grammars Conc D. S -> AC | CB,
generate the language L = { an bm | n ≠ m } ept 6 C ->aCb | λ, A
(A) S -> AC | CB, C ->aCb | a | b, A ->aA | ->aA | a, B -> Bb
λ, B -> Bb | λ |b
(B) S ->aS | Sb | a | b
(C) S -> AC | CB, C ->aCb | λ, A ->aA | λ,
B -> Bb | λ
(D) S -> AC | CB, C ->aCb | λ, A ->aA | a,
B -> Bb | b
Given context-free grammars that generate Conc A. 0S0 | 1S1 | λ
the following languages ept 6
{ w ∈ {0, 1}∗ | w = wR and |w| is even }
(A) S → 0S0 | 1S1 | λ
(B) S → aSa | bSb | λ
(C) S → λ
(D) S → 1S0 | 0S1 | λ
Given context-free grammars that generate Conc B. S → 0S0 |
the following language ept 6 0S1 | 1S0 | 1S1 |
{ w ∈ {0, 1}∗ | the length of w is odd and the 0
middle symbol is 0 }
(A) S → 0S0 | 1S1 | λ
(B) S → 0S0 | 0S1 | 1S0 | 1S1 | 0
(C) S → λ
(D) S → 1S0 | 0S1 | λ
Consider the following two statements
(B) Both S1 and
Q.N Conc
S2 are true
o:7 S1. Given any NFA, there exists an ept 7
equivalent NPDA

S2. Given any NPDA, there exists an


equivalent Turing Machine

Which one of the following is true?

(A)S1 is false and S2 is true


(B)Both S1 and S2 are true
(C) Both S1 and S2 are false
(D)S1 is true and S2 is false

Consider the following two statements Conc C. Both S1


ept 7 and S2
S1. Given any Turing machine, there are false
exists an equivalent NPDA

S2. Given any NPDA, there exists an


equivalent DPDA

Which one of the following is true?


(A)S1 is false and S2 is true
(B)Both S1 and S2 are true
(C) Both S1 and S2 are false
(D)S1 is true and S2 is false

Consider language L= L1∩L2, where Conc C. Context free


L1={ ambmanbn | m, n≥0} ept 7 but not regular
L2={ axbycz | x, y, z≥0}
The language L is:
(A) Not context free
(B) Regular
(C) Context free but not regular
(D) Recursively enumerable but not
context free.
Consider languages L= L1∩L2, where Conc A. L1 and
L1={ anbmcn+m | m, n≥0} ept 7 L2 are
L2={ anbncm | n, m ≥0} context
L3={ anbnc2n | n ≥0} free
Which of the following statement is true?
A. L1, L2 are context free
B. L1, L3 are context free
C. L3= L1∩L2
D. L1, L3 are context free but not L2.

SECTION-B(Answer Any Three Questions. Each Question carries 12


Marks)

Time: 1 Hour and 30 Minutes (3×12=36 Marks)

8. (i) Convert the given NFA to DFA. Find equivalent DFA that has minimum number of states
from the obtained DFA.

8. (ii) Construct a left-linear and a Right-linear grammar equivalent to your DFA. Find a regular
expression for the DFA.
8. (i) Convert the following NFA to DFA. Find equivalent DFA that has minimum number of
states.
.

8. (ii) Construct a left-linear and a Right-linear grammar equivalent to the DFA. Find a regular
expression for the DFA.

8. (i) Convert the following NFA to DFA. Null transition is from state q1 to q3. Find equivalent
DFA that has minimum number of states.

8. (ii) Construct a left-linear and a Right-linear grammar for the DFA. Find a regular expression for
the DFA.

9. (i) Transform the CFG into Chomsky normal form (CNF) and Greibach Normal form (GNF).

S → AB|aB,
A → abb|λ,
B → bbA

9. (ii) Design a DFA that accepts the language generated by the following grammar. Find a
left-linear grammar for the DFA.
S → abA,
A → baB,
B → aA|bb.

9. (i) Transform the following CFG into Chomsky normal form (CNF) and Greibach Normal form
(GNF).

S → ASA|aB
A → B/S
B → b/ λ

9. (ii)
Find a regular grammar that generates the language
L = {w ∈ {a, b}∗ : na (w) + 3nb (w) is odd} .

9 (i) Transform the following grammar into Chomsky normal form(CNF) and Greibach Normal
form(GNF).

S → baAB,
A → bAB|λ,
B → BAa |A| λ

Q9. (ii)
Find a regular grammar for the language L = {anbm : n + m is odd}.

10. (i) Design an NPDA for the language L = { ambncp : m, n, p ≥ 1 and m = n + p }.

10. (ii) Find an NPDA that accepts L = {anb2n : n ≥ 3}


10. (i) Design an NPDA for the language, L = { 0m1n2p : m, n, p ≥ 1 and n = m + p}.

10. (ii) Design an NPDA for the language, L = { an+2bncc : n ≥ 1 }.


10. (i) Construct an NPDA corresponding to the grammar
S → aABB|aAA,
A → aBB|b,
B → bBB|A.

10. (ii) Design an NPDA for L = { anbmcm+n : m, n ≥ 1 }.


11(i) Design a Turing machine for the language, L = { cmanbn : m, n ≥ 1 }.

11(ii) Using pumping lemma for context-free-languages prove that the language
L = { w : na(w) = nb(w) = nc(w) + 2 } is not context-free.

11(i) Design a Turing machine for the language of all binary strings that
starts with aa and ends with bb.
11(ii) Using pumping lemma for context-free-languages prove that the language
L = { w : 2na(w) = nb(w) = nc(w) } is not context-free.
11(i) Design a Turing machine for the language L = { anbnc2n: m, n ≥ 1 }.

11(ii) Using Pumping lemma for regular languages prove that the language
L = { w : na(w) =2 nb(w) + 1 } is not regular.

You might also like