0% found this document useful (0 votes)
309 views14 pages

TYBSc CS TCS QB

The document discusses topics related to finite automata and regular languages including proper prefixes and suffixes, epsilon-closure, DFAs, NFAs, regular expressions, pumping lemma, context-free grammars and languages, Chomsky hierarchy, derivation trees, and converting grammars to different normal forms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
309 views14 pages

TYBSc CS TCS QB

The document discusses topics related to finite automata and regular languages including proper prefixes and suffixes, epsilon-closure, DFAs, NFAs, regular expressions, pumping lemma, context-free grammars and languages, Chomsky hierarchy, derivation trees, and converting grammars to different normal forms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Chapter 1: Finite Automaton

1 Mark(20 questions)
1. What are the proper prefix and proper suffix of the string ‘‘India’’?
2. Define DFA.
3. If A = {∈}. Find the value of |A|.
4. Differentiate between Moore and Mealy machine.
5. Define suffix of a string. Give one example.
6. DFA may have many final states. Comment.
7. Construct Melay machine which toggles its input.
8. State True or False. Finite Automata has an infinite number of states.
9. Write down the ∈-closure of each state from the following FA.

10. Give the mapping of ‘δ’ function of NFA with ∈ moves.


11. state true or false - DFA can have ∈ moves
12. Give the language accepted by the following FA :

13. Define Kleene Closure.


14. Define Alphabet.
15. State True or False – A Prefix of a string is the string formed by taking any number of symbols of
the string.
16. Write down the ∈ closure of each state from the following FA:

17. Compare output function ‘λ’ function of Mealy and Moore machine.
18.
19. Give the purpose of Mealy and Moore machine.
20. Give the formal definition ∈−NFA.
21. State true or false – DFA can have any numbers of transitions to the next state from a given state
on given symbol.
22. Enlist the tuples of Mealy and Moore Machine.
23. Define Formal Language.
24. Define String.
25. Define Symbol.
26. Give the formal definition NFA.
27. Define minimization of FA
28. What is Finite Automata ? Enlist its type.
29. What is a null string?
30. What is length of string?

4 Marks (30 Problems)


1. Construct a DFA over Σ = {p,q,r} having substring “rqp” or “rpq”
2. Construct a DFA for a language L1∩L2
L1= { All strings starting with ‘a’}
L2= { All strings not having ‘ab’ as substring}
3. Construct a Moore machine for the language L over Σ = {0, 1 } which outputs ‘*’ if the string contains ‘11’
in it and outputs ‘#’ otherwise.
4. Compare DFA and NFA.
5. Minimize the following DFA :
M = ({q0, q1, q2, q3, q4, q5, q6, q7}, {0, 1}, δ, q0, {q1})
where ‘δ’ is given by :

6. Construct a Moore machine for a language L over {0, 1} which outputs ‘$’ if string ends with ‘100’, outputs
‘#’ if string ends with ‘001’, otherwise outputs ‘*’.
7. Convert the following NFA with ∈ moves to DFA.
8. Construct minimal DFA for the following:
M = ({A, B, C, D, E}, {0, 1}, δ, A, {E})
when δ is given by

9. Construct a mealy machine to convert each occurrence of substring 101 by 100


over alphabet {0, 1}.
10. Convert the following NFA to DFA :

11. Construct the minimize DFA for the following DFA


M = ({q0, q1, q2, q3, q4}, {a, b}, δ, q0 {q2, q4})

12. Construct minimal DFA for the following


13. Construct minimal DFA for the following

14. Construct a Moore and Mealy Machine which outputs “valid” for valid string and “invalid” for invalid
String for Language L= a(a+b)*b
15. Design a DFA in which every ‘b’ is preceded by ‘a’ over {a,b,c}
16. Construct minimal DFA for the following

17. Design a mealy machine over {a,b,c} if input ends with ‘bac’ print A else print B.
18. Construct a DFA equivalent to NFA

19. Construct a DFA which accepts odd numbers of 1’s and even numbers of 0’s over {0,1}.
20. Construct a DFA to accept all the string over {0,1} such that every pair of adjacent 0’s appears before any
pair of adjacent 1’s
21. Construct a DFA over {0,1} whose second and second last symbol is 1.
22. Describe DFA as a pattern recognizer in details
23. Construct minimal DFA for the following
24. Construct minimal DFA for the following

25. Construct DFA for the following NFA with ∈ -transitions:

26. Construct DFA for the following NFA with ∈ -transitions:


27. Construct DFA for the following NFA with ∈ -transitions:

28. Construct minimal DFA for the following:


M=({A,B, C, D, E, F, G, H), {0, 1), δ, A, (C}), where δ is

29. Convert the following NFA with ∈ -moves to DFA.

30. Find minimum state FA equivalent to the following DFA, M = ({qo, ..., qs}. (a, b}. , δ, qo,{q4,q5})
5 Marks (10 Problems)
1. Construct a DFA to accept the set of all strings over {0, 1, 2} such that the string ends with ‘012’ or ‘20’.
2. Convert the following given NFA to DFA :

3. Construct a DFA for a language


L = {x | x has neither “aa” nor “bb” as a substring} over {a, b}.
4. Construct DFA containing all string starting with 01 and having 012 as substring.
5. Construct DFA accept a substrings having both aa and bb over {a, b}.
6. Construct a DFA for a language which contains all strings endings with “ab” or “bc” over {a,b,c}
7. Construct a DFA equivalent to following NFA
M=({p,q r,s}, {0,1},p, δ,{q,s})

8. Construct DFA which accepts all strings over {a,b,c} such that if it starts with ‘a’ then it should
contain even numbers of ‘b’. Else if it starts with ‘c’ then itshould contain substring ‘cba’ in it.
9. Construct a DFA for language over {0,1,2} which accepts all strings containing at least one
occurrences of a double symbol.
10. Design a DFA which checks whether given number(decimal) is divisible by 3

Chapter 2 Regular Expressions and Languages

1 Mark(10 questions)
1. Define regular expression.
2. Which tool is used to prove that the language is not regular ?
3. Write the smallest possible string accepted by regular expression : (0 + 1)* 01*.
4. State true or false. Pumping lemma is used to show that language is not context tree.
5. State true or false => Every FA can have regular Expression.
6. Write smallest possible string accepted by the following regular expression. 10 + (0 + 11)0*1
7. Define Regular Language
8. What is purpose of pumping Lemma?
9. Enlist closure properties of regular Languages
10. State true or false => (R*)*=R*

4 Marks (10 Problems)


1. Construct a FA for RE : (01+10)*+11.
2. Using Pumpping Lemma prove that L={Op / p is prime} is regular or not
3. Show that L = {0n1n | n>=1} is not regular.
4. Construct a FA for the given RE : (a*b + b*a).ab + ba.b*.
5. Construct FA for regular expression:
(0 + 1)* 01 + (1 + 0)* 11
6. Construct FA for regular expression: 10*+0*1
7. Construct a FA for regular expression: ab(a+b)* + ba (a+b)*
8. Construct a FA for regular expression: (01)* + (0+1)*0*13
9. Prove that L= {anb2n+1 | n > 0} is not regular
10. Construct a FA for regular expression: ab(a+b)* + ba (a+b)*

Chapter 3: Context-Free Grammars and Languages


1 Mark(20 questions)
1. Define unit production with example
2. Define right linear and left linear grammar
3. Define ambiguous grammar.
4. What are the types of grammar in Chomsky hierarchy ?
5. Define left linear and right linear grammar.
6. Name the types of normal forms of grammar.
7. Write a language for CFG :
S -> aSa|bSb|a|b|∈.
8. State lemma 2 for converting a CFG to GNF.
9. Define Derivation tree
10. Show that CFL’s are closed under concatenation
11. Consider the following grammer
S-> ADa
A->a
D->d
The grammer is in CNF? Justify
12. Define useless Symbol
13. Define ∈ Production
14. Provide an example of a derivation and reduction in a grammar.
15. Which type of language includes context-free languages?
16. Give an example of a production rule in a CFG.
17. What are the main components of a CFG?
18. Name one aspect of CFG simplification.
19. What is the purpose of removing unit productions in CFG simplification?
20. Define nullable symbols in CFG simplification.

4 Marks (30 Problems)


1. Construct the following CFG into Normal Form (CNF)
S-> ABA
A-> aA | ∈
B-> bB | ∈
2. Rewrite the following CFG after eliminating useless symbols :
S -> 0A0
A -> S1|1CC|D0A
C ->011|DD
E -> 0C
D ->0DA
3. Construct CFG for
(a) {anbm |n, m > 0}
(b) {anbnci | n > i, i > 0}.
4. Construct CFG for the following : A language containing string having at least
one occurrence of 11 over {0, 1}.
5. Write a short note on Chomsky hierarchy
6. Show that following CFG is ambiguous
S->a |abSb|aAb
A->bS|aAAb
7. Write a Short note on Simplification of CFG
8. What is GNF and CNF .
9. Define a context-free grammar (CFG) and its key components. Provide an example of a CFG, and explain
how it can be used to generate a set of valid language strings.
10. Define left linear and right linear grammars and provide examples of each. Explain how they differ and their
significance in language theory and parsing.
11. Generate a string using leftmost derivation (LMD) and rightmost derivation (RMD) for the input string
"00111". for the following grammar
S-> 0S1| ∈
12. Simplify the following CFG by removing unit productions, ε-productions, and useless symbols.
S -> AaB
A -> Bc | ε
B -> a
C -> aC | ε
13. Convert the following grammar into CNF
S->bA|aB
A-> bAA|aS|a
B-.aBB|bS|b

14. Construct the following CFG into GNF


S-> AA|a
A-> SS | b
15. Convert the following Grammer into CNF
S->A|B|C
A->aAa|B
B->bB|bb
C-.aCaa|D
D->baD|abD|aa
16. COnsider the following Grammer
S->aB|bA
A->aS|bAA|a
B->bS|aBB|b
for the string “aaabbabba” find
a) Leftmost Derivation
b) Rightmost Derivation
c) Parse Tree
17. Explain equivalence of FA and regular grammar with example.
18. COnsider the following Grammer
S->A*B|*A
A->#B|B#
B->*A|#
for the string “#*##*#” find
a) Leftmost Derivation
b) Rightmost Derivation
c) Parse Tree
19. Convert the following CFG into CNF
S->abAB|bAda
A-> baB|a
B-> CAb|Bb
20. Convert the following CFG into GNF
S->aSd|aAd
A-> bAc|bc
21. Convert the following CFG into GNF
S->AB
A-> BS|b
B->SA|a
22. S-> ABC|Bab
A-> aA|BaC|aaa
B-.>bBb|a|D
C->CA|AC
D->∈
a) Eliminate ∈ production
b) Eliminate any unit Production
c) Eliminate any useless Symbol
d) Convert into CNF
23. What is reduction? Describe with example
24. Prove that CFL are not closed under intersection
25. Construct a regular grammar for the following language
01*((01)(10))* + 1(10)*
26. Construct CFG for the following
A Language containing string having atleast one occurrence of “11” over {o,1}

27. Convert the following CFG into CNF


S-> aSa|bSb|a|b|aa|bb
28. Construct a leftmost and rightmost derivation for “ababa” and draw parse tree
S->AS|a
A->SA|b
29. Eliminate the ∈ production from the following grammer
S->AB|∈
A-.aASb|a
B-> bs
30 Show that CFL are closed under the following properties
a) Union
b) Concatenation
c) closure

5Marks (10 Problems)


1. Construct CFG for language L = {anbmcmdn|n >=1, m >= 1}.
2. Construct the following CFG into Chomsky Normal Form (CNF)
S -> A a B | a
A -> S B b | bA
B -> B a | b

3. Convert the following grammer in GNF :


S -> AB | B
A -> BS
B -> AI|I
4. Construct the following CFG into Chomsky Normal Form (CNF)
S-> aSa|bSb|a|b|aa|bb
5. Convert the following grammer in GNF :
S -> aAS| a
A -> SbA|SS|bA
6. Construct CFG for language L =L1L2
L1 = {anb | n>=0}
L2 = {bmc |m>=0}
7. Convert the following grammer in CNF :
S -> ABA
A -> aA |∈
B -> bB|∈
8. Construct CFG for L= {anbn+2 |n,>= 0}
9. Convert following CFG into GNF
S -> 0AB|A|B
A ->S0B|1B|1
B ->A1|0
10. Convert the following CFG into Chomsky Normal Form (CNF):
S -> Aa | Bb
A -> SAb | ε
B -> Ba

Chapter 4: Push Down Automata


1 Mark(10 questions)
1. State two differences between PDA and FA.
2. Give formal definition of Push down Automata.
3. Define ID for PDA.
4. Write a mapping of δ in PDA.
5. Which component used in PDA for temporary storage of symbols
6. State True or False -> Every PDA accepts only CFL
7. Name the type of Languages accepted by PDA
8. Why PDA is more powerful than FA?
9. State True or False => A DPDA which accepts by empty stack cannot accept all regular languages
10. Define : a) DPDA b) NPDA
4 Marks (10 Problems)
1. Construct a PDA for L={ anb2n} over Σ = {a, b}.
2. Construct a PDA for the language L = {0n1m2n+m| n,m>=1}
3. Construct a PDA for L = {0m1n2n0m|m >=1, n >=1}.
4. Construct PDA equivalent to the given CFG :
S -> aAb|aS
A -> Bb|a
B -> Sa|b

5. Construct PDA for L = {anb2n+1 | n > 1}


6. Construct PDA equivalent to the given CFG.
S ->b A B | a B
A -> a A B | a
B ->a B B | b
7. Construct a PDA for L = {anb2n ck|n > 1, k > 1}.
8. Construct PDA that accept langauge as S ->aS|aSbS|a.
9. Construct PDA equivalent to the given CFG :
S -> aAbb|AB
A -> bbB|b|ab
B -> BbA|b|aB
10. Construct PDA equivalent to the given CFG :
S -> AA
A -> 0A0 |A1|1

Chapter 5: Turing Machine


1 Mark(10 questions)
1. Define Turing Machine (T.M.).
2. State two differences between TM and LBA.
3. Write the tuples of LBA.
4. Write the tuples of Turing Machine
5. List the types of Turing machines
6. What is two way Turing machine?
7. Enlist the languages accepted by Turing Machine
8. Write a mapping of δ in Turing machine.
9. State True or False - For Turing machines tape head moves to only right side.
10. State True or False - A Language is recursive if it is decided by Turing Machine.
5Marks (10 Problems)
1. Design TM for language, L {WCWR|W is in (0+1)*}
2. Construct TM for language
L = {am bn | n > m, m > 1}
3. Construct TM accepting language
L = { am bn cm+n | m, n > 0}.
4. Design a TM to recognize well-formedness of parenthesis( ).
5. Construct Turing machine for L = { an bn cn | n >= 1}.
6. Construct Turing machine for a language which contains equal numbers of a’s and b’s.
7. What is LBA? Describe in detail.
8. What is non deterministic Turing machine? Explain with Example.
9. What is two way Turing machine? Describe with diagram and example
10. Construct Turing machine for L = { an b an | n >= 0}.

You might also like