0% found this document useful (0 votes)
46 views260 pages

Pdf24 Merged

Uploaded by

randomotakuguy29
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)
46 views260 pages

Pdf24 Merged

Uploaded by

randomotakuguy29
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/ 260

UNIT-I: FINITE AUTOMATA

1. Analytically, a finite automaton can be represented by a _________ tuples:


a. 6
b. 4
c. 5
d. 7

2. Final state(s) may not be a part of the given states of a finite automaton.
a. True
b. False
c. Both
d. None of These

3. Transition Systems is the other name given to:


a. Transition table
b. Transition diagram
c. States of automata
d. Automata as a whole

4. Implicitly, δ(q,^) = _______


a. q
b. ^
c. Initial state
d. Final state

5. For any transition function δ and for any two input strings x and y, δ(q, xy) = _________
a. δ(q, x).δ(q, y)
b. δ(q, yx)
c. δ(q, x)×δ(q, y)
d. δ(δ(q, x),y)

6. DFA stands for:


a. Deterministic Final Automata
b. Deterministic in-Finite Automata
c. Determined Finite Automata
d. Deterministic Finite Automata

7. The function Z(t) = λ(q(t), x(t)) represents:


a. Moore Machine
b. Deterministic Finite Automata
c. Mealy Machine
d. Non-Deterministic Finite Automata

8. The function Z(t) = λ(q(t)) represents:


a. Moore Machine
b. Deterministic Finite Automata
c. Mealy Machine
d. Non-Deterministic Finite Automata

9. In a transition table, initial state is depicted by which of the following symbol?


a. Arrow pointing to a state(→)
b. Circle over a state
c. Concentric circles over a state
d. Underlined state

10. NDFA stands for:


a. Non-Deterministic Final Automata
b. Non-Finite Deterministic Automata
c. Non-Deterministic Finite Automata
d. Non-Determined Finite Automata
11. Final state in a Transition Diagram is depicted by:
a. Arrow pointing to a state(→)
b. Circle over a state
c. Concentric circles over a state
d. Underlined state

12. Minimization of Finite automata means:


a. Converting an NDFA into a DFA
b. Reducing number of states in a finite automata
c. Creating finite automata with minimum number of final states
d. Reducing number of transitions in a finite automata

Answer keys: Unit-I

1. c
2. b
3. b
4. a
5. d
6. d
7. c
8. a
9. a
10. c
11. c
12. b

UNIT-II: REGULAR EXPRESSIONS AND REGULAR SETS

1. Machine format of Regular Expression is


a. Finite Automata
b. Push Down Automata
c. Turing Machine
d. All of the above

2. Regular Expression is accepted by


a. Finite Automata
b. Push Down Automata
c. Turing Machine
d. All of the above

3. The language of all words with atleast2 a's can be described by the Regular Expression
a. a(ab)*a
b. (a + b)*ab*a(a + b)*
c. b*ab*a(a + b)*
d. All of the above

4. Which type of language is Regular Expression?


a. Type 0
b. Type 1
c. Type 2
d. Type 3.
5. Which of the following Regular Expression over {0,1} denotes set of all strings not containing 100 as
substring?
a. (1 + 0)*0*
b. 0*1010*
c. 0*1*01
d. All of the above.

6. ^+ RR*= ?
a. R
b. R*
c. R+
d. ^

7. If L= language of words containing even number of a’s. The corresponding Regular Expression is:
a. (a+b)*aa(a+b)*
b. (b+ab*a)*
c. a+bb*aab*a
d. (a+b)*ab(a+b)*

8. The language that can be expressed by any regular expression is called aNon-regular language.
a. True
b. False

9. Arden’s theorem states that if R = Q + RP, then _________is its unique solution.
a. R = QP*
b. R = PQ*
c. R = P*Q*
d. R = Q*P*

10. The regular expression described by following automata is,

a. 01*01*
b. (01)*
c. 0*1*
d. 1*0*

11. Which of the following are the examples of non-regular languages.


a. PALINDROME and PRIME
b. PALINDROME and EVEN-EVEN
c. EVEN-EVEN and PRIME
d. FACTORIAL and SQURE

12. Languages are proved to be regular or non-regular using pumping lemma.


a. True
b. False

Answer keys: Unit-II

1. a
2. a
3. d
4. d
5. c
6. b
7. b
8. b
9. a
10. c
11. a
12. a

UNIT-III: FORMAL LANGUAGES AND REGULAR GRAMMARS

1. Noam Chomsky gave a mathematical model of a grammar in:


a. 1966
b. 1956
c. 1946
d. 1976

2. A grammar is also called a _________structured grammar.


a. Phrase
b. Pre
c. Parse
d. Class

3. The elements of VN in a grammar are called:


a. Terminals
b. Starting Symbols
c. Variables
d. Production rules

4. For any grammar G = (VN, Σ, P, S), VN ∩ Σ = __________


a. Σ
b. VN ∪ Σ
c. ϴ
d. VN

5. S in a grammar G = (VN, Σ, P, S) is called the:


a. Stop symbol
b. Special symbol
c. Syntax symbol
d. Start symbol

6. Grammatical rules which involve the meaning of words are called:


a. Semantics
b. Syntactic
c. Both a and b
d. None of given

7. Grammatical rules which do not involve the meaning of words are called:
a. Semantics
b. Syntactic
c. Both a and b
d. None of given

8. The symbols in a grammar that can’t be replaced by anything are called:


a. Productions
b. Terminals
c. Non-terminals
d. All of above

9. The symbols in a grammar that must be replaced by other things are called:
a. Productions
b. Terminals
c. Non-terminals
d. None of given

10. The grammatical rules are often called:


a. Productions
b. Terminals
c. Non-terminals
d. None of given

11. The terminals are designated by _____letters, while the non-terminals are designated by ____letters.
a. Capital, bold
b. Small, capital
c. Capital, small
d. Small, bold

12. L(G) is an acronym used for:


a. Leaves of derivation tree for a grammar G
b. Length of a grammar G
c. Left hand symbols of all productions in G
d. Language generated by a grammar G

Answer keys: Unit-III

1. b
2. a
3. c
4. c
5. d
6. a
7. b
8. b
9. c
10. a
11. b
12. d

Unit 1V :CONTEXT FREE GRAMMARS AND SIMPLIFICATION OF CONTEXT- FREE GRAMMARS


1. Consider the following CFG
S → aB
S → bA
B→b
A→a
B → bS
A → aS
B → aBB
A → bAA

Now consider the following derivation


S ⇒ aB
⇒ aaBB
⇒ aaBb
⇒ aabSb
⇒ aabbAb
⇒ aabbab

This derivation is
a. a leftmost derivation
b. a rightmost derivation
c. both leftmost and rightmost derivation
d. neither leftmost nor rightmost derivation

2. The following CFG is in


S → AB
B → CD
B → AD
B→b
D → AD
D→d
A→a
C→a

a. Chomsky normal form but not strong Chomsky normal form


b. Weak Chomsky normal form but not Chomsky normal form
c. Strong Chomsky normal form
d. Greibach normal form

3. The following CFG is in


S → aBB
B → bAA
A→a
B→b
a. Chomsky normal form but not strong Chomsky normal form
b. Weak Chomsky normal form but not Chomsky normal form
c. Strong Chomsky normal form
d. Greibach normal form

4. Which of the following CF language is inherently ambiguous?


a. {anbncmdm|n, m ≥ 1}
b. {anbmcpdq|n = p or m = q, n, m, p, q ≥ 1}
c. {anbmcpdq|n ≠ m ∧ p ≠ q}
d. {anbmcpdq|n ≠ m ∨ p ≠ q}

5. The concept of grammar is much used in this part of the compiler


a. lexical analysis
b. parser
c. code generation
d. code optimization

6. Which of the following strings is not generated by the following grammar? S → SaSbS|ε
a. aabb
b. abab
c. aababb
d. aaabb

7. Which of the following statement is wrong?


a. Any regular language can be generated by a context-free grammar
b. Some non-regular languages cannot be generated by any CFG
c. the intersection of a CFL and regular set is a CFL
d. All non-regular languages can be generated by CFGs
8. Which one of the following statement is FALSE?
a. context-free languages are closed under union
b. context-free languages are closed under concatenation
c. context-free languages are closed under intersection
d. context-free languages are closed under Kleene closure
9. The context free grammar is ambiguous if
a. the grammar contains useless non-terminals
b. it produces more than one parse tree from some sentence
c. some production has two non-terminals side by side on the right hand side
d. none of the above

10. If S → aXb|b XaX → aX|bX|Λ. The given CFG generates the language in English
a. Beginning and ending in different letters
b. Beginning and ending in same letter
c. Having even-even language
d. None of given

11. The CFG is not said to be ambiguous if there exists atleast one word of itslanguage that can be
generated
by the different production trees,
a. TRUE
b. FALSE

12. The language generated by that CFG is regular if _________


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

Answer Keys: Unit IV

1. d
2. c
3. d
4. b
5. b
6. d
7. d
8. c
9. b
10. a
11. b
12. c

Unit V PUSHDOWN AUTOMATA AND PARSING


1. PDA is the machine format of
a. Type-0 language
b. Type-1 language
c. Type-2 language
d. Type-3 language

2. Which is not true for mechanical diagram of PDA?


a. PDA contains a stack
b. The head reads as well as writes
c. The head moves from left to right
d. Input string is surrounded by infinite number of blank in both side.

3. The difference between finite automata and PDA is in .


a. Reading Head
b. Input tape
c. Finite Control
d. Stack

4. A _____ operator adds a new letter at the top of STACK


a. PUSH
b. POP
c. READ
d. APPEND

5. PDA stands for ________


a. Push and Drop Automaton
b. Pop and Drop Automaton
c. Push Down Automaton
d. None of given options

6. PDS stands for ________


a. Push and Drop Store
b. Pop and Drop Stack
c. Pop Down Stack
d. Push Down Store

7. The symbol τ in Pushdown automata represents:


a. Finite nonempty set of states
b. Finite nonempty set of pushdown symbols
c. Finite nonempty set of blank symbols
d. Finite nonempty set of final states

8. _______is a special symbol called the ‘initial symbol’ on pushdown store.


a. Z
b. S
c. Z0
d. S0

9. T(A) = { w ϵ Σ* | (q0,w,Z0) ⊢* (qf, ^, α) for some qfϵ F and α ϵ τ*) defines acceptance of a PDA by:
a. Null Store
b. Final state
c. Null Set
d. Empty Store

10. N(A) = { w ϵ Σ* | (q0,w,Z0) ⊢* (q, ^, ^) for some qϵ Q) defines acceptance of a PDA by:
a. Null Store
b. Final state
c. Null Set
d. Final Store

11. The language accepted by PDA is:


a. Context Sensitive language
b. Regular language
c. Context Free language
d. Unrestricted language

12. For a given context free grammar, we can construct an equivalent Pushdown automata:
a. True
b. False

Answer keys: Unit-V

1. c
2. d
3. d
4. a
5. c
6. d
7. b
8. c
9. b
10. a
11. c
12. a

Unit VI: TURING MACHINES AND COMPLEXITY

1. Turing Machine is the machine format of_________language


a. Type 0
b. Type 1
c. Type 2
d. Type 3

2. Which is not a part of the mechanical diagram of Turing Machine?


a. Input tape
b. Read-write head
c. Finite Control
d. Stack

3. Difference between Turing Machine and Two-way Finite Automata is in


a. Input Tape
b. Read-write head
c. Finite Control
d. All of these

4. Difference between Turing Machine & Push down automata is in


a. Input Tape
b. Finite Control
c. Stack
d. All of these

5. Which is not true for mechanical diagram of Turing Machine:


a. The head moves in both directions
b. The head reads as well as writes
c. Input string is surrounded by infinite number of blank in both sides
d. Some symbols are pushed into the stack
6. A Turing machine contains ________tuples.
a. 5
b. 6
c. 7
d. 8

7. The symbol τ in a Turing machine M = (Q, Σ, τ, δ, q0, b, F) represents:


a. Finite nonempty set of states
b. Finite nonempty set of tape symbols
c. Finite nonempty set of blank symbols
d. Finite nonempty set of final states

8. The read-write head in a Turing machine model can move only in one direction:
a. True
b. False

9. Turing machines are named after the mathematician named:


a. Alan
b. Noam
c. James
d. Albert

10. Turing machines can be represented by:


a. Instantaneous descriptions
b. Transition Table
c. Both a and b
d. None of above

11. So as to move from one ID to another in a Turing machine, we use ________ symbol:

a. ⊢
b. :=
c. →
d. ⇒

12. A Turing machine is represented by a Transition Table by αβγ where α represents:


a. The direction of the read/write head
b. The symbol to be changed under read/write head
c. The state to be changed
d. None of the above

Answer Keys: Unit VI:

1. a
2. d
3. b
4. c
5. d
6. c
7. b
8. b
9. a
10. c
11. a
12. b
UNIT-I: FINITE AUTOMATA

1. While minimizing a finite automata, we generally create the:


a. Equivalence states
b. Equivalence transitions
c. Equivalence classes
d. Equivalence groups

2. A Moore machine is a six-tuple (Q, Σ, Δ, δ,λ, q0) where Δ is the:


a. Output alphabet
b. Input alphabet
c. Transition function
d. Output function

3. A finite automata may contain more than one final states:


a. True
b. False

4. The number of columns in a transition table for a finite automata are:


a. Three
b. One less than the number of input symbols
c. Same as the number of input symbols
d. One more than the number of input symbols

5. The transition function that maps Q X Σ* into Q is called:


a. Direct transition function
b. Indirect transition function
c. Simple transition function
d. Directed transition function

6. When next state of an automata at any instant of time is determined by the present state and the present
input, then it is called a:
a. State relation
b. Output relation
c. Set of states
d. Set of input symbols

7. A string x is accepted by a finite automata if δ(q0,x) = q; where q is:


a. Initial state
b. Final state
c. Any state
d. None of the above

8. Q is a set of states in finite automata. What holds true for Q:


a. Q may contain any number of states
b. Q contains finite number of states
c. Q does not contain any final state
d. Q in not a set of states.
9. Determine the Equavent Machine that takes present state and output
a. Moore
b. Mealy
c. Both
d. None
10. How many tuples are there in Finite Automata
a. 4
b. 5
c. 6
d. 7
11. Minimized automata should be
a. DFA
b. NFA
c. Both
d. None
12. Finite Automata can deal with which langauge
a. Regular Languages
b. Context Free
c. Context Sensitive
d. Recursive Ennumerable

Answer keys: Unit-I

1. C
2. A
3. A
4. D
5. B
6. A
7. B
8. B
9. B
10. B
11. A
12. A

UNIT-II: REGULAR EXPRESSIONS AND REGULAR SETS


1. In pumping lemma theorem (xyiz) the range of i is
a. i=…….-3,-2,-1, 1, 2, 3, 4……
b. i=0, 1, 2, 3, 4……….
c. i=…….-3,-2,-1, 0, 1, 2, 3, 4……
d. i=1, 2, 3, 4……….

2. To examine whether a certain FA accepts any words, it is required to seek the paths from _______state.
a. Final to initial
b. Final to final
c. Initial to final
d. Initial to initial

3. If Σ = {a,b} and given productions are


S→XaaX
X→aX| bX|Λ
Then the above grammar defines the language expressed by___________ regular expression
a. (a+b)*aa(a+b)*
b. (a+b)*a(a+b)*a
c. (a+b)*aa(a+b)*aa
d. (a+b)*aba+b)*

4. A regular expression can be defined as a language or string accepted by a finite automata.


a. True
b. False

5. If w BELONGS TO (a, b)* satisfy abw = wab, then (w) is


a. Null
b. Odd
c. Even
d. None of these

6. Identity: ^ + R = ________
a. ^
b. RR
c. R*
d. R

7. Identity: R + R = ________
a. 2R
b. RR
c. R
d. R*

8. Identity: (R*)* = ________


a. R**
b. R*R*
c. R*
d. R
9. The languages which can not accept PDA________
A. REGULAR LANGUAGES
B. CONTEXT FREE
C. CONTEXT SENSITIVE
D. NONE.

10. CONVERSION OF NFA TO DFA WILL LEAD TO HOW MANY INITIAL STATES
A. 2
B. 1
C. NONE
D. BOTH

11. How many strings of length less than 4 contains the language described by the regular expression (x+y)*y(a+ab)*?
a) 7
b) 10
c) 12
d) 11

12 . A language is regular if and only if


a) accepted by DFA
b) accepted by PDA
c) accepted by LBA
d) accepted by Turing machine

Answer keys: Unit-II

1. D 8. C
2. C 9. A
3. A 10. B
4. A 11. D
5. C 12. A
6. D
7. C
UNIT-III: FORMAL LANGUAGES AND REGULAR GRAMMARS

1. The highest type of grammar under Chomsky classification is:


a. Type-3
b. Type-4
c. Type-2
d. Type-0

2. Type-1 grammars are also called:


a. Phrase structure grammars
b. Context free grammars
c. Context sensitive grammars
d. Regular grammars

3. A production of the form A → a and A → aB is called a ___________ production.


a. Type-0
b. Type-3
c. Type-1
d. Type-2

4. The machine counterpart of Context Free Grammars is:


a. Finite automata
b. Pushdown automata
c. Turing machine
d. Linear bounded automata

5. The machine counterpart of Regular Grammars is:


a. Finite automata
b. Pushdown automata
c. Turing machine
d. Linear bounded automata

6. _______________is the corresponding automata for Context Sensitive languages:


a. Linear bounded automata
b. Turing machine
c. Finite automata
d. Pushdown automata

7. The symbol used for step by step derivation of a grammar is:


a. →
b. ⇒
c. ↔
d. ⇄
e.
8. Language generated by grammar G = ( {S, C}, {a, b}, P, S ) where P consists of S → aCa, C → aCa | b is:
a. abna
b. anbnan
c. abnan
d. anban
9. Regular grammar is
a) Context free grammar
b) Non context free grammar
c) English grammar
d) None of the mentioned
10. Regular expression are
a) Type 0 language
b) Type 1 language
c) Type 2 language
d) Type 3 language
11. L and ~L are recursive enumerable then L is
a) Regular
b) Context free
c) Context sensitive
d) Recursive
12. . Regular expressions are closed under
a) Union
b) Intersection
c) Kleene star
d) All of the mentioned

Answer keys: Unit-III

2. c 7. b 11. d
3. b 8. d 12. d
4. b
5. a 9. a
1. a 6. a 10. a
Unit 4 :CONTEXT FREE GRAMMARS + SIMPLIFICATION OF CONTEXT- FREE GRAMMARS

1. The production of the form no terminal → Λ is said to be null production.


a. TRUE
b. FALSE

2. A production is called null able production if it is of the form N → Λ


a. TRUE
b. FALSE

3. The productions of the form nonterminal → one nonterminal, is called _________


a. Null production
b. Unit production
c. Null able production
d. None of given

4. CNF is stands for


a. Context Normal Form
b. Complete Normal Form
c. Chomsky Normal Form
d. Compared Null Form

5. GNF stands for


a. Gray Normal Form
b. Greibach Normal Form
c. Graphite Normal Form
d. Greatest Normal Form

6. The derivation of the 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
a. Left most terminal
b. Left most deviation
c. None of these
d. Both a and b

7. The process of finding the derivation of word generated by particular grammar is called :
a. PLUS TIMING
b. Parsing
c. HALT
d. All of above

8. A production in CFG consists of:


a. One terminal
b. More than one terminal
c. One non-terminal
d. Terminals and non-terminals
9. The entity which generate Language is termed as:
a) Automata
b) Tokens
c) Grammar
d) Data
10. The Grammar can be defined as: G=(V, ∑, p, S)
In the given definition, what does S represents?
a) Accepting State
b) Starting Variable
c) Sensitive Grammar
d) None of these
11. Which of the expression is appropriate?
For production p: a->b where a∈V and b∈_______
a) V
b) S
c) (V+∑)*
d) V+ ∑
12. For S->0S1|e for ∑={0,1}*, which of the following is wrong for the language produced?
a) Non regular language
b) 0n1n | n>=0
c) 0n1n | n>=1
d) None of the mentioned

Answer Keys: Unit 4

5. b 10. B
1. a 6. b 11. C
2. a 7. b 12. d
3. b 8. d
4. c 9. C
Unit V: PUSHDOWN AUTOMATA AND PARSING

1. For a given Pushdown automata, we can construct an equivalent context free grammar:
a. True
b. False

2. In __________ parsing, we attempt to construct a derivation of the input string, starting from the root and ending
in the given input string.
a. Top-down
b. Top-Up
c. Bottom-Up
d. Bottom-Down

3. In __________ parsing, we attempt to construct a derivation from the given input string to the top ie, the root with
label S.
a. Top-down
b. Top-Up
c. Bottom-Up
d. Bottom-Down

4. In LL(k), the first L stands for__________:


a. Left
b. Look from right
c. Lost symbols
d. Look ahead

5. In LL(k), the second L stands for__________:


a. Look from right
b. Left
c. Lost symbols
d. Look ahead

6. In LL(k), k represents:
a. Number of symbols to look behind
b. Number of symbols to look ahead
c. Number of input symbols in the string
d. Number of symbols towards left of current symbol

7. In LL(k), the value of k can also be negative.


a. True
b. False

8. In order to do top-down parsing for a general string in L(G), we prepare a table called:
a. Transition table
b. Parse Table
c. Top-down Table
d. Production Table
9. The transition a Push down automaton makes is additionally dependent upon the:
a) stack
b) input tape
c) terminals
d) none of the mentioned
10. With reference of a DPDA, which among the following do we perform from the start state with an empty stack?
a) process the whole string
b) end in final state
c) end with an empty stack
d) all of the mentioned
11. If the PDA does not stop on an accepting state and the stack is not empty, the string is:
a) rejected
b) goes into loop forever
c) both (a) and (b)
d) none of the mentioned
12. A language accepted by Deterministic Push down automata is closed under which of the following?
a) Complement
b) Union
c) Both (a) and (b)
d) None of the mentioned

Answer keys: Unit-V

1. a 7. b
2. a 8. b
3. c 9. a
4. d 10. d
5. b 11. a
6. b 12. a
Unit V1: TURING MACHINES AND COMPLEXITY

1. A Turing machine can be:


a. Multi-Tape Turing Machine
b. Multi-head Turing Machine
c. Universal Turing machine
d. All of the above

2. A Turing machine can only be deterministic.


a. True
b. False

3. A Turing machine can be a Multi-Track Turing machine.


a. True
b. False

4. Who is known as the father of Computer Science?


a. S. C. Kleene
b. Alanzo Church
c. Charles Babbage
d. Alan Turing

5. A ____________ is a theoretical computing machine invented by Alan Turing (1937) to serve as an idealized
model for mathematical calculation.
a. Linear Bounded Automata
b. Turing Machine
c. Finite Automata
d. Pushdown Automata

6. A Turing machine can run forever, enter a loop, or reach a particular state or set of conditions at which it is
prescribed to halt.
a. True
b. False

7. In computer science, a _______________is a Turing machine that can simulate an arbitrary Turing machine on
arbitrary input.
a. Universal Turing machine
b. Deterministic Turing machine
c. Non- Deterministic Turing machine
d. Multi-Tape Turing machine

8. A ________ is the simplest form of a computer.


a. Finite Automata
b. Linear Bounded Automata
c. Turing Machine
d. Pushdown Automata
9. The machine accept the string by entering into hA or it can:
a) explicitly reject x by entering into hR
b) enter into an infinte loop
c) Both (a) and (b)
d) None of the mentioned

10. Which of the following can accept even palindrome over {a,b}
a) Push down Automata
b) Turing machine
c) NDFA
d) All of the mentioned
11. If T1 and T2 are two turing machines. The composite can be represented using the expression:
a) T1T2
b) T1 U T2
c) T1 X T2
d) None of the mentioned

12. The number of states required to automate the last question i.e. {a,b}*{aba}{a,b}* using finite automata:
a) 4
b) 3
c) 5
d) 6

Answer Keys: Unit V1:

1. d
2. b
3. a
4. d
5. b
6. a
7. a
8. c
9. c
10. c
11. a
12. a
UNIT-I: FINITE AUTOMATA

13. While minimizing a finite automata, we generally create the:


a. Equivalence states
b. Equivalence transitions
c. Equivalence classes
d. Equivalence groups

14. A Moore machine is a six-tuple (Q, Σ, Δ, δ,λ, q0) where Δ is the:


a. Output alphabet
b. Input alphabet
c. Transition function
d. Output function

15. A finite automata may contain more than one final states:
a. True
b. False

16. The number of columns in a transition table for a finite automata are:
a. Three
b. One less than the number of input symbols
c. Same as the number of input symbols
d. One more than the number of input symbols

17. The transition function that maps Q X Σ* into Q is called:


a. Direct transition function
b. Indirect transition function
c. Simple transition function
d. Directed transition function

18. When next state of an automata at any instant of time is determined by the present state and the present
input, then it is called a:
a. State relation
b. Output relation
c. Set of states
d. Set of input symbols

19. A string x is accepted by a finite automata if δ(q0,x) = q; where q is:


a. Initial state
b. Final state
c. Any state
d. None of the above

20. Q is a set of states in finite automata. What holds true for Q:


a. Q may contain any number of states
b. Q contains finite number of states
c. Q does not contain any final state
d. Q in not a set of states.
21. Determine the Equavent Machine that takes present state and output
a. Moore
b. Mealy
c. Both
d. None
22. How many tuples are there in Finite Automata
a. 4
b. 5
c. 6
d. 7
23. Minimized automata should be
a. DFA
b. NFA
c. Both
d. None
24. Finite Automata can deal with which langauge
a. Regular Languages
b. Context Free
c. Context Sensitive
d. Recursive Ennumerable

Answer keys: Unit-I

13. C
14. A
15. A
16. D
17. B
18. A
19. B
20. B
21. B
22. B
23. A
24. A

UNIT-II: REGULAR EXPRESSIONS AND REGULAR SETS


1. In pumping lemma theorem (xyiz) the range of i is
e. i=…….-3,-2,-1, 1, 2, 3, 4……
f. i=0, 1, 2, 3, 4……….
g. i=…….-3,-2,-1, 0, 1, 2, 3, 4……
h. i=1, 2, 3, 4……….

2. To examine whether a certain FA accepts any words, it is required to seek the paths from _______state.
e. Final to initial
f. Final to final
g. Initial to final
h. Initial to initial

3. If Σ = {a,b} and given productions are


S→XaaX
X→aX| bX|Λ
Then the above grammar defines the language expressed by___________ regular expression
e. (a+b)*aa(a+b)*
f. (a+b)*a(a+b)*a
g. (a+b)*aa(a+b)*aa
h. (a+b)*aba+b)*

4. A regular expression can be defined as a language or string accepted by a finite automata.


c. True
d. False

5. If w BELONGS TO (a, b)* satisfy abw = wab, then (w) is


e. Null
f. Odd
g. Even
h. None of these

6. Identity: ^ + R = ________
e. ^
f. RR
g. R*
h. R

7. Identity: R + R = ________
e. 2R
f. RR
g. R
h. R*

8. Identity: (R*)* = ________


e. R**
f. R*R*
g. R*
h. R
9. The languages which can not accept PDA________
A. REGULAR LANGUAGES
B. CONTEXT FREE
C. CONTEXT SENSITIVE
D. NONE.

10. CONVERSION OF NFA TO DFA WILL LEAD TO HOW MANY INITIAL STATES
A. 2
B. 1
C. NONE
D. BOTH
11. How many strings of length less than 4 contains the language described by the regular expression (x+y)*y(a+ab)*?
a) 7
b) 10
c) 12
d) 11

12 . A language is regular if and only if


a) accepted by DFA
b) accepted by PDA
c) accepted by LBA
d) accepted by Turing machine

Answer keys: Unit-II

13. D 20. C
14. C 21. A
15. A 22. B
16. A 23. D
17. C 24. A
18. D
19. C
UNIT-III: FORMAL LANGUAGES AND REGULAR GRAMMARS

13. The highest type of grammar under Chomsky classification is:


a. Type-3
b. Type-4
c. Type-2
d. Type-0

14. Type-1 grammars are also called:


a. Phrase structure grammars
b. Context free grammars
c. Context sensitive grammars
d. Regular grammars

15. A production of the form A → a and A → aB is called a ___________ production.


a. Type-0
b. Type-3
c. Type-1
d. Type-2

16. The machine counterpart of Context Free Grammars is:


a. Finite automata
b. Pushdown automata
c. Turing machine
d. Linear bounded automata

17. The machine counterpart of Regular Grammars is:


a. Finite automata
b. Pushdown automata
c. Turing machine
d. Linear bounded automata

18. _______________is the corresponding automata for Context Sensitive languages:


a. Linear bounded automata
b. Turing machine
c. Finite automata
d. Pushdown automata

19. The symbol used for step by step derivation of a grammar is:
a. →
b. ⇒
c. ↔
d. ⇄
e.
20. Language generated by grammar G = ( {S, C}, {a, b}, P, S ) where P consists of S → aCa, C → aCa | b is:
a. abna
b. anbnan
c. abnan
d. anban
21. Regular grammar is
a) Context free grammar
b) Non context free grammar
c) English grammar
d) None of the mentioned
22. Regular expression are
a) Type 0 language
b) Type 1 language
c) Type 2 language
d) Type 3 language
23. L and ~L are recursive enumerable then L is
a) Regular
b) Context free
c) Context sensitive
d) Recursive
24. . Regular expressions are closed under
a) Union
b) Intersection
c) Kleene star
d) All of the mentioned

Answer keys: Unit-III

14. c 19. b 23. d


15. b 20. d 24. d
16. b
17. a 21. a
13. a 18. a 22. a
Unit 4 :CONTEXT FREE GRAMMARS + SIMPLIFICATION OF CONTEXT- FREE GRAMMARS

13. The production of the form no terminal → Λ is said to be null production.


c. TRUE
d. FALSE

14. A production is called null able production if it is of the form N → Λ


c. TRUE
d. FALSE

15. The productions of the form nonterminal → one nonterminal, is called _________
e. Null production
f. Unit production
g. Null able production
h. None of given

16. CNF is stands for


e. Context Normal Form
f. Complete Normal Form
g. Chomsky Normal Form
h. Compared Null Form

17. GNF stands for


a. Gray Normal Form
b. Greibach Normal Form
c. Graphite Normal Form
d. Greatest Normal Form

18. The derivation of the 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
a. Left most terminal
b. Left most deviation
c. None of these
d. Both a and b

19. The process of finding the derivation of word generated by particular grammar is called :
a. PLUS TIMING
b. Parsing
c. HALT
d. All of above

20. A production in CFG consists of:


a. One terminal
b. More than one terminal
c. One non-terminal
d. Terminals and non-terminals
21. The entity which generate Language is termed as:
a) Automata
b) Tokens
c) Grammar
d) Data
22. The Grammar can be defined as: G=(V, ∑, p, S)
In the given definition, what does S represents?
a) Accepting State
b) Starting Variable
c) Sensitive Grammar
d) None of these
23. Which of the expression is appropriate?
For production p: a->b where a∈V and b∈_______
a) V
b) S
c) (V+∑)*
d) V+ ∑
24. For S->0S1|e for ∑={0,1}*, which of the following is wrong for the language produced?
a) Non regular language
b) 0n1n | n>=0
c) 0n1n | n>=1
d) None of the mentioned

Answer Keys: Unit 4

17. b 22. B
13. a 18. b 23. C
14. a 19. b 24. d
15. b 20. d
16. c 21. C
Unit V: PUSHDOWN AUTOMATA AND PARSING

1. For a given Pushdown automata, we can construct an equivalent context free grammar:
c. True
d. False

2. In __________ parsing, we attempt to construct a derivation of the input string, starting from the root and ending
in the given input string.
e. Top-down
f. Top-Up
g. Bottom-Up
h. Bottom-Down

3. In __________ parsing, we attempt to construct a derivation from the given input string to the top ie, the root with
label S.
e. Top-down
f. Top-Up
g. Bottom-Up
h. Bottom-Down

4. In LL(k), the first L stands for__________:


e. Left
f. Look from right
g. Lost symbols
h. Look ahead

5. In LL(k), the second L stands for__________:


e. Look from right
f. Left
g. Lost symbols
h. Look ahead

6. In LL(k), k represents:
e. Number of symbols to look behind
f. Number of symbols to look ahead
g. Number of input symbols in the string
h. Number of symbols towards left of current symbol

7. In LL(k), the value of k can also be negative.


c. True
d. False

8. In order to do top-down parsing for a general string in L(G), we prepare a table called:
e. Transition table
f. Parse Table
g. Top-down Table
h. Production Table
9. The transition a Push down automaton makes is additionally dependent upon the:
a) stack
b) input tape
c) terminals
d) none of the mentioned
10. With reference of a DPDA, which among the following do we perform from the start state with an empty stack?
a) process the whole string
b) end in final state
c) end with an empty stack
d) all of the mentioned
11. If the PDA does not stop on an accepting state and the stack is not empty, the string is:
a) rejected
b) goes into loop forever
c) both (a) and (b)
d) none of the mentioned
12. A language accepted by Deterministic Push down automata is closed under which of the following?
a) Complement
b) Union
c) Both (a) and (b)
d) None of the mentioned

Answer keys: Unit-V

13. a 19. b
14. a 20. b
15. c 21. a
16. d 22. d
17. b 23. a
18. b 24. a
Unit V1: TURING MACHINES AND COMPLEXITY

1. A Turing machine can be:


e. Multi-Tape Turing Machine
f. Multi-head Turing Machine
g. Universal Turing machine
h. All of the above

2. A Turing machine can only be deterministic.


c. True
d. False

3. A Turing machine can be a Multi-Track Turing machine.


c. True
d. False

4. Who is known as the father of Computer Science?


e. S. C. Kleene
f. Alanzo Church
g. Charles Babbage
h. Alan Turing

5. A ____________ is a theoretical computing machine invented by Alan Turing (1937) to serve as an idealized
model for mathematical calculation.
e. Linear Bounded Automata
f. Turing Machine
g. Finite Automata
h. Pushdown Automata

6. A Turing machine can run forever, enter a loop, or reach a particular state or set of conditions at which it is
prescribed to halt.
c. True
d. False

7. In computer science, a _______________is a Turing machine that can simulate an arbitrary Turing machine on
arbitrary input.
e. Universal Turing machine
f. Deterministic Turing machine
g. Non- Deterministic Turing machine
h. Multi-Tape Turing machine

8. A ________ is the simplest form of a computer.


e. Finite Automata
f. Linear Bounded Automata
g. Turing Machine
h. Pushdown Automata
9. The machine accept the string by entering into hA or it can:
a) explicitly reject x by entering into hR
b) enter into an infinte loop
c) Both (a) and (b)
d) None of the mentioned

10. Which of the following can accept even palindrome over {a,b}
a) Push down Automata
b) Turing machine
c) NDFA
d) All of the mentioned
11. If T1 and T2 are two turing machines. The composite can be represented using the expression:
a) T1T2
b) T1 U T2
c) T1 X T2
d) None of the mentioned

12. The number of states required to automate the last question i.e. {a,b}*{aba}{a,b}* using finite automata:
a) 4
b) 3
c) 5
d) 6

Answer Keys: Unit V1:

15. a 22. c
16. d 23. a
17. b 24. a
18. a
19. a
13. d 20. c
14. b 21. c
Q1 Which of the following pairs of regular expressions are equivalent?
a) 1(01)* and (10)*1
b) x (xx)* and (xx)*x
c) x^+ and x^+ x^(*+)
d) All of the mentioned

Q2 What is the Regular Expression Matching Zero or More Specific Characters


a) x
b) #
c) *
d) &

Q3

Ans. C

Q4
Ans. A

Q5

Ans. B

Q6
Ans. A

Q7 Consider the two automata

A. A and B are Equivalent


B. A and B are not Equivalent
C. Cannot be defined
D. None of these

Ans.A

Q8 Regular expression (x/y)(x/y) denotes the set

a. {xy,xy}

b. {xx,xy,yx,yy}

c. {x,y}

d. {x,y,xy}
Ans.b

Q9 The regular expression with all strings of 0′s and 1′s with at least two consecutive 0′s is:

a. 1 + (10)*

b. (0+1)*00(0+1)*

c. (0+1)*011

d. 0*1*2*

Ans. B

Q10 Find the pair of regular expressions that are equivalent

a. (0+1)* and (0*+1*)*

b. (0+1)* and (0+1*)*

c. (0+10)* and (0*+10)*

d. All of the mentioned

Ans. D

Q11

Which of the following is same as the given DFA?

a. (0+1)*001(0+1)*
b. 1*001(0+1)*
c. (01)*(0+0+1)(01)*
d. None of the mentioned

Ans. A

Q12
Which of the given regular expressions correspond to the automata shown?

a. (110+1)*0

b. (11+110)*1

c. (110+11)*0

d. (1+110)*1

Ans. C

Q13 Which among the following looks similar to the given expression?

((0+1). (0+1)) *

a. {xϵ {0,1} *|x is all binary number with even length}

b. {xϵ {0,1} |x is all binary number with even length}

c. {xϵ {0,1} *|x is all binary number with odd length}


d. {xϵ {0,1} |x is all binary number with odd length}

Ans. A

Q14 (a + b*c) most correctly represents:

a. (a +b) *c

b. (a)+((b)*.c)

c. (a + (b*)).c

d. a+ ((b*).c)

Ans. D

Q15

Which NDFA correctly represents the following RE

a(bab)*∪a(ba)*
Ans. a

Q16 Which of the following does the given NFA represent?

a. {11, 101} * {01}

b. {110, 01} * {11}

c. {11, 110} * {0}

d. {00, 110} * {1}

ans. C
1. There are ________ tuples in finite state machine.
a) 4
b) 5
c) 6
d) unlimited
Ans:- B

2. Transition function maps.


a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q
Ans: - d

3. Number of states requires accepting string ends with 10.


a) 3
b) 2
c) 1
d) can’t be represented.
Ans:-a

4. Number of final state requires accepting Φ in minimal finite automata.


a) 1
b) 2
c) 3
d) None of the mentioned
Ans:-d

5. Number of states requires in NFA simulating a computer with memory


capable of storing ‘3’ words each of length ‘8’.
a) 3 * 28
b) 2(3*8)
c) 2(3+8)
d) None of the mentioned
Ans:- b
6. An NFA’s transition function returns
a. A Boolean value
b. A state
c. A set of states
d. An edge
Ans:C

7. The behaviour of a NFA can be stimulated by DFA

a. Always

b. Sometimes

c.Never

d. Depends on NFA

Ans:-a

8. The relation between NFA-accepted languages and DFA accepted languages


is

a. >
b.<
c.=
d.<=
Ans:- c

9. Examine the following DFA: If input is 011100101, which edge is NOT


traversed?

a. A B
b. C

c. C D

d. D A

Ans:- C

10. The transitional function of a NFA is

a. Q X Σ→Q

b. Q X Σ→2Q

c. Q X Σ→2n

d.Q X Σ→Qn

Ans:- B

11. Which is true for Dead State?

a. It cannot be reached anytime

b. There is no necessity of the state

c. If control enters no way to come out from the state

d.If control enters FA deads

Ans:- C

12. Which among the following states would be notated as the final
state/acceptance state?

L= {xϵ∑= {a, b} | length of x is 2}


a. q1

b. q2

c. q1, q2

d. q3

Ans:- b

13. Which of the following are the final states in the given DFA according to the
Language given ?
L= {xϵ∑= {a, b} |length of x is at most 2}

a. q0, q1

b. q0, q2

c.q1, q2

d. q0, q1, q2

Ans:D
14. Which of the following x is accepted by the given DFA (x is a binary string ∑=
{0,1})?

a. divisible by 3

b. divisible by 2

c. divisible by 2 and 3

d. divisible by 3 and 2

Ans:- d

15. Choose the correct option for the given statement:

Statement: The DFA shown represents all strings which has 1 at second last
position.

a. Correct

b. Incorrect, Incomplete DFA

c. Wrong proposition
d. May be correct
MCQ’s on regular languages and regular expressions

1. A language is regular if and only if

a) accepted by DFA

b) accepted by PDA

c) accepted by LBA

d) accepted by Turing machine

2. Regular grammar is

a) context free grammar

b) non context free grammar

c) english grammar

d) none of the mentioned

3. Regular expression are

a) Type 0 language

b) Type 1 language

c) Type 2 language

d) Type 3 language

4. Consider the languages L1=ɸ and L2 = {a}. Which one of the following represents L1 L2* U L1*

a) A
b) B
c) C
d) D

5. Given the language L = {ab, aa, baa}, which of the following strings are in L*?

1) abaabaaabaa

2) aaaabaaaa

3) baaaaabaaaab

4) baaaaabaa

a) 1, 2 and 3

b) 2, 3 and 4

c) 1, 2 and 4

d) 1, 3 and 4
6. Let w be any string of length n is {0,1}*. Let L be the set of all substrings of w. What is the
minimum number of states in a non-deterministic finite automaton that accepts L?

a) n-1

b) n

c) n+1

d) 2n-1

7. Which one of the following languages over the alphabet {0,1} is described by the regular
expression: (0+1)*0(0+1)*0(0+1)*?

a) The set of all strings containing the substring 00

b) The set of all strings containing at most two 0’s

c) The set of all strings containing at least two 0’s

d) The set of all strings that begin and end with either 0 or 1.

8. The regular expression 0*(10*)* denotes the same set as

a) (1*0)*1*

b) 0 + (0 + 10)*
c) (0 + 1)* 10(0 + 1)*
d) none of these
9. The smallest finite automation which accepts the language {x | length of x is divisible by 3}
has :
a) 2 states
b) 3 states
c) 4 states
d) 5 states
10. Consider the following languages

Which of the languages are regular?


a) Only L1 and L2
b) Only L2, L3 and L4
c) Only L3 and L4
d) Only L3
Q1) Consider the languages L1 = and L2 = {a}. Which one of the following represents L1
L2* U L1*

a){ epsilon } b) a* c){epsilon,a} d)none

Answer: A

Q2)

Consider the DFA given. Which of the following are FALSE?


1. Complement of L(A) is context-free.
2. L(A) = L((11*0+0)(0 + 1)*0*1*)
3. For the language accepted by A, A is the minimal DFA.
4. A accepts all strings over {0, 1} of length at least 2.
Answer: 3 and 4

Q3) Given the language L = {ab, aa, baa}, which of the following strings are in L*?

1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa
Answer : 1,2,4

Q4) Find the regular expression for the given


Answer : c*a(d+bc*a)*

Q5) Find the regular expression for the given

Answer: b*(aa*(bb*+∈)+∈)

Q6) Find the regular expression for the given

Answer: (ab + b(a+bb))*

Q7) Find the regular expression for the given


Answer: regular expression is only a, because state B is dead state.

Q8) Find the regular expression for the given

Answer: aa* + ba*

Q9) A regular language over an alphabet a is one that can be obtained from
a) union
b) concatenation
c) kleene
d) All of the mentioned

Answer: d

Q10)

Regular expression Φ* is equivalent to


a) ϵ
b) Φ
c) 0
d) 1

Answer:A
MCQs based on NDFA to DFA Conversion:
1. Can we convert a Non-Deterministic Finite Automata to a Deterministic Finite Automata?
a. No
b. Yes

2. While converting an NDFA to a DFA, the set of input symbols in DFA are:
a. Same as that of NDFA
b. Different from the given NDFA

3. When we convert an NDFA to a DFA, the number of states in the DFA ____________
a. Would remain same
b. Not necessarily remain the same

4. For the following NDFA, what would be the states in a corresponding DFA?

a. [q0]
b. [q0], [q1]
c. [q0], [q0, q1]
d. [q0], [q1], [q0, q1]

5. “DFA is said to be a specific case of NDFA and for every NDFA that exists for a given
language, an equivalent DFA also exists”. The statement is True or False?
a. True
b. False

6. While converting NDFA to DFA, 𝛿’([q0, q1, … qi], a) is written as _________________


a. 𝛿([q0, q1, … qi], a)
b. 𝛿([q0], a)
c. 𝛿(q0, a) ⋃ 𝛿(q1, a) …… ⋃ 𝛿(qi, a)
d. None of above

7. A Finite Automata with ^ - moves is considered to be ___________


a. DFA
b. NDFA

MCQs based on Arden’s Theorem:

8. Let P and Q be two regular expressions over Σ. If P does not contain ^, then according to
Arden’s theorem, R = Q + RP has a unique solution given by _________________
a. R = QP*
b. R = Q + P*
c. R = Q*P
d. R = Q + P

9. By using Arden’s Theorem, the equation q1 = q1(ab + ba) + ^ can be written as,
a. q1= (a+ b)*
b. q1= (abba)*
c. q1= (ab + ba)*
d. q1= (ab)*

10. Arden’s theorem is true for:


a. More than one initial states
b. Non-null transitions
c. Null transitions
d. None of the above

11. Arden’s theorem is false for:


a. More than one initial states
b. Non-null transitions

12. Algebraic method using Arden’s theorem is used for ____________


a. Converting a Regular Expression into a Transition System
b. Finding a Regular Expression corresponding to a given Transition System

13. The regular expression corresponding to the equation q2 = 0*1 + q2(1) when an Arden’s
Theorem is applied is ______________
a. (0*1)1*
b. (00)*
c. (11)*
d. 0*1*

14. Which of the following is useful for converting a finite automaton into a regular expression?
a. Null Moves
b. Kleen’s Closure
c. Transition Function
d. Arden’s Theorem

15. Recognize the regular expression corresponding to the following Finite Automata using
Arden’s Method:

a. 0*1*
b. (0 + 1)*
c. (1101)*
d. (0 + 11 + 010)*
UNIT-1
MCQ
Mealy and Moore Machine
1. An automata in which output depends only on the states of the machine is called
a) An automaton without a Memory
b) Automaton with a finite Memory
c) Moore Machine
d) Mealy Machine
2. An automata in which output depends only on the states as well as on the input at any
instant of time is called
a) An automaton without a Memory
b) Automaton with a finite Memory
c) Moore Machine
d) Mealy Machine
3. The Finite state machine described by the following state diagram with A as starting
state, where an arc label is x / y and x stands for 1-bit input and y stands for 2- bit output
[ GATE CS 2002]

a) Outputs the sum of the present and the previous bits of the input.
b) Outputs 01 whenever the input sequence contains 11.
c) Outputs 00 whenever the input sequence contains 10.
d) None of these

Explanation:
We assume the input string to be 1101.
1. (A, 1) –> (B, 01)
Here, previous input bit + present input bit = 0 + 1 = 01 = output
2. (B, 1) –> (C, 10)
Here, previous input bit + present input bit = 1 + 1 = 10 = output
3. (C, 0) –> (A, 01)
Here, previous input bit + present input bit = 1 + 0 = 01 = output
4. (A, 1) –> (B, 01)
Here, previous input bit + present input bit = 0 + 1 = 01 = output
Thus, option (A) is correct.
4. In Moore Machine, suppose if Input=’101’, then the output would be of length:

a) |Input|+1
b) |Input|
c) |Input-1|
d) Cannot be predicted

Explanation:

Initial state, from which the operations begin is also initialized with a value.

5. What is the output for the given language?


Language: A set of strings over ∑= {a, b} is taken as input and it prints 1 as an output “for
every occurrence of a b as its substring. (INPUT: abaaab)
a) 0010001
b) 0101010
c) 0111010
d) 0010000

6. Which of the following is a correct statement?


a) Moore machine has no accepting states
b) Mealy machine has accepting states
c) We can convert Mealy to Moore but not vice versa
d) All of the mentioned

7. Find output string for the input string 0111 from the following Moore Machine

Present State Next State Output


a=0 a=1
->q0 q3 q1 0
q1 q1 q2 1
q2 q2 q3 0
q3 q3 q0 0

a) 00010
b) 10110
c) 11111
d) 10101
8. Find output string for the input string 1111 from the following Moore Machine

Present State Next State Output


a=0 a=1
->q1 q2 q2 0
q2 q3 q3 1
q3 q4 q4 0
q4 q3 q4 0

a) 01000
b) 00110
c) 11111
d) 10101

9. Find output string for the input 0010 from the following Mealy machine

Present Next State


State a=0 a=1
State Output State Output
->q1 q3 0 q2 0
q2 q1 1 q4 0
q3 q2 1 q1 1
q4 q4 1 q3 0
a) 0101
b) 1000
c) 1010
d) 1001

10. The following mealy machine outputs which of the following?

a) 9’s Complement
b) 2’s Complement
c) 1’s Complement
d) 10’s Complement
Answer: b

11. The major difference between Mealy and Moore machine is about:
a) Output Variations
b) Input Variations
c) Both
d) None of the mentioned
View Answer

12. Which of the following does the given Mealy machine represents?

a) 9’s Complement
b) 2’s Complement
c) 1’s Complement
d) 10’s Complement

13. Which one among the following is true?


A mealy machine
a) produces a language
b) produces a grammar
c) can be converted to NFA
d) has less circuit delays

Explanation: It does not produce a language or a grammar or can be converted to a NFA.

14. According to Moore circuit, the output of synchronous sequential circuit depend/s on ______
of flip flop

a. Past state
b. Present state
c. Next state
d. External inputs
15. Find the correct answer after, converting the following Mealy to Moore machine

Present Next State


State a=0 a=1
State Output State Output
->q1 q3 0 q2 0
q2 q1 1 q4 1
q3 q2 1 q1 1
q4 q4 1 q3 0

a)
Present State Next State Output
a=0 a=1
->q1 q3 q20 0
q20 q1 q4 0
q21 q1 q4 1
q3 q21 q1 0
q4 q4 q3 1

b)

Present State Next State Output


a=0 a=1
->q1 q3 q20 1
q20 q1 q4 1
q21 q1 q4 1
q3 q21 q1 0
q4 q4 q3 1

c)
Present State Next State Output
a=0 a=1
->q1 q3 q20 1
q20 q1 q4 0
q21 q1 q4 1
q3 q21 q1 1
q4 q4 q3 1
d)

Present State Next State Output


a=0 a=1
->q1 q3 q20 1
q20 q1 q4 0
q21 q1 q4 1
q3 q21 q1 0
q4 q4 q3 1
Q: 1 How many states are require to construct a minimal dfa from the given DFA

a)2 b)3 c)4 d)5

2.From the given DFA which string is accepted

a) abbabb b) abbabba c) aabba d) aaba

ans a

3.Which DFA is accept the string in which every a is followed by b where Σ = {a,b} .

a)

b)
c)
d) None of these

4.
9.)Consider the finite automaton in the following figure. What is the set of reachable states for the input string 0011 ?

a. q0, q1,q2

b. q0,q1

c. q0,q1,q2,q3

d. q3

5.What the following DFA accepts?

a) x is a string such that it ends with ‘101’


b) x is a string such that it ends with ‘01’
c) x is a string such that it has odd 1’s and even 0’s
d) x is a strings such that it has starting and ending character as 1

6. Minimize the dfa below given transition table


a) 3 b)4 c)2 d)5

7.How many states are required after construct a minimal DFA

A)3 B)2 C)5 D)4

8)Statement 1: Acceptance of string only when it goes to first state to final state .

statement 2: String is accepted only when it statisfy the language .

a) Statement 1 is correct , Statement 2 is correct .

b) Statement 1 is not correct , Statement 2 is correct .

c) Statement 1 is correct , Statement is not correct

d) Statement 1 is not correct , statement 2 is not correct

9) At which state String 'aa' accepted

a) D b) A c) B d) C

10) How many states after Minimize the below dfa


a) 3 b) 2 c) 4 d) 5

11) Which state is accepted String '110101'

a) q2 b) q3 c) q1 d) q4

12) Minimize given dfa

a) {A,B,} {F} ,{C,D,E}

b){A,F},{B},{C,D,E}

C){A} {B,F} {C,D,E}

D){A,B,F){C,D,E}
13.) Given the language L = {ab, aa, baa}, which of the following strings are in L*?

1) abaabaaabaa

2) aaaabaaaa

3) baaaaabaaaab

4) baaaaabaa

a)1, 2 and 3

b)2, 3 and 4

c)1, 2 and 4

d)1, 3 and 4

14.)Let w be any string of length n is {0,1}*. Let L be the set of all substrings of w. What is the minimum
number of states in a non-deterministic finite automaton that accepts L?

A )n-1

b)n

c)n+1

D)2n-1

15) Which string is accepted by DFA

a) an

b) anbn

c) anbncn

1) a ,b 2) c 3) a,b,c 4) a
1. A language is regular if and only if
a) accepted by DFA
b) accepted by PDA
c) accepted by LBA
d) accepted by Turing machine

Answer- a

2. Regular grammar is
a. context free grammar
b. non context free grammar
c. English grammar
d. none of the mentioned

Answer- a

3. Regular expression are

a. Type 0 language
b. Type 1 language
c. Type 2 language
d. Type 3 language

4. Regular languages are closed under (closure properties)

a. Concatenation

b. Union

c. Complement

d. All of the above

Answer- d

5. If L1 is regular, then there exists some regular expression r1 which describes it. Same for L2.
Then:L1 U L2 = L(r1) U L(r2) = r1 + r2

r1 + r2 is a regular expression and therefore describes a regular language.

a. True
b. False

Answer : a
6. If L1 = {an | n ≥ 0} and L2 = {bn | n ≥ 0} is regular
then L3 = L1.L2 = {am . bn | m ≥ 0 and n ≥ 0} is also regular?

a. False

b True

Answer b

7. Which one of the following languages over the alphabet {0,1} is described by the regular
expression?
(0+1)*0(0+1)*0(0+1)*
a. The set of all strings containing the substring 00.
b. The set of all strings containing at most two 0’s.

c. The set of all strings containing at least two 0’s.


d. The set of all strings that begin and end with either 0 or 1.

Answer c

8. A language is regular if it can be expressed in terms of ……………..

a. Regular expression

b. Type 0 Language

c. English Grammer

g. None of the above

Answer a

9. Which of the following pairs of regular expressions are equivalent?

a. 1(01)* and (10)*1

b. x (xx)* and (xx)*x

c. x^+ and x^+ x^(*+)

d. All of the above mentioned

Answer d
10. Regular expressions are used to represent which language

a) Recursive language

b) Context free language

c) Regular language

d) All of these

Answer c

11. Which of the following operation can be applied on regular expressions?

a) Union

b) Concatenation

c) Closure

d) All of these

answer d

12. 7. Which of the following identity is wrong?

a) R + R = R

b) (R*)* = R*

c) ɛR = Rɛ = R

d) ØR = RØ = RR*

Answer d

13. Which of the following statement is true?

a) Every language that is defined by regular expression can also be defined by finite automata

b) Every language defined by finite automata can also be defined by regular expression

c) We can convert regular expressions into finite automata

d) All of these

Answer d

14. Which of the following identity is true?

a) ɛ +RR* = R* = ɛ + R*R
b) (R1R2)*R1 = R1(R2R1)*

c) R*R* = R*

d) All of these

15. (a+b)* is equivalent to


a) b*a*
b) (a*b*)*
c) a*b*
d) none of the mentioned

Answer b

16. Consider a finite automaton, with A-moves, given in Fig. which among the following is the
Equivalent automaton without A-moves.

a.

b.

c.

d. None of above
Answer a

17. Suppose we want to replace a null move from vertex V1 to vertex V2 in FA Then
What is the first step needs to be done:
a. Make a new vertex V3
b. Find all the edges starting from v2
c. Delete Vertex V2
d. None of the above

Answer b
1. Which of the following does not represents the given language?
Language: {0,01}
a) 0+01
b) {0} U {01}
c) {0} U {0}{1}
d) {0} ^ {01}

Answer d
2. According to the given language, which among the following expressions does it corresponds to?
Language L={xϵ{0,1}|x is of length 4 or less}

a) (0+1+0+1+0+1+0+1)4
b) (0+1)4
c) (01)4
d) (0+1+ε)4
answer D

3.Which among the following looks similar to the given expression?


((0+1). (0+1)) *
a) {xϵ {0,1} *|x is all binary number with even length}
b) {xϵ {0,1} |x is all binary number with even length}
c) {xϵ {0,1} *|x is all binary number with odd length}
d) {xϵ {0,1} |x is all binary number with odd length}
Answer a

4. Concatenation Operation refers to which of the following set operations:


a) Union
b) Dot
c) Kleene
d) Two of the options are correct

answer b

5. If language is { ^, a, aa,aaa, aaaa, aaaa, aaaaa,aaaaaa,........} then what will be the regular
expression
1. {a}*
2. {a}+
3. {a}
4. none of these
Answer :- 1

6. If language is { a, aa,aaa, aaaa, aaaa, aaaaa,aaaaaa,........} then what will be the regular
expression
1. {a}*
2. {a}+
3. {a}
4. none of these

Answer 2
7. if the language is {ac, abc, abbc, ...........} then what will be the regular expression.
a. ab*c
b. a*bc
c. a*b*c
d. abc*

Answer a

8. if language is {bd, bcd, babd, ..............}thenwhat will be the regular expression

a. b(c+ab)*d
b. b(c+ab)d*
c. b(c+ab)*d*
d. b*(c+ab)*d*

answer a
9. Plus Operation refers to which of the following set operations:
a) Union
b) Dot
c) Kleene
d) Two of the options are correct

Answer a

10.) what will be the langauge for this regular expression (a+b)*.
a) any string of a,b is possible including null
b) any string of a,b is possible not including null
c) string starts with a and ends b is possible
d) none of these

11) Complete the identity R+R= ?


a) R
b)2R
c) RR
d) ^
Answer A

12) Complete the identity R*R*=


a) R
b) R*
c) ^
d) RR*

answer B

14) Complete the identity RR*=


a) R
b) R*R
c) ^
d) RR*
answr B
15) what will be the regular expression {abb,a,b,bba}
a) abb+a+b+bba
b) abb+b+a+aab
c) bba+a+b+aab
d) none of these

Answer A

16) what will be the regular expression for language in which of all strings containing exaxctly
2a’s.
a) b*ab*ab*
b) ab*ab*
c) (a+b)*aa(a+b)*
d) none of these

Answer a
17) find the regular expression for
ambncp where m,n,p >=1
a) aa*bb*cc*
b) aa*b*c*
c) a*b*c*
d) none of these

Answer a

18) find the regular expression for


amb2nc3p where m,n,p >=1
a) aa*bb*cc*
b) aa*b*c*
c) aa*(bb)(bb)*ccc(ccc)*
d) none of these

Answer C

19) Complete the identity ^+ RR*=


a) R
b) R*
c) ^
d) RR*

answer B

20) what will be regular expression for {abba}


a) (a+b)*
b) (ab)*
c) {abba}
d) none of these

answer c
A context sensitive language is accepted by
a) Finite automata
b) Linear bounded automata
c) Both (a) and (b)
d) None of these

Ans- B

A grammar G = (V, T, P, S) in which V is


a) Set of variables
b) Set of terminals
c) Set of variables and terminals
d) None of these

Ans-A

A grammar G = (V, T, P, S) in which T is


a) Set of variables
b) Set of terminals
c) Set of variables and terminals
d) None of these

Ans- B

Which of the following is more powerful?


a) PDA
b) Turing machine
c) Finite automata
d) Context sensitive language
Ans-B

Which of the following string is generated by the grammar


S -> 0S1AB
A -> 4A
B -> SA
a) 0111
b) 010101
c) 00000
d) None of these
Which of the following relates to Chomsky hierarchy?
a) Regular<CFL<CSL<Unrestricted
b) CFL<CSL<Unrestricted<Regular
c) CSL<Unrestricted<CF<Regular
d) None of the mentioned

Ans-a

A language is accepted by a push down automata if it is:


a) regular
b) context free
c) both (a) and (b)
d) none of the mentioned

Ans- B

Which of the following strings do not belong the given regular expression?
(a)*(a+cba)
a) aa
b) aaa
c) acba
d) acbacba

Ans-d

Which of the following CFG's can't be simulated by an FSM ?

A.S --> Sa | b

B.S --> aSb | ab

C.S --> abX, X --> cY, Y --> d |


aX

D.None of these

Ans-B

Regular Grammar is accepted by

a. FA
b. LBA
c. Turing Machine
d. All

Q. If Σ = {a,b} and given productions are

S→XaaX

X→aX| bX|Λ

Then the above grammar defines the language expressed by___________ regular expression

a. (a+b)*aa(a+b)*
b. (a+b)*a(a+b)*a
c. (a+b)*aa(a+b)*aa
d. (a+b)*aba+b)*
Ans-A

Q. The languages which can not accept PDA________

A. REGULAR LANGUAGES

B. CONTEXT FREE

C. CONTEXT SENSITIVE

D. NONE.

Ans- C

Q Regular grammar is
a) Context free grammar
b) Non context free grammar
c) English grammar
d) None of the mentioned
Ans- A
Regular expression are
a) Type 0 language
b) Type 1 language
c) Type 2 language
d) Type 3 language
Ans- A
L and ~L are recursive enumerable then L is
a) Regular
b) Context free
c) Context sensitive
d) Recursive
Ans-D
Regular expressions are closed under
a) Union
b) Intersection
c) Kleene star
d) All of the mentioned

Ans-d

How many strings of length less than 4 contains the language described by the regular expression
(x+y)*y(a+ab)*?
a) 7
b) 10
c) 12
d) 11

Ans-D

Grammatical rules which involve the meaning of words are called:


a. Semantics
b. Syntactic
c. Both a and b
d. None of given
Ans- A

Grammatical rules which do not involve the meaning of words are called:
a. Semantics
b. Syntactic
c. Both a and b
d. None of given
Ans-B

The symbols in a grammar that can’t be replaced by anything are called:


a. Productions
b. Terminals
c. Non-terminals
d. All of above
Ans-B

The symbols in a grammar that must be replaced by other Synbols are called:
a. Productions
b. Terminals
c. Non-terminals
d. None of given
Ans-C
Q1. Consider the languages L1 = ᶲ and L2 = {a}. Which one of the following represents

L1 L2* U L1
a) {€} b)ᶲ c) a* d) {€,a}

Q2. Let S and T be language over ={a,b} represented by the regular expressions (a+b*)*
and (a+b)*, respectively. Which of the following is true?
(a) ScT (S is a subset of T)
(b) TcS (T is a subset of S)
(c) S=T
(d) SnT=Ø
Q3. Let L denotes the language generated by the grammar S – OSO/00. Which of the
following is true?
(a) L = O
(b) L is regular but not O
(c) L is context free but not regular
(d) L is not context free
Q4. Consider the following two statements:
S1: { 0^2n |n >= l} is a regu1ar language
S2: { 0^m 0^n 0^(m+n) l m >= 1 and n >= 2} is a regu1ar language
Which of the following statements is correct? (GATE CS 2001)
a) Only S1 is correct
b) Only S2 is correct
c) Both S1 and S2 are correct
d) None of S1 and S2 is correct
Q5. Which of the following statements in true? (GATE CS 2001)
(a) If a language is context free it can always be accepted by a deterministic push-down
automaton
(b) The union of two context free languages is context free
(c) The intersection of two context free languages is context free
(d) The complement of a context free language is context free
Q6. Given an arbitrary non-deterministic finite automaton (NFA) with N states, the
maximum number of states in an equivalent minimized DFA is at least. (GATE CS 2001)
(a) N^2
(b) 2^N
(c) 2N
(d) N!
Q7. Given the language L = {ab, aa, baa}, whih of the following strings are in L*?
1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa
(A) 1, 2 and 3
(B) 2, 3 and 4
(C) 1, 2 and 4
(D) 1, 3 and 4
8. Which of the following problems are decidable?
….1) Does a given program ever produce an output?
….2) If L is a context-free language, then is L’ (complement of L) also context-free?
….3) If L is a regular language, then is L’ also regular?
….4) If L is a recursive language, then, is L’ also recursive?
(A) 1, 2, 3, 4
(B) 1, 2,
(C) 2, 3, 4
(D) 3, 4
9. Let P be a regular language and Q be context-free language such that Q ⊆ P. (For
example, let P be the language represented by the regular expression p*q* and Q be
{pnqn|n ∈ N}). Then which of the following is ALWAYS regular?
(A) P ∩ Q
(B) P – Q
(C) ∑* – P
(D) ∑* – Q
10. (a+b)* is equivalent to
a) b*a*
b) (a*b*)*
c) a*b*
d) none of the mentioned
11. a? is equivalent to
a) a
b) a+Φ
c) a+ϵ
d) wrong expression
12. Regular expression Φ* is equivalent to
a) ϵ
b) Φ
c) 0
d) 1
13. A language is regular if and only if
a) accepted by DFA
b) accepted by PDA
c) accepted by LBA
d) accepted by Turing machine
14. Let the class of language accepted by finite state machine be L1 and the class of languages
represented by regular expressions be L2 then
a) L1<L2
b) L1>=L2
c) L1 U L2 = .*
d) L1=L2
15. Regular expression {0,1} is equivalent to
a) 0 U 1
b) 0 / 1
c) 0 + 1
d) All of the mentioned
TOC mcq
Definition and description of FA:
1. NFA, in its name has ’non-deterministic’ because of :
a) The result is undetermined
b) The choice of path is non-deterministic
c) The state to be transited next is non-deterministic
d) All of the mentioned
Answer: b

2. Languages of a automata is
a) If a string is accepted by automata
b) If it halts
c) If automata touch final state in its life time
d) All language are language of automata
Answer: a

3. The basic limitation of finite automata is that


a) It can’t remember arbitrary large amount of information.
b) It sometimes recognize grammar that are not regular.
c) It sometimes fails to recognize regular grammar.
d) All of the mentioned
Answer:a

4. What the following DFA accepts?

a) x is a string such that it ends with ‘101’


b) x is a string such that it ends with ‘01’
c) x is a string such that it has odd 1’s and even 0’s
d) x is a strings such that it has starting and ending character as 1
Answer A)
5. What does the following figure most correctly represents?

a) Final state with loop x


b) Transitional state with loop x
c) Initial state as well as final state with loop x
d) Insufficient Data
Answer: c

6. Number of final state requires to accept Φ in minimal finite automata.


a) 1
b) 2
c) 3
d) None of the mentioned
Answer:d
Explanation: No final state requires.

7. Which of the following is an application of Finite Automaton?


a) Compiler Design
b) Grammar Parsers
c) Text Search
d) All of the mentioned
Answer: d

8. Which DFA is correct for the given Language: accepting string ending with '01' over input alphabets
∑={a.b}

a) b) c) d) None of these
Ans c

9. How many Final states in the given language : {an | where n >=1 but n ≠ 2,6 } , Σ= {a}
a) 2 b) 4 c) 3 d) 6
Ans b)
10. Transition function maps.
a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q Ans d)
11. Finite automata has only
a) Finite memory
b) Read only head
c) Finite control
d) All of them Ans d)

The Equivalence of deterministic and non-deterministic finite automata


12. The relation between NFA-accepted languages and DFA accepted languages is
a) >
b) <
c) =
d) <= Ans c)

13. Which of the following is correct proposition?


Statement 1: Non determinism is a generalization of Determinism.
Statement 2: Every DFA is automatically an NFA
a) Statement 1 is correct because Statement 2 is correct
b) Statement 2 is correct because Statement 2 is correct
c) Statement 2 is false and Statement 1 is false
d) Statement 1 is false because Statement 2 is false Ans a)

14. Which NFA is correct for the transition table as given below:
Present State 0 1

→q0 q0, q1 q0, q2


q1 q3 ε
q2 q2, q3 q3
→q3 q3 q3

a) b)

c) d) None of these Ans a)

15. Given a NFA with N states, the maximum number of states in an equivalent minimized DFA is at least
a) N^2
b) 2^N
c) 2N
d) N! Ans b)
1. Transition function of DFA maps.
a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q
Answer: d

2. Minimum Number of states require to accept string ends with 10.


a) 3
b) 2
c) 1
d) can’t be represented.

Answer: a
3. δ*(q,ya) is equivalent to .
a) δ((q,y),a)
b) δ(δ*(q,y),a)
c) δ(q,ya)
d) independent from δ notation
Answer: b
4. Languages of a automata is
a) If it is accepted by automata
b) If it halts
c) If automata touch final state in its life time
d) All language are language of automata
Answer: a
5. Finite automata requires minimum _______ number of stacks.
a) 1
b) 0
c) 2
d) None of the mentioned
Answer: b
6. FSM with output capability can be used to add two given integer in binary representation.
This is
a) True
b) False
c) May be true
d) None of the mentioned
Answer: a
7. If NFA of 6 states excluding the initial state is converted into DFA, maximum possible
number of states for the DFA is ?
a) 64
b) 32
c) 128
d) 127
Answer: c
8. NFA, in its name has ’non-deterministic’ because of :
a) The result is undetermined
b) The choice of path is non-deterministic
c) The state to be transited next is non-deterministic
d) All of the mentioned
Answer: b
9. The construction time for DFA from an equivalent NFA (m number of node)is:
a) O(m2)
b) O(2m)
c) O(m)
d) O(log m)
Answer: b
10. Which of the following option is correct?
a) NFA is slower to process and its representation uses more memory than DFA
b) DFA is faster to process and its representation uses less memory than NFA
c) NFA is slower to process and its representation uses less memory than DFA
d) DFA is slower to process and its representation uses less memory than NFA
Answer: c
11. Choose the correct option for the given statement:
Statement: The DFA shown represents all strings which has 1 at second last position.

a) Correct
b) Incorrect, Incomplete DFA
c) Wrong proposition
d) May be correct

Answer: c

12.
Transition Function – mcq’s

Q1 What is wrong in the given definition?

Def: ({q0, q1, q2}, {0,1}, δ, q3, {q3})

a) The definition does not satisfy 5 Tuple definition of NFA

b) There are no transition definition

c) Initial and Final states do not belong to the Graph

d) Initial and final states can’t be same

Answer: c

Q2) Number of states require to accept string ends with 10.


a) 3
b) 2
c) 1
d) can’t be represented.
Answer: a

Q3) δ(q,ya) is equivalent to .


a) δ((q,y),a)
b) δ(δ(q,y),a)
c) δ(q,ya)
d) independent from δ notation
answer: b
Q4 Finite automata requires minimum _______ number of stacks.
a) 1
b) 0
c) 2
d) None of the mentioned
answer: b

Q 5 An NFA’s transition function returns

a. A Boolean value

b. A state

c. A set of states

d. An edge

answer: c

Q6 Choose the correct option for the given statement:


Statement: The DFA shown represents all strings which has 1 at second last
position.

a) Correct
b) Incorrect, Incomplete DFA
c) Wrong proposition
d) May be correct
Answer: c ( bcz it is nfa)
Q7. Which of the following is a not a part of 5-tuple finite automata?

a) Input alphabet

b) Transition function

c) Initial State

d) Output Alphabet

Answer: d

Q8)Transition function maps.


a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q
Answer: d
Q9 The sum of minimum and maximum number of final states for a DFA
having ‘n’ states is equal to:
a)n+1
b)n
c) n-2
d) n+2
answer : a
Q 10 The maximum number of transitions which can be performed over a state
in a DFA using Σ={a,b,c} ?
a)1
b)2
c)3
d) 4
answer : c
Q1 Which of the following pairs of regular expressions are equivalent?
a) 1(01)* and (10)*1
b) x (xx)* and (xx)*x
c) x^+ and x^+ x^(*+)
d) All of the mentioned

Q2 What is the Regular Expression Matching Zero or More Specific Characters


a) x
b) #
c) *
d) &

Q3

Ans. C

Q4
Ans. A

Q5

Ans. B

Q6
Ans. A

Q7 Consider the two automata

A. A and B are Equivalent


B. A and B are not Equivalent
C. Cannot be defined
D. None of these

Ans.A

Q8 Regular expression (x/y)(x/y) denotes the set

a. {xy,xy}

b. {xx,xy,yx,yy}

c. {x,y}

d. {x,y,xy}
Ans.b

Q9 The regular expression with all strings of 0′s and 1′s with at least two consecutive 0′s is:

a. 1 + (10)*

b. (0+1)*00(0+1)*

c. (0+1)*011

d. 0*1*2*

Ans. B

Q10 Find the pair of regular expressions that are equivalent

a. (0+1)* and (0*+1*)*

b. (0+1)* and (0+1*)*

c. (0+10)* and (0*+10)*

d. All of the mentioned

Ans. D

Q11

Which of the following is same as the given DFA?

a. (0+1)*001(0+1)*
b. 1*001(0+1)*
c. (01)*(0+0+1)(01)*
d. None of the mentioned

Ans. A

Q12
Which of the given regular expressions correspond to the automata shown?

a. (110+1)*0

b. (11+110)*1

c. (110+11)*0

d. (1+110)*1

Ans. C

Q13 Which among the following looks similar to the given expression?

((0+1). (0+1)) *

a. {xϵ {0,1} *|x is all binary number with even length}

b. {xϵ {0,1} |x is all binary number with even length}

c. {xϵ {0,1} *|x is all binary number with odd length}


d. {xϵ {0,1} |x is all binary number with odd length}

Ans. A

Q14 (a + b*c) most correctly represents:

a. (a +b) *c

b. (a)+((b)*.c)

c. (a + (b*)).c

d. a+ ((b*).c)

Ans. D

Q15

Which NDFA correctly represents the following RE

a(bab)*∪a(ba)*
Ans. a

Q16 Which of the following does the given NFA represent?

a. {11, 101} * {01}

b. {110, 01} * {11}

c. {11, 110} * {0}

d. {00, 110} * {1}

ans. C
1. There are ________ tuples in finite state machine.
a) 4
b) 5
c) 6
d) unlimited
Ans:- B

2. Transition function maps.


a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q
Ans: - d

3. Number of states requires accepting string ends with 10.


a) 3
b) 2
c) 1
d) can’t be represented.
Ans:-a

4. Number of final state requires accepting Φ in minimal finite automata.


a) 1
b) 2
c) 3
d) None of the mentioned
Ans:-d

5. Number of states requires in NFA simulating a computer with memory


capable of storing ‘3’ words each of length ‘8’.
a) 3 * 28
b) 2(3*8)
c) 2(3+8)
d) None of the mentioned
Ans:- b
6. An NFA’s transition function returns
a. A Boolean value
b. A state
c. A set of states
d. An edge
Ans:C

7. The behaviour of a NFA can be stimulated by DFA

a. Always

b. Sometimes

c.Never

d. Depends on NFA

Ans:-a

8. The relation between NFA-accepted languages and DFA accepted languages


is

a. >
b.<
c.=
d.<=
Ans:- c

9. Examine the following DFA: If input is 011100101, which edge is NOT


traversed?

a. A B
b. C

c. C D

d. D A

Ans:- C

10. The transitional function of a NFA is

a. Q X Σ→Q

b. Q X Σ→2Q

c. Q X Σ→2n

d.Q X Σ→Qn

Ans:- B

11. Which is true for Dead State?

a. It cannot be reached anytime

b. There is no necessity of the state

c. If control enters no way to come out from the state

d.If control enters FA deads

Ans:- C

12. Which among the following states would be notated as the final
state/acceptance state?

L= {xϵ∑= {a, b} | length of x is 2}


a. q1

b. q2

c. q1, q2

d. q3

Ans:- b

13. Which of the following are the final states in the given DFA according to the
Language given ?
L= {xϵ∑= {a, b} |length of x is at most 2}

a. q0, q1

b. q0, q2

c.q1, q2

d. q0, q1, q2

Ans:D
14. Which of the following x is accepted by the given DFA (x is a binary string ∑=
{0,1})?

a. divisible by 3

b. divisible by 2

c. divisible by 2 and 3

d. divisible by 3 and 2

Ans:- d

15. Choose the correct option for the given statement:

Statement: The DFA shown represents all strings which has 1 at second last
position.

a. Correct

b. Incorrect, Incomplete DFA

c. Wrong proposition
d. May be correct
MCQ’s on regular languages and regular expressions

1. A language is regular if and only if

a) accepted by DFA

b) accepted by PDA

c) accepted by LBA

d) accepted by Turing machine

2. Regular grammar is

a) context free grammar

b) non context free grammar

c) english grammar

d) none of the mentioned

3. Regular expression are

a) Type 0 language

b) Type 1 language

c) Type 2 language

d) Type 3 language

4. Consider the languages L1=ɸ and L2 = {a}. Which one of the following represents L1 L2* U L1*

a) A
b) B
c) C
d) D

5. Given the language L = {ab, aa, baa}, which of the following strings are in L*?

1) abaabaaabaa

2) aaaabaaaa

3) baaaaabaaaab

4) baaaaabaa

a) 1, 2 and 3

b) 2, 3 and 4

c) 1, 2 and 4

d) 1, 3 and 4
6. Let w be any string of length n is {0,1}*. Let L be the set of all substrings of w. What is the
minimum number of states in a non-deterministic finite automaton that accepts L?

a) n-1

b) n

c) n+1

d) 2n-1

7. Which one of the following languages over the alphabet {0,1} is described by the regular
expression: (0+1)*0(0+1)*0(0+1)*?

a) The set of all strings containing the substring 00

b) The set of all strings containing at most two 0’s

c) The set of all strings containing at least two 0’s

d) The set of all strings that begin and end with either 0 or 1.

8. The regular expression 0*(10*)* denotes the same set as

a) (1*0)*1*

b) 0 + (0 + 10)*
c) (0 + 1)* 10(0 + 1)*
d) none of these
9. The smallest finite automation which accepts the language {x | length of x is divisible by 3}
has :
a) 2 states
b) 3 states
c) 4 states
d) 5 states
10. Consider the following languages

Which of the languages are regular?


a) Only L1 and L2
b) Only L2, L3 and L4
c) Only L3 and L4
d) Only L3
Q1) Consider the languages L1 = and L2 = {a}. Which one of the following represents L1
L2* U L1*

a){ epsilon } b) a* c){epsilon,a} d)none

Answer: A

Q2)

Consider the DFA given. Which of the following are FALSE?


1. Complement of L(A) is context-free.
2. L(A) = L((11*0+0)(0 + 1)*0*1*)
3. For the language accepted by A, A is the minimal DFA.
4. A accepts all strings over {0, 1} of length at least 2.
Answer: 3 and 4

Q3) Given the language L = {ab, aa, baa}, which of the following strings are in L*?

1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa
Answer : 1,2,4

Q4) Find the regular expression for the given


Answer : c*a(d+bc*a)*

Q5) Find the regular expression for the given

Answer: b*(aa*(bb*+∈)+∈)

Q6) Find the regular expression for the given

Answer: (ab + b(a+bb))*

Q7) Find the regular expression for the given


Answer: regular expression is only a, because state B is dead state.

Q8) Find the regular expression for the given

Answer: aa* + ba*

Q9) A regular language over an alphabet a is one that can be obtained from
a) union
b) concatenation
c) kleene
d) All of the mentioned

Answer: d

Q10)

Regular expression Φ* is equivalent to


a) ϵ
b) Φ
c) 0
d) 1

Answer:A
MCQs based on NDFA to DFA Conversion:
1. Can we convert a Non-Deterministic Finite Automata to a Deterministic Finite Automata?
a. No
b. Yes

2. While converting an NDFA to a DFA, the set of input symbols in DFA are:
a. Same as that of NDFA
b. Different from the given NDFA

3. When we convert an NDFA to a DFA, the number of states in the DFA ____________
a. Would remain same
b. Not necessarily remain the same

4. For the following NDFA, what would be the states in a corresponding DFA?

a. [q0]
b. [q0], [q1]
c. [q0], [q0, q1]
d. [q0], [q1], [q0, q1]

5. “DFA is said to be a specific case of NDFA and for every NDFA that exists for a given
language, an equivalent DFA also exists”. The statement is True or False?
a. True
b. False

6. While converting NDFA to DFA, 𝛿’([q0, q1, … qi], a) is written as _________________


a. 𝛿([q0, q1, … qi], a)
b. 𝛿([q0], a)
c. 𝛿(q0, a) ⋃ 𝛿(q1, a) …… ⋃ 𝛿(qi, a)
d. None of above

7. A Finite Automata with ^ - moves is considered to be ___________


a. DFA
b. NDFA

MCQs based on Arden’s Theorem:

8. Let P and Q be two regular expressions over Σ. If P does not contain ^, then according to
Arden’s theorem, R = Q + RP has a unique solution given by _________________
a. R = QP*
b. R = Q + P*
c. R = Q*P
d. R = Q + P

9. By using Arden’s Theorem, the equation q1 = q1(ab + ba) + ^ can be written as,
a. q1= (a+ b)*
b. q1= (abba)*
c. q1= (ab + ba)*
d. q1= (ab)*

10. Arden’s theorem is true for:


a. More than one initial states
b. Non-null transitions
c. Null transitions
d. None of the above

11. Arden’s theorem is false for:


a. More than one initial states
b. Non-null transitions

12. Algebraic method using Arden’s theorem is used for ____________


a. Converting a Regular Expression into a Transition System
b. Finding a Regular Expression corresponding to a given Transition System

13. The regular expression corresponding to the equation q2 = 0*1 + q2(1) when an Arden’s
Theorem is applied is ______________
a. (0*1)1*
b. (00)*
c. (11)*
d. 0*1*

14. Which of the following is useful for converting a finite automaton into a regular expression?
a. Null Moves
b. Kleen’s Closure
c. Transition Function
d. Arden’s Theorem

15. Recognize the regular expression corresponding to the following Finite Automata using
Arden’s Method:

a. 0*1*
b. (0 + 1)*
c. (1101)*
d. (0 + 11 + 010)*
UNIT-1
MCQ
Mealy and Moore Machine
1. An automata in which output depends only on the states of the machine is called
a) An automaton without a Memory
b) Automaton with a finite Memory
c) Moore Machine
d) Mealy Machine
2. An automata in which output depends only on the states as well as on the input at any
instant of time is called
a) An automaton without a Memory
b) Automaton with a finite Memory
c) Moore Machine
d) Mealy Machine
3. The Finite state machine described by the following state diagram with A as starting
state, where an arc label is x / y and x stands for 1-bit input and y stands for 2- bit output
[ GATE CS 2002]

a) Outputs the sum of the present and the previous bits of the input.
b) Outputs 01 whenever the input sequence contains 11.
c) Outputs 00 whenever the input sequence contains 10.
d) None of these

Explanation:
We assume the input string to be 1101.
1. (A, 1) –> (B, 01)
Here, previous input bit + present input bit = 0 + 1 = 01 = output
2. (B, 1) –> (C, 10)
Here, previous input bit + present input bit = 1 + 1 = 10 = output
3. (C, 0) –> (A, 01)
Here, previous input bit + present input bit = 1 + 0 = 01 = output
4. (A, 1) –> (B, 01)
Here, previous input bit + present input bit = 0 + 1 = 01 = output
Thus, option (A) is correct.
4. In Moore Machine, suppose if Input=’101’, then the output would be of length:

a) |Input|+1
b) |Input|
c) |Input-1|
d) Cannot be predicted

Explanation:

Initial state, from which the operations begin is also initialized with a value.

5. What is the output for the given language?


Language: A set of strings over ∑= {a, b} is taken as input and it prints 1 as an output “for
every occurrence of a b as its substring. (INPUT: abaaab)
a) 0010001
b) 0101010
c) 0111010
d) 0010000

6. Which of the following is a correct statement?


a) Moore machine has no accepting states
b) Mealy machine has accepting states
c) We can convert Mealy to Moore but not vice versa
d) All of the mentioned

7. Find output string for the input string 0111 from the following Moore Machine

Present State Next State Output


a=0 a=1
->q0 q3 q1 0
q1 q1 q2 1
q2 q2 q3 0
q3 q3 q0 0

a) 00010
b) 10110
c) 11111
d) 10101
8. Find output string for the input string 1111 from the following Moore Machine

Present State Next State Output


a=0 a=1
->q1 q2 q2 0
q2 q3 q3 1
q3 q4 q4 0
q4 q3 q4 0

a) 01000
b) 00110
c) 11111
d) 10101

9. Find output string for the input 0010 from the following Mealy machine

Present Next State


State a=0 a=1
State Output State Output
->q1 q3 0 q2 0
q2 q1 1 q4 0
q3 q2 1 q1 1
q4 q4 1 q3 0
a) 0101
b) 1000
c) 1010
d) 1001

10. The following mealy machine outputs which of the following?

a) 9’s Complement
b) 2’s Complement
c) 1’s Complement
d) 10’s Complement
Answer: b

11. The major difference between Mealy and Moore machine is about:
a) Output Variations
b) Input Variations
c) Both
d) None of the mentioned
View Answer

12. Which of the following does the given Mealy machine represents?

a) 9’s Complement
b) 2’s Complement
c) 1’s Complement
d) 10’s Complement

13. Which one among the following is true?


A mealy machine
a) produces a language
b) produces a grammar
c) can be converted to NFA
d) has less circuit delays

Explanation: It does not produce a language or a grammar or can be converted to a NFA.

14. According to Moore circuit, the output of synchronous sequential circuit depend/s on ______
of flip flop

a. Past state
b. Present state
c. Next state
d. External inputs
15. Find the correct answer after, converting the following Mealy to Moore machine

Present Next State


State a=0 a=1
State Output State Output
->q1 q3 0 q2 0
q2 q1 1 q4 1
q3 q2 1 q1 1
q4 q4 1 q3 0

a)
Present State Next State Output
a=0 a=1
->q1 q3 q20 0
q20 q1 q4 0
q21 q1 q4 1
q3 q21 q1 0
q4 q4 q3 1

b)

Present State Next State Output


a=0 a=1
->q1 q3 q20 1
q20 q1 q4 1
q21 q1 q4 1
q3 q21 q1 0
q4 q4 q3 1

c)
Present State Next State Output
a=0 a=1
->q1 q3 q20 1
q20 q1 q4 0
q21 q1 q4 1
q3 q21 q1 1
q4 q4 q3 1
d)

Present State Next State Output


a=0 a=1
->q1 q3 q20 1
q20 q1 q4 0
q21 q1 q4 1
q3 q21 q1 0
q4 q4 q3 1
Q: 1 How many states are require to construct a minimal dfa from the given DFA

a)2 b)3 c)4 d)5

2.From the given DFA which string is accepted

a) abbabb b) abbabba c) aabba d) aaba

ans a

3.Which DFA is accept the string in which every a is followed by b where Σ = {a,b} .

a)

b)
c)
d) None of these

4.
9.)Consider the finite automaton in the following figure. What is the set of reachable states for the input string 0011 ?

a. q0, q1,q2

b. q0,q1

c. q0,q1,q2,q3

d. q3

5.What the following DFA accepts?

a) x is a string such that it ends with ‘101’


b) x is a string such that it ends with ‘01’
c) x is a string such that it has odd 1’s and even 0’s
d) x is a strings such that it has starting and ending character as 1

6. Minimize the dfa below given transition table


a) 3 b)4 c)2 d)5

7.How many states are required after construct a minimal DFA

A)3 B)2 C)5 D)4

8)Statement 1: Acceptance of string only when it goes to first state to final state .

statement 2: String is accepted only when it statisfy the language .

a) Statement 1 is correct , Statement 2 is correct .

b) Statement 1 is not correct , Statement 2 is correct .

c) Statement 1 is correct , Statement is not correct

d) Statement 1 is not correct , statement 2 is not correct

9) At which state String 'aa' accepted

a) D b) A c) B d) C

10) How many states after Minimize the below dfa


a) 3 b) 2 c) 4 d) 5

11) Which state is accepted String '110101'

a) q2 b) q3 c) q1 d) q4

12) Minimize given dfa

a) {A,B,} {F} ,{C,D,E}

b){A,F},{B},{C,D,E}

C){A} {B,F} {C,D,E}

D){A,B,F){C,D,E}
13.) Given the language L = {ab, aa, baa}, which of the following strings are in L*?

1) abaabaaabaa

2) aaaabaaaa

3) baaaaabaaaab

4) baaaaabaa

a)1, 2 and 3

b)2, 3 and 4

c)1, 2 and 4

d)1, 3 and 4

14.)Let w be any string of length n is {0,1}*. Let L be the set of all substrings of w. What is the minimum
number of states in a non-deterministic finite automaton that accepts L?

A )n-1

b)n

c)n+1

D)2n-1

15) Which string is accepted by DFA

a) an

b) anbn

c) anbncn

1) a ,b 2) c 3) a,b,c 4) a
1. A language is regular if and only if
a) accepted by DFA
b) accepted by PDA
c) accepted by LBA
d) accepted by Turing machine

Answer- a

2. Regular grammar is
a. context free grammar
b. non context free grammar
c. English grammar
d. none of the mentioned

Answer- a

3. Regular expression are

a. Type 0 language
b. Type 1 language
c. Type 2 language
d. Type 3 language

4. Regular languages are closed under (closure properties)

a. Concatenation

b. Union

c. Complement

d. All of the above

Answer- d

5. If L1 is regular, then there exists some regular expression r1 which describes it. Same for L2.
Then:L1 U L2 = L(r1) U L(r2) = r1 + r2

r1 + r2 is a regular expression and therefore describes a regular language.

a. True
b. False

Answer : a
6. If L1 = {an | n ≥ 0} and L2 = {bn | n ≥ 0} is regular
then L3 = L1.L2 = {am . bn | m ≥ 0 and n ≥ 0} is also regular?

a. False

b True

Answer b

7. Which one of the following languages over the alphabet {0,1} is described by the regular
expression?
(0+1)*0(0+1)*0(0+1)*
a. The set of all strings containing the substring 00.
b. The set of all strings containing at most two 0’s.

c. The set of all strings containing at least two 0’s.


d. The set of all strings that begin and end with either 0 or 1.

Answer c

8. A language is regular if it can be expressed in terms of ……………..

a. Regular expression

b. Type 0 Language

c. English Grammer

g. None of the above

Answer a

9. Which of the following pairs of regular expressions are equivalent?

a. 1(01)* and (10)*1

b. x (xx)* and (xx)*x

c. x^+ and x^+ x^(*+)

d. All of the above mentioned

Answer d
10. Regular expressions are used to represent which language

a) Recursive language

b) Context free language

c) Regular language

d) All of these

Answer c

11. Which of the following operation can be applied on regular expressions?

a) Union

b) Concatenation

c) Closure

d) All of these

answer d

12. 7. Which of the following identity is wrong?

a) R + R = R

b) (R*)* = R*

c) ɛR = Rɛ = R

d) ØR = RØ = RR*

Answer d

13. Which of the following statement is true?

a) Every language that is defined by regular expression can also be defined by finite automata

b) Every language defined by finite automata can also be defined by regular expression

c) We can convert regular expressions into finite automata

d) All of these

Answer d

14. Which of the following identity is true?

a) ɛ +RR* = R* = ɛ + R*R
b) (R1R2)*R1 = R1(R2R1)*

c) R*R* = R*

d) All of these

15. (a+b)* is equivalent to


a) b*a*
b) (a*b*)*
c) a*b*
d) none of the mentioned

Answer b

16. Consider a finite automaton, with A-moves, given in Fig. which among the following is the
Equivalent automaton without A-moves.

a.

b.

c.

d. None of above
Answer a

17. Suppose we want to replace a null move from vertex V1 to vertex V2 in FA Then
What is the first step needs to be done:
a. Make a new vertex V3
b. Find all the edges starting from v2
c. Delete Vertex V2
d. None of the above

Answer b
1. Which of the following does not represents the given language?
Language: {0,01}
a) 0+01
b) {0} U {01}
c) {0} U {0}{1}
d) {0} ^ {01}

Answer d
2. According to the given language, which among the following expressions does it corresponds to?
Language L={xϵ{0,1}|x is of length 4 or less}

a) (0+1+0+1+0+1+0+1)4
b) (0+1)4
c) (01)4
d) (0+1+ε)4
answer D

3.Which among the following looks similar to the given expression?


((0+1). (0+1)) *
a) {xϵ {0,1} *|x is all binary number with even length}
b) {xϵ {0,1} |x is all binary number with even length}
c) {xϵ {0,1} *|x is all binary number with odd length}
d) {xϵ {0,1} |x is all binary number with odd length}
Answer a

4. Concatenation Operation refers to which of the following set operations:


a) Union
b) Dot
c) Kleene
d) Two of the options are correct

answer b

5. If language is { ^, a, aa,aaa, aaaa, aaaa, aaaaa,aaaaaa,........} then what will be the regular
expression
1. {a}*
2. {a}+
3. {a}
4. none of these
Answer :- 1

6. If language is { a, aa,aaa, aaaa, aaaa, aaaaa,aaaaaa,........} then what will be the regular
expression
1. {a}*
2. {a}+
3. {a}
4. none of these

Answer 2
7. if the language is {ac, abc, abbc, ...........} then what will be the regular expression.
a. ab*c
b. a*bc
c. a*b*c
d. abc*

Answer a

8. if language is {bd, bcd, babd, ..............}thenwhat will be the regular expression

a. b(c+ab)*d
b. b(c+ab)d*
c. b(c+ab)*d*
d. b*(c+ab)*d*

answer a
9. Plus Operation refers to which of the following set operations:
a) Union
b) Dot
c) Kleene
d) Two of the options are correct

Answer a

10.) what will be the langauge for this regular expression (a+b)*.
a) any string of a,b is possible including null
b) any string of a,b is possible not including null
c) string starts with a and ends b is possible
d) none of these

11) Complete the identity R+R= ?


a) R
b)2R
c) RR
d) ^
Answer A

12) Complete the identity R*R*=


a) R
b) R*
c) ^
d) RR*

answer B

14) Complete the identity RR*=


a) R
b) R*R
c) ^
d) RR*
answr B
15) what will be the regular expression {abb,a,b,bba}
a) abb+a+b+bba
b) abb+b+a+aab
c) bba+a+b+aab
d) none of these

Answer A

16) what will be the regular expression for language in which of all strings containing exaxctly
2a’s.
a) b*ab*ab*
b) ab*ab*
c) (a+b)*aa(a+b)*
d) none of these

Answer a
17) find the regular expression for
ambncp where m,n,p >=1
a) aa*bb*cc*
b) aa*b*c*
c) a*b*c*
d) none of these

Answer a

18) find the regular expression for


amb2nc3p where m,n,p >=1
a) aa*bb*cc*
b) aa*b*c*
c) aa*(bb)(bb)*ccc(ccc)*
d) none of these

Answer C

19) Complete the identity ^+ RR*=


a) R
b) R*
c) ^
d) RR*

answer B

20) what will be regular expression for {abba}


a) (a+b)*
b) (ab)*
c) {abba}
d) none of these

answer c
A context sensitive language is accepted by
a) Finite automata
b) Linear bounded automata
c) Both (a) and (b)
d) None of these

Ans- B

A grammar G = (V, T, P, S) in which V is


a) Set of variables
b) Set of terminals
c) Set of variables and terminals
d) None of these

Ans-A

A grammar G = (V, T, P, S) in which T is


a) Set of variables
b) Set of terminals
c) Set of variables and terminals
d) None of these

Ans- B

Which of the following is more powerful?


a) PDA
b) Turing machine
c) Finite automata
d) Context sensitive language
Ans-B

Which of the following string is generated by the grammar


S -> 0S1AB
A -> 4A
B -> SA
a) 0111
b) 010101
c) 00000
d) None of these
Which of the following relates to Chomsky hierarchy?
a) Regular<CFL<CSL<Unrestricted
b) CFL<CSL<Unrestricted<Regular
c) CSL<Unrestricted<CF<Regular
d) None of the mentioned

Ans-a

A language is accepted by a push down automata if it is:


a) regular
b) context free
c) both (a) and (b)
d) none of the mentioned

Ans- B

Which of the following strings do not belong the given regular expression?
(a)*(a+cba)
a) aa
b) aaa
c) acba
d) acbacba

Ans-d

Which of the following CFG's can't be simulated by an FSM ?

A.S --> Sa | b

B.S --> aSb | ab

C.S --> abX, X --> cY, Y --> d |


aX

D.None of these

Ans-B

Regular Grammar is accepted by

a. FA
b. LBA
c. Turing Machine
d. All

Q. If Σ = {a,b} and given productions are

S→XaaX

X→aX| bX|Λ

Then the above grammar defines the language expressed by___________ regular expression

a. (a+b)*aa(a+b)*
b. (a+b)*a(a+b)*a
c. (a+b)*aa(a+b)*aa
d. (a+b)*aba+b)*
Ans-A

Q. The languages which can not accept PDA________

A. REGULAR LANGUAGES

B. CONTEXT FREE

C. CONTEXT SENSITIVE

D. NONE.

Ans- C

Q Regular grammar is
a) Context free grammar
b) Non context free grammar
c) English grammar
d) None of the mentioned
Ans- A
Regular expression are
a) Type 0 language
b) Type 1 language
c) Type 2 language
d) Type 3 language
Ans- A
L and ~L are recursive enumerable then L is
a) Regular
b) Context free
c) Context sensitive
d) Recursive
Ans-D
Regular expressions are closed under
a) Union
b) Intersection
c) Kleene star
d) All of the mentioned

Ans-d

How many strings of length less than 4 contains the language described by the regular expression
(x+y)*y(a+ab)*?
a) 7
b) 10
c) 12
d) 11

Ans-D

Grammatical rules which involve the meaning of words are called:


a. Semantics
b. Syntactic
c. Both a and b
d. None of given
Ans- A

Grammatical rules which do not involve the meaning of words are called:
a. Semantics
b. Syntactic
c. Both a and b
d. None of given
Ans-B

The symbols in a grammar that can’t be replaced by anything are called:


a. Productions
b. Terminals
c. Non-terminals
d. All of above
Ans-B

The symbols in a grammar that must be replaced by other Synbols are called:
a. Productions
b. Terminals
c. Non-terminals
d. None of given
Ans-C
A context sensitive language is accepted by
a) Finite automata
b) Linear bounded automata
c) Both (a) and (b)
d) None of these

Ans- B

A grammar G = (V, T, P, S) in which V is


a) Set of variables
b) Set of terminals
c) Set of variables and terminals
d) None of these

Ans-A

A grammar G = (V, T, P, S) in which T is


a) Set of variables
b) Set of terminals
c) Set of variables and terminals
d) None of these

Ans- B

Which of the following is more powerful?


a) PDA
b) Turing machine
c) Finite automata
d) Context sensitive language
Ans-B

Which of the following string is generated by the grammar


S -> 0S1AB
A -> 4A
B -> SA
a) 0111
b) 010101
c) 00000
d) None of these
Which of the following relates to Chomsky hierarchy?
a) Regular<CFL<CSL<Unrestricted
b) CFL<CSL<Unrestricted<Regular
c) CSL<Unrestricted<CF<Regular
d) None of the mentioned

Ans-a

A language is accepted by a push down automata if it is:


a) regular
b) context free
c) both (a) and (b)
d) none of the mentioned

Ans- B

Which of the following strings do not belong the given regular expression?
(a)*(a+cba)
a) aa
b) aaa
c) acba
d) acbacba

Ans-d

Id/Name ---2894 K18SB_TEST_2020/10/08 09:00 Start Time 10/8/2020,


9:00:00 AM

Which of the following CFG's can't be simulated by an FSM ?

A.S --> Sa | b

B.S --> aSb | ab

C.S --> abX, X --> cY, Y --> d |


aX

D.None of these

Ans-B

Regular Grammar is accepted by


a. FA
b. LBA
c. Turing Machine
d. All

Q. If Σ = {a,b} and given productions are

S→XaaX

X→aX| bX|Λ

Then the above grammar defines the language expressed by___________ regular expression

a. (a+b)*aa(a+b)*
b. (a+b)*a(a+b)*a
c. (a+b)*aa(a+b)*aa
d. (a+b)*aba+b)*
Ans-A

Q. The languages which can not accept PDA________

A. REGULAR LANGUAGES

B. CONTEXT FREE

C. CONTEXT SENSITIVE

D. NONE.

Ans- C

Q Regular grammar is
a) Context free grammar
b) Non context free grammar
c) English grammar
d) None of the mentioned
Ans- A
Regular expression are
a) Type 0 language
b) Type 1 language
c) Type 2 language
d) Type 3 language
Ans- A
L and ~L are recursive enumerable then L is
a) Regular
b) Context free
c) Context sensitive
d) Recursive
Ans-D
Regular expressions are closed under
a) Union
b) Intersection
c) Kleene star
d) All of the mentioned

Ans-d

How many strings of length less than 4 contains the language described by the regular expression
(x+y)*y(a+ab)*?
a) 7
b) 10
c) 12
d) 11

Ans-D

Grammatical rules which involve the meaning of words are called:


a. Semantics
b. Syntactic
c. Both a and b
d. None of given
Ans- A

Grammatical rules which do not involve the meaning of words are called:
a. Semantics
b. Syntactic
c. Both a and b
d. None of given
Ans-B

The symbols in a grammar that can’t be replaced by anything are called:


a. Productions
b. Terminals
c. Non-terminals
d. All of above
Ans-B

The symbols in a grammar that must be replaced by other Synbols are called:
a. Productions
b. Terminals
c. Non-terminals
d. None of given
Ans-C
Q1. Consider the languages L1 = ᶲ and L2 = {a}. Which one of the following represents

L1 L2* U L1
a) {€} b)ᶲ c) a* d) {€,a}

Q2. Let S and T be language over ={a,b} represented by the regular expressions (a+b*)*
and (a+b)*, respectively. Which of the following is true?
(a) ScT (S is a subset of T)
(b) TcS (T is a subset of S)
(c) S=T
(d) SnT=Ø
Q3. Let L denotes the language generated by the grammar S – OSO/00. Which of the
following is true?
(a) L = O
(b) L is regular but not O
(c) L is context free but not regular
(d) L is not context free
Q4. Consider the following two statements:
S1: { 0^2n |n >= l} is a regu1ar language
S2: { 0^m 0^n 0^(m+n) l m >= 1 and n >= 2} is a regu1ar language
Which of the following statements is correct? (GATE CS 2001)
a) Only S1 is correct
b) Only S2 is correct
c) Both S1 and S2 are correct
d) None of S1 and S2 is correct
Q5. Which of the following statements in true? (GATE CS 2001)
(a) If a language is context free it can always be accepted by a deterministic push-down
automaton
(b) The union of two context free languages is context free
(c) The intersection of two context free languages is context free
(d) The complement of a context free language is context free
Q6. Given an arbitrary non-deterministic finite automaton (NFA) with N states, the
maximum number of states in an equivalent minimized DFA is at least. (GATE CS 2001)
(a) N^2
(b) 2^N
(c) 2N
(d) N!
Q7. Given the language L = {ab, aa, baa}, whih of the following strings are in L*?
1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa
(A) 1, 2 and 3
(B) 2, 3 and 4
(C) 1, 2 and 4
(D) 1, 3 and 4
8. Which of the following problems are decidable?
….1) Does a given program ever produce an output?
….2) If L is a context-free language, then is L’ (complement of L) also context-free?
….3) If L is a regular language, then is L’ also regular?
….4) If L is a recursive language, then, is L’ also recursive?
(A) 1, 2, 3, 4
(B) 1, 2,
(C) 2, 3, 4
(D) 3, 4
9. Let P be a regular language and Q be context-free language such that Q ⊆ P. (For
example, let P be the language represented by the regular expression p*q* and Q be
{pnqn|n ∈ N}). Then which of the following is ALWAYS regular?
(A) P ∩ Q
(B) P – Q
(C) ∑* – P
(D) ∑* – Q
10. (a+b)* is equivalent to
a) b*a*
b) (a*b*)*
c) a*b*
d) none of the mentioned
11. a? is equivalent to
a) a
b) a+Φ
c) a+ϵ
d) wrong expression
12. Regular expression Φ* is equivalent to
a) ϵ
b) Φ
c) 0
d) 1
13. A language is regular if and only if
a) accepted by DFA
b) accepted by PDA
c) accepted by LBA
d) accepted by Turing machine
14. Let the class of language accepted by finite state machine be L1 and the class of languages
represented by regular expressions be L2 then
a) L1<L2
b) L1>=L2
c) L1 U L2 = .*
d) L1=L2
15. Regular expression {0,1} is equivalent to
a) 0 U 1
b) 0 / 1
c) 0 + 1
d) All of the mentioned
UNIT-I: FINITE AUTOMATA

1. Analytically, a finite automaton can be represented by a _________ tuples:


a. 6
b. 4
c. 5
d. 7

2. Final state(s) may not be a part of the given states of a finite automaton.
a. True
b. False
c. Both
d. None of These

3. Transition Systems is the other name given to:


a. Transition table
b. Transition diagram
c. States of automata
d. Automata as a whole

4. Implicitly, δ(q,^) = _______


a. q
b. ^
c. Initial state
d. Final state

5. For any transition function δ and for any two input strings x and y, δ(q, xy) = _________
a. δ(q, x).δ(q, y)
b. δ(q, yx)
c. δ(q, x)×δ(q, y)
d. δ(δ(q, x),y)

6. DFA stands for:


a. Deterministic Final Automata
b. Deterministic in-Finite Automata
c. Determined Finite Automata
d. Deterministic Finite Automata

7. The function Z(t) = λ(q(t), x(t)) represents:


a. Moore Machine
b. Deterministic Finite Automata
c. Mealy Machine
d. Non-Deterministic Finite Automata

8. The function Z(t) = λ(q(t)) represents:


a. Moore Machine
b. Deterministic Finite Automata
c. Mealy Machine
d. Non-Deterministic Finite Automata

9. In a transition table, initial state is depicted by which of the following symbol?


a. Arrow pointing to a state(→)
b. Circle over a state
c. Concentric circles over a state
d. Underlined state

10. NDFA stands for:


a. Non-Deterministic Final Automata
b. Non-Finite Deterministic Automata
c. Non-Deterministic Finite Automata
d. Non-Determined Finite Automata
11. Final state in a Transition Diagram is depicted by:
a. Arrow pointing to a state(→)
b. Circle over a state
c. Concentric circles over a state
d. Underlined state

12. Minimization of Finite automata means:


a. Converting an NDFA into a DFA
b. Reducing number of states in a finite automata
c. Creating finite automata with minimum number of final states
d. Reducing number of transitions in a finite automata

Answer keys: Unit-I

1. c 4. a 7. c 10. c
2. b 5. d 8. a 11. c
3. b 6. d 9. a 12. b
UNIT-II: REGULAR EXPRESSIONS AND REGULAR SETS

1. Machine format of Regular Expression is


a. Finite Automata
b. Push Down Automata
c. Turing Machine
d. All of the above

2. Regular Expression is accepted by

a. Finite Automata
b. Push Down Automata
c. Turing Machine
d. All of the above

3. The language of all words with atleast2 a's can be described by the Regular Expression

a. a(ab)*a
b. (a + b)*ab*a(a + b)*
c. b*ab*a(a + b)*
d. All of the above

4. Which type of language is Regular Expression?

a. Type 0
b. Type 1
c. Type 2
d. Type 3.

5. Which of the following Regular Expression over {0,1} denotes set of all strings not containing 100
as substring?

a. (1 + 0)*0*
b. 0*1010*
c. 0*1*01
d. All of the above.

6. ^+ RR*= ?

a. R
b. R*
c. R+
d. ^

7. If L= language of words containing even number of a’s. The corresponding Regular Expression is:

a. (a+b)*aa(a+b)*
b. (b+ab*a)*
c. a+bb*aab*a
d. (a+b)*ab(a+b)*

8. The language that can be expressed by any regular expression is called aNon-regular language.

a. True
b. False

9. Arden’s theorem states that if R = Q + RP, then _________is its unique solution.

a. R = QP*
b. R = PQ*
c. R = P*Q*
d. R = Q*P*

10. The regular expression described by following automata is,

a. 01*01*
b. (01)*
c. 0*1*
d. 1*0*

11. Which of the following are the examples of non-regular languages.

a. PALINDROME and PRIME


b. PALINDROME and EVEN-EVEN
c. EVEN-EVEN and PRIME
d. FACTORIAL and SQURE

12. Languages are proved to be regular or non-regular using pumping lemma.

a. True
b. False

Answer keys: Unit-II

1. a 3. d 5. c 7. b
2. a 4. d 6. b 8. b
9. a 10. c 11. a 12. a
UNIT-III: FORMAL LANGUAGES AND REGULAR GRAMMARS

1. Noam Chomsky gave a mathematical model of a grammar in:


a. 1966
b. 1956
c. 1946
d. 1976

2. A grammar is also called a _________structured grammar.


a. Phrase
b. Pre
c. Parse
d. Class

3. The elements of VN in a grammar are called:


a. Terminals
b. Starting Symbols
c. Variables
d. Production rules

4. For any grammar G = (VN, Σ, P, S), VN ∩ Σ = __________


a. Σ
b. VN ∪ Σ
c. ϴ
d. VN

5. S in a grammar G = (VN, Σ, P, S) is called the:


a. Stop symbol
b. Special symbol
c. Syntax symbol
d. Start symbol

6. Grammatical rules which involve the meaning of words are called:


a. Semantics
b. Syntactic
c. Both a and b
d. None of given

7. Grammatical rules which do not involve the meaning of words are called:
a. Semantics
b. Syntactic
c. Both a and b
d. None of given

8. The symbols in a grammar that can’t be replaced by anything are called:


a. Productions
b. Terminals
c. Non-terminals
d. All of above

9. The symbols in a grammar that must be replaced by other things are called:
a. Productions
b. Terminals
c. Non-terminals
d. None of given

10. The grammatical rules are often called:


a. Productions
b. Terminals
c. Non-terminals
d. None of given

11. The terminals are designated by _____letters, while the non-terminals are designated by
____letters.
a. Capital, bold
b. Small, capital
c. Capital, small
d. Small, bold

12. L(G) is an acronym used for:


a. Leaves of derivation tree for a grammar G
b. Length of a grammar G
c. Left hand symbols of all productions in G
d. Language generated by a grammar G

Answer keys: Unit-III

1. b
2. a
3. c
4. c
5. d
6. a
7. b
8. b
9. c
10. a
11. b
12. d
UNIT-I: FINITE AUTOMATA

13. While minimizing a finite automata, we generally create the:


a. Equivalence states
b. Equivalence transitions
c. Equivalence classes
d. Equivalence groups

14. A Moore machine is a six-tuple (Q, Σ, Δ, δ,λ, q 0) where Δ is the:


a. Output alphabet
b. Input alphabet
c. Transition function
d. Output function

15. A finite automata may contain more than one final states:
a. True
b. False

16. The number of columns in a transition table for a finite automata are:
a. Three
b. One less than the number of input symbols
c. Same as the number of input symbols
d. One more than the number of input symbols

17. The transition function that maps Q X Σ* into Q is called:


a. Direct transition function
b. Indirect transition function
c. Simple transition function
d. Directed transition function

18. When next state of an automata at any instant of time is determined by the present state and
the present input, then it is called a:
a. State relation
b. Output relation
c. Set of states
d. Set of input symbols

19. A string x is accepted by a finite automata if δ(q 0,x) = q; where q is:


a. Initial state
b. Final state
c. Any state
d. None of the above

20. Q is a set of states in finite automata. What holds true for Q:


a. Q may contain any number of states
b. Q contains finite number of states
c. Q does not contain any final state
d. Q in not a set of states.
21. Determine the Equavent Machine that takes present state and output
a. Moore
b. Mealy
c. Both
d. None
22. How many tuples are there in Finite Automata
a. 4
b. 5
c. 6
d. 7
23. Minimized automata should be
a. DFA
b. NFA
c. Both
d. None
24. Finite Automata can deal with which langauge
a. Regular Languages
b. Context Free
c. Context Sensitive
d. Recursive Ennumerable

Answer keys: Unit-I

1. C
2. A
3. A
4. D
5. B
6. A
7. B
8. B
9. B
10. B
11. A
12. A
UNIT-II: REGULAR EXPRESSIONS AND REGULAR SETS

1. In pumping lemma theorem (xyiz) the range of i is

a. i=…….-3,-2,-1, 1, 2, 3, 4……
b. i=0, 1, 2, 3, 4……….
c. i=…….-3,-2,-1, 0, 1, 2, 3, 4……
d. i=1, 2, 3, 4……….

2. To examine whether a certain FA accepts any words, it is required to seek the paths from
_______state.
a. Final to initial
b. Final to final
c. Initial to final
d. Initial to initial

3. If Σ = {a,b} and given productions are

S→XaaX

X→aX| bX|Λ

Then the above grammar defines the language expressed by___________ regular expression

a. (a+b)*aa(a+b)*
b. (a+b)*a(a+b)*a
c. (a+b)*aa(a+b)*aa
d. (a+b)*aba+b)*

4. A regular expression can be defined as a language or string accepted by a finite automata.

a. True
b. False

5. If w BELONGS TO (a, b)* satisfy abw = wab, then (w) is

a. Null
b. Odd
c. Even
d. None of these

6. Identity: ^ + R = ________

a. ^
b. RR
c. R*
d. R

7. Identity: R + R = ________

a. 2R
b. RR
c. R
d. R*

8. Identity: (R*)* = ________

a. R**
b. R*R*
c. R*
d. R
9. The languages which can not accept PDA________

A. REGULAR LANGUAGES

B. CONTEXT FREE

C. CONTEXT SENSITIVE

D. NONE.

10. CONVERSION OF NFA TO DFA WILL LEAD TO HOW MANY INITIAL STATES

A. 2

B. 1

C. NONE

D. BOTH

11. How many strings of length less than 4 contains the language described by the regular expression
(x+y)*y(a+ab)*?
a) 7
b) 10
c) 12
d) 11

12 . A language is regular if and only if


a) accepted by DFA
b) accepted by PDA
c) accepted by LBA
d) accepted by Turing machine

Answer keys: Unit-II

1. D 8. C
2. C 9. A
3. A 10. B
4. A 11. D
5. C 12. A
6. D
7. C
UNIT-III: FORMAL LANGUAGES AND REGULAR GRAMMARS

13. The highest type of grammar under Chomsky classification is:


a. Type-3
b. Type-4
c. Type-2
d. Type-0

14. Type-1 grammars are also called:


a. Phrase structure grammars
b. Context free grammars
c. Context sensitive grammars
d. Regular grammars

15. A production of the form A → a and A → aB is called a ___________ production.


a. Type-0
b. Type-3
c. Type-1
d. Type-2

16. The machine counterpart of Context Free Grammars is:


a. Finite automata
b. Pushdown automata
c. Turing machine
d. Linear bounded automata

17. The machine counterpart of Regular Grammars is:


a. Finite automata
b. Pushdown automata
c. Turing machine
d. Linear bounded automata

18. _______________is the corresponding automata for Context Sensitive languages:


a. Linear bounded automata
b. Turing machine
c. Finite automata
d. Pushdown automata

19. The symbol used for step by step derivation of a grammar is:
a. →
b. ⇒
c. ↔
d. ⇄
e.
20. Language generated by grammar G = ( {S, C}, {a, b}, P, S ) where P consists of S → aCa, C → aCa |
b is:
a. abna
b. anbnan
c. abnan
d. anban
21. Regular grammar is
a) Context free grammar
b) Non context free grammar
c) English grammar
d) None of the mentioned
22. Regular expression are
a) Type 0 language
b) Type 1 language
c) Type 2 language
d) Type 3 language
23. L and ~L are recursive enumerable then L is
a) Regular
b) Context free
c) Context sensitive
d) Recursive
24. . Regular expressions are closed under
a) Union
b) Intersection
c) Kleene star
d) All of the mentioned

Answer keys: Unit-III

17. a 21. a
13. a 18. a 22. a
14. c 19. b 23. d
15. b 20. d 24. d
16. b
Unit 4 :CONTEXT FREE GRAMMARS + SIMPLIFICATION OF CONTEXT- FREE GRAMMARS

1. The production of the form no terminal → Λ is said to be null production.


a. TRUE
b. FALSE

2. A production is called null able production if it is of the form N → Λ


a. TRUE
b. FALSE

3. The productions of the form nonterminal → one nonterminal, is called _________


a. Null production
b. Unit production
c. Null able production
d. None of given

4. CNF is stands for


a. Context Normal Form
b. Complete Normal Form
c. Chomsky Normal Form
d. Compared Null Form

5. GNF stands for


a. Gray Normal Form
b. Greibach Normal Form
c. Graphite Normal Form
d. Greatest Normal Form

6. The derivation of the 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
a. Left most terminal
b. Left most deviation
c. None of these
d. Both a and b

7. The process of finding the derivation of word generated by particular grammar is called :
a. PLUS TIMING
b. Parsing
c. HALT
d. All of above

8. A production in CFG consists of:


a. One terminal
b. More than one terminal
c. One non-terminal
d. Terminals and non-terminals
9. The entity which generate Language is termed as:
a) Automata
b) Tokens
c) Grammar
d) Data
10. The Grammar can be defined as: G=(V, ∑, p, S)
In the given definition, what does S represents?
a) Accepting State
b) Starting Variable
c) Sensitive Grammar
d) None of these
11. Which of the expression is appropriate?
For production p: a->b where a∈V and b∈_______
a) V
b) S
c) (V+∑)*
d) V+ ∑
12. For S->0S1|e for ∑={0,1}*, which of the following is wrong for the language produced?
a) Non regular language
b) 0n1n | n>=0
c) 0n1n | n>=1
d) None of the mentioned

Answer Keys: Unit 4

3. b 8. d
4. c 9. C
1. a 5. b 10. B
2. a 6. b 11. C
7. b 12. d
Unit V: PUSHDOWN AUTOMATA AND PARSING

1. For a given Pushdown automata, we can construct an equivalent context free grammar:
a. True
b. False

2. In __________ parsing, we attempt to construct a derivation of the input string, starting from the root and ending
in the given input string.
a. Top-down
b. Top-Up
c. Bottom-Up
d. Bottom-Down

3. In __________ parsing, we attempt to construct a derivation from the given input string to the top ie, the root with
label S.
a. Top-down
b. Top-Up
c. Bottom-Up
d. Bottom-Down

4. In LL(k), the first L stands for__________:


a. Left
b. Look from right
c. Lost symbols
d. Look ahead

5. In LL(k), the second L stands for__________:


a. Look from right
b. Left
c. Lost symbols
d. Look ahead

6. In LL(k), k represents:
a. Number of symbols to look behind
b. Number of symbols to look ahead
c. Number of input symbols in the string
d. Number of symbols towards left of current symbol

7. In LL(k), the value of k can also be negative.


a. True
b. False

8. In order to do top-down parsing for a general string in L(G), we prepare a table called:
a. Transition table
b. Parse Table
c. Top-down Table
d. Production Table
9. The transition a Push down automaton makes is additionally dependent upon the:
a) stack
b) input tape
c) terminals
d) none of the mentioned
10. With reference of a DPDA, which among the following do we perform from the start state with an empty stack?
a) process the whole string
b) end in final state
c) end with an empty stack
d) all of the mentioned
11. If the PDA does not stop on an accepting state and the stack is not empty, the string is:
a) rejected
b) goes into loop forever
c) both (a) and (b)
d) none of the mentioned
12. A language accepted by Deterministic Push down automata is closed under which of the following?
a) Complement
b) Union
c) Both (a) and (b)
d) None of the mentioned

Answer keys: Unit-V

1. a 7. b
2. a 8. b
3. c 9. a
4. d 10. d
5. b 11. a
6. b 12. a
Unit V1: TURING MACHINES AND COMPLEXITY

1. A Turing machine can be:

a. Multi-Tape Turing Machine


b. Multi-head Turing Machine
c. Universal Turing machine
d. All of the above

2. A Turing machine can only be deterministic.

a. True
b. False

3. A Turing machine can be a Multi-Track Turing machine.

a. True
b. False

4. Who is known as the father of Computer Science?

a. S. C. Kleene
b. Alanzo Church
c. Charles Babbage
d. Alan Turing

5. A ____________ is a theoretical computing machine invented by Alan Turing (1937) to serve as an


idealized model for mathematical calculation.

a. Linear Bounded Automata


b. Turing Machine
c. Finite Automata
d. Pushdown Automata

6. A Turing machine can run forever, enter a loop, or reach a particular state or set of conditions at
which it is prescribed to halt.

a. True
b. False

7. In computer science, a _______________is a Turing machine that can simulate an arbitrary Turing
machine on arbitrary input.

a. Universal Turing machine


b. Deterministic Turing machine
c. Non- Deterministic Turing machine
d. Multi-Tape Turing machine

8. A ________ is the simplest form of a computer.


a. Finite Automata
b. Linear Bounded Automata
c. Turing Machine
d. Pushdown Automata
9. The machine accept the string by entering into hA or it can:
a) explicitly reject x by entering into hR
b) enter into an infinte loop
c) Both (a) and (b)
d) None of the mentioned

10. Which of the following can accept even palindrome over {a,b}
a) Push down Automata
b) Turing machine
c) NDFA
d) All of the mentioned

11. If T1 and T2 are two turing machines. The composite can be represented using the expression:
a) T1T2
b) T1 U T2
c) T1 X T2
d) None of the mentioned

12. The number of states required to automate the last question i.e. {a,b}*{aba}{a,b}* using finite automata:
a) 4
b) 3
c) 5
d) 6

Answer Keys: Unit V1:

2. b
3. a
4. d
5. b
6. a
7. a
8. c
9. c
10. c
11. a
12. a

1. d
Q1 Which of the following pairs of regular expressions are equivalent?
a) 1(01)* and (10)*1
b) x (xx)* and (xx)*x
c) x^+ and x^+ x^(*+)
d) All of the mentioned

Q2 What is the Regular Expression Matching Zero or More Specific Characters


a) x
b) #
c) *
d) &

Q3

Ans. C

Q4
Ans. A

Q5

Ans. B

Q6
Ans. A

Q7 Consider the two automata

A. A and B are Equivalent


B. A and B are not Equivalent
C. Cannot be defined
D. None of these

Ans.A

Q8 Regular expression (x/y)(x/y) denotes the set

a. {xy,xy}

b. {xx,xy,yx,yy}

c. {x,y}

d. {x,y,xy}

Ans.b
Q9 The regular expression with all strings of 0′s and 1′s with at least two consecutive 0′s is:

a. 1 + (10)*

b. (0+1)*00(0+1)*

c. (0+1)*011

d. 0*1*2*

Ans. B

Q10 Find the pair of regular expressions that are equivalent

a. (0+1)* and (0*+1*)*

b. (0+1)* and (0+1*)*

c. (0+10)* and (0*+10)*

d. All of the mentioned

Ans. D

Q11

Which of the following is same as the given DFA?

a. (0+1)*001(0+1)*
b. 1*001(0+1)*
c. (01)*(0+0+1)(01)*
d. None of the mentioned

Ans. A

Q12

Which of the given regular expressions correspond to the automata shown?


a. (110+1)*0

b. (11+110)*1

c. (110+11)*0

d. (1+110)*1

Ans. C

Q13 Which among the following looks similar to the given expression?

((0+1). (0+1)) *

a. {xϵ {0,1} *|x is all binary number with even length}

b. {xϵ {0,1} |x is all binary number with even length}

c. {xϵ {0,1} *|x is all binary number with odd length}

d. {xϵ {0,1} |x is all binary number with odd length}


Ans. A

Q14 (a + b*c) most correctly represents:

a. (a +b) *c

b. (a)+((b)*.c)

c. (a + (b*)).c

d. a+ ((b*).c)

Ans. D

Q15

Which NDFA correctly represents the following RE

a(bab)*∪a(ba)*
Ans. a
Q16 Which of the following does the given NFA represent?

a. {11, 101} * {01}

b. {110, 01} * {11}

c. {11, 110} * {0}

d. {00, 110} * {1}

ans. C

Question 1: While applying Pumping lemma over a language, we consider a string w that belong to L and
fragment it into _________ parts.

a) 2

b) 5

c) 3

d) 6

Ans: c
Question 2: If we select a string w such that w∈L, and w=xyz. Which of the following portions cannot be
an empty string?

a) x

b) y

c) z

d) all of the mentioned

Ans: b

Question 3: There exists a language L. We define a string w such that w∈L and w=xyz and |w| >=n for
some constant integer n.What can be the maximum length of the substring xy i.e. |xy|<=?

a) n

b) |y|

c) |x|

d) none of the mentioned

Ans: a

Question 4: Fill in the blank in terms of p, where p is the maximum string length in L.

Statement: Finite languages trivially satisfy the pumping lemma by having n = ______

a) p*1

b) p+1

c) p-1

d) None of the mentioned

Ans: b

Question 5: Let w be a string and fragmented by three variable x, y, and z as per pumping lemma. What
does these variables represent?

a) string count

b) string
c) both (a) and (b)

d) none of the mentioned

Ans: a

Question 6: Which of the following is not an application of Pumping Lemma?

a) {0i1i|i>=0}

b) {0ix|i>=0, x∈{0, 1}* and |x|<=i}

c) {0n| n is prime}

d) None of the mentioned

Ans: d

Question 7: Pumping lemma method is used to geneate ....... from .........

a) (i) many input strings (ii) one string

b) (i) one string (ii) many input strings

c) Either a or b

d) None of the mentioned

Ans: a

Question 8: Amongst the various pairs, which pair is taken in the pumping lemma

a) 1st

b) 2nd

c) 4th

d) None of the mentioned

Ans: a
Question 9: Let w= xyz and y refers to the middle portion and |y|>0.What do we call the process of
repeating y 0 or more times before checking that they still belong to the language L or not?

a) Generating

b) Pumping

c) Producing

d) None of the mentioned

Ans: b

Question 10: Answer in accordance to the third and last statement in pumping lemma:

For all _______ xyiz ∈L

a) i>0

b) i<0

c) i<=0

d) i>=0

Ans: d

Question 11: Which of the technique can be used to prove that a language is non regular?

a) Ardens theorem

b) Pumping Lemma

c) Ogden’s Lemma

d) None of the mentioned

Ans: b

Question 12: If L1′ and L2′ are regular languages, then L1.L2 will be

a) regular

b) non regular

c) may be regular
d) none of the mentioned

Ans: a

Question 13: If L1 and L2′ are regular languages, L1 ∩ (L2′ U L1′)’ will be

a) regular

b) non regular

c) may be regular

d) none of the mentioned

Ans: a

Question 14: If A and B are regular languages, !(A’ U B’) is:

a) regular

b) non regular

c) may be regular

d) none of the mentioned

Ans: a

Question 15: Which among the following is the closure property of a regular language?

a) Emptiness

b) Universality

c) Membership

d) None of the mentioned

Ans: d

1. There are ________ tuples in finite state machine.


a) 4
b) 5
c) 6
d) unlimited
Ans:- B

2. Transition function maps.


a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q
Ans: - d

3. Number of states requires accepting string ends with 10.


a) 3
b) 2
c) 1
d) can’t be represented.
Ans:-a

4. Number of final state requires accepting Φ in minimal finite automata.


a) 1
b) 2
c) 3
d) None of the mentioned
Ans:-d

5. Number of states requires in NFA simulating a computer with memory


capable of storing ‘3’ words each of length ‘8’.
a) 3 * 28
b) 2(3*8)
c) 2(3+8)
d) None of the mentioned
Ans:- b
6. An NFA’s transition function returns
a. A Boolean value
b. A state
c. A set of states
d. An edge
Ans:C
7. The behaviour of a NFA can be stimulated by DFA
a. Always
b. Sometimes
c.Never
d. Depends on NFA
Ans:-a
8. The relation between NFA-accepted languages and DFA accepted languages
is
a. >
b.<
c.=
d.<=
Ans:- c
9. Examine the following DFA: If input is 011100101, which edge is NOT
traversed?

a. A B
b. C
c. C D
d. D A
Ans:- C
10. The transitional function of a NFA is
a. Q X Σ→Q
b. Q X Σ→2Q
c. Q X Σ→2n
d.Q X Σ→Qn
Ans:- B
11. Which is true for Dead State?
a. It cannot be reached anytime
b. There is no necessity of the state
c. If control enters no way to come out from the state
d.If control enters FA deads
Ans:- C
12. Which among the following states would be notated as the final
state/acceptance state?

L= {xϵ∑= {a, b} | length of x is 2}

a. q1
b. q2
c. q1, q2
d. q3
Ans:- b
13. Which of the following are the final states in the given DFA according to the
Language given ?
L= {xϵ∑= {a, b} |length of x is at most 2}
a. q0, q1
b. q0, q2
c.q1, q2
d. q0, q1, q2
Ans:D
14. Which of the following x is accepted by the given DFA (x is a binary string ∑=
{0,1})?

a. divisible by 3
b. divisible by 2
c. divisible by 2 and 3
d. divisible by 3 and 2
Ans:- d
15. Choose the correct option for the given statement:

Statement: The DFA shown represents all strings which has 1 at second last
position.

a. Correct
b. Incorrect, Incomplete DFA
c. Wrong proposition
d. May be correct

MCQ’s on regular languages and regular expressions

1. A language is regular if and only if

a) accepted by DFA

b) accepted by PDA

c) accepted by LBA

d) accepted by Turing machine

2. Regular grammar is

a) context free grammar

b) non context free grammar

c) english grammar

d) none of the mentioned

3. Regular expression are

a) Type 0 language

b) Type 1 language
c) Type 2 language

d) Type 3 language

4. Consider the languages L1=ɸ and L2 = {a}. Which one of the following represents L1 L2* U L1*

a) A
b) B
c) C
d) D

5. Given the language L = {ab, aa, baa}, which of the following strings are in L*?

1) abaabaaabaa

2) aaaabaaaa

3) baaaaabaaaab

4) baaaaabaa

a) 1, 2 and 3

b) 2, 3 and 4

c) 1, 2 and 4

d) 1, 3 and 4

6. Let w be any string of length n is {0,1}*. Let L be the set of all substrings of w. What is the minimum
number of states in a non-deterministic finite automaton that accepts L?

a) n-1

b) n

c) n+1

d) 2n-1

7. Which one of the following languages over the alphabet {0,1} is described by the regular expression:
(0+1)*0(0+1)*0(0+1)*?

a) The set of all strings containing the substring 00

b) The set of all strings containing at most two 0’s

c) The set of all strings containing at least two 0’s

d) The set of all strings that begin and end with either 0 or 1.

8. The regular expression 0*(10*)* denotes the same set as


a) (1*0)*1*

b) 0 + (0 + 10)*
c) (0 + 1)* 10(0 + 1)*
d) none of these
9. The smallest finite automation which accepts the language {x | length of x is divisible by 3}
has :
a) 2 states
b) 3 states
c) 4 states
d) 5 states
10. Consider the following languages

Which of the languages are regular?


a) Only L1 and L2
b) Only L2, L3 and L4
c) Only L3 and L4
d) Only L3

Q1) Consider the languages L1 = and L2 = {a}. Which one of the following represents L1
L2* U L1*
a){ epsilon } b) a* c){epsilon,a} d)none
Answer: A
Q2)
Consider the DFA given. Which of the following are FALSE?
1. Complement of L(A) is context-free.
2. L(A) = L((11*0+0)(0 + 1)*0*1*)
3. For the language accepted by A, A is the minimal DFA.
4. A accepts all strings over {0, 1} of length at least 2.
Answer: 3 and 4
Q3) Given the language L = {ab, aa, baa}, which of the following strings are in L*?
1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa
Answer : 1,2,4

Q4) Find the regular expression for the given

Answer : c*a(d+bc*a)*
Q5) Find the regular expression for the given
Answer: b*(aa*(bb*+∈)+∈)
Q6) Find the regular expression for the given

Answer: (ab + b(a+bb))*


Q7) Find the regular expression for the given
Answer: regular expression is only a, because state B is dead state.
Q8) Find the regular expression for the given

Answer: aa* + ba*


Q9) A regular language over an alphabet a is one that can be obtained from
a) union
b) concatenation
c) kleene
d) All of the mentioned
Answer: d
Q10)
Regular expression Φ* is equivalent to
a) ϵ
b) Φ
c) 0
d) 1
Answer:A
Q: 1 How many states are require to construct a minimal dfa from the given DFA

a)2 b)3 c)4 d)5


2.From the given DFA which string is accepted

a) abbabb b) abbabba c) aabba d) aaba

ans a

3.Which DFA is accept the string in which every a is followed by b where Σ = {a,b} .

a)

b)

c)
d) None of these
4.
9.)Consider the finite automaton in the following figure. What is the set of reachable states for the input string 0011 ?

a. q0, q1,q2

b. q0,q1

c. q0,q1,q2,q3

d. q3

5.What the following DFA accepts?

a) x is a string such that it ends with ‘101’


b) x is a string such that it ends with ‘01’
c) x is a string such that it has odd 1’s and even 0’s
d) x is a strings such that it has starting and ending character as 1

6. Minimize the dfa below given transition table

a) 3 b)4 c)2 d)5


7.How many states are required after construct a minimal DFA
A)3 B)2 C)5 D)4
8)Statement 1: Acceptance of string only when it goes to first state to final state .
statement 2: String is accepted only when it statisfy the language .
a) Statement 1 is correct , Statement 2 is correct .
b) Statement 1 is not correct , Statement 2 is correct .
c) Statement 1 is correct , Statement is not correct
d) Statement 1 is not correct , statement 2 is not correct
9) At which state String 'aa' accepted

a) D b) A c) B d) C
10) How many states after Minimize the below dfa

a) 3 b) 2 c) 4 d) 5

11) Which state is accepted String '110101'


a) q2 b) q3 c) q1 d) q4
12) Minimize given dfa

a) {A,B,} {F} ,{C,D,E}


b){A,F},{B},{C,D,E}
C){A} {B,F} {C,D,E}
D){A,B,F){C,D,E}
13.) Given the language L = {ab, aa, baa}, which of the following strings are in L*?
1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa
a)1, 2 and 3
b)2, 3 and 4
c)1, 2 and 4
d)1, 3 and 4
14.)Let w be any string of length n is {0,1}*. Let L be the set of all substrings of w. What is the minimum
number of states in a non-deterministic finite automaton that accepts L?
A )n-1
b)n
c)n+1
D)2n-1
15) Which string is accepted by DFA

a) an

b) anbn

c) anbncn

1) a ,b 2) c 3) a,b,c 4) a

1. A language is regular if and only if


a) accepted by DFA
b) accepted by PDA
c) accepted by LBA
d) accepted by Turing machine

Answer- a

2. Regular grammar is
a. context free grammar
b. non context free grammar
c. English grammar
d. none of the mentioned

Answer- a

3. Regular expression are

a. Type 0 language
b. Type 1 language
c. Type 2 language
d. Type 3 language

4. Regular languages are closed under (closure properties)

a. Concatenation

b. Union

c. Complement
d. All of the above

Answer- d

5. If L1 is regular, then there exists some regular expression r1 which describes it. Same for L2.
Then:L1 U L2 = L(r1) U L(r2) = r1 + r2

r1 + r2 is a regular expression and therefore describes a regular language.

a. True
b. False

Answer : a

6. If L1 = {an | n ≥ 0} and L2 = {bn | n ≥ 0} is regular


then L3 = L1.L2 = {am . bn | m ≥ 0 and n ≥ 0} is also regular?
a. False
b True
Answer b
7. Which one of the following languages over the alphabet {0,1} is described by the regular
expression?
(0+1)*0(0+1)*0(0+1)*
a. The set of all strings containing the substring 00.
b. The set of all strings containing at most two 0’s.
c. The set of all strings containing at least two 0’s.
d. The set of all strings that begin and end with either 0 or 1.
Answer c
8. A language is regular if it can be expressed in terms of ……………..
a. Regular expression
b. Type 0 Language
c. English Grammer
g. None of the above
Answer a
9. Which of the following pairs of regular expressions are equivalent?

a. 1(01)* and (10)*1


b. x (xx)* and (xx)*x

c. x^+ and x^+ x^(*+)

d. All of the above mentioned


Answer d

10. Regular expressions are used to represent which language

a) Recursive language

b) Context free language

c) Regular language

d) All of these

Answer c

11. Which of the following operation can be applied on regular expressions?

a) Union

b) Concatenation

c) Closure

d) All of these

answer d

12. 7. Which of the following identity is wrong?

a) R + R = R

b) (R*)* = R*

c) ɛR = Rɛ = R

d) ØR = RØ = RR*

Answer d

13. Which of the following statement is true?

a) Every language that is defined by regular expression can also be defined by finite automata

b) Every language defined by finite automata can also be defined by regular expression

c) We can convert regular expressions into finite automata

d) All of these

Answer d

14. Which of the following identity is true?

a) ɛ +RR* = R* = ɛ + R*R
b) (R1R2)*R1 = R1(R2R1)*

c) R*R* = R*

d) All of these

15. (a+b)* is equivalent to


a) b*a*
b) (a*b*)*
c) a*b*
d) none of the mentioned

Answer b

16. Consider a finite automaton, with A-moves, given in Fig. which among the following is the
Equivalent automaton without A-moves.

a.

b.

c.

d. None of above

Answer a

17. Suppose we want to replace a null move from vertex V1 to vertex V2 in FA Then
What is the first step needs to be done:
a. Make a new vertex V3
b. Find all the edges starting from v2
c. Delete Vertex V2
d. None of the above

Answer b

A context sensitive language is accepted by


a) Finite automata
b) Linear bounded automata
c) Both (a) and (b)
d) None of these

Ans- B
A grammar G = (V, T, P, S) in which V is
a) Set of variables
b) Set of terminals
c) Set of variables and terminals
d) None of these

Ans-A
A grammar G = (V, T, P, S) in which T is
a) Set of variables
b) Set of terminals
c) Set of variables and terminals
d) None of these

Ans- B
Which of the following is more powerful?
a) PDA
b) Turing machine
c) Finite automata
d) Context sensitive language
Ans-B

Which of the following string is generated by the grammar


S -> 0S1AB
A -> 4A
B -> SA
a) 0111
b) 010101
c) 00000
d) None of these

Which of the following relates to Chomsky hierarchy?


a) Regular<CFL<CSL<Unrestricted
b) CFL<CSL<Unrestricted<Regular
c) CSL<Unrestricted<CF<Regular
d) None of the mentioned
Ans-a
A language is accepted by a push down automata if it is:
a) regular
b) context free
c) both (a) and (b)
d) none of the mentioned
Ans- B
Which of the following strings do not belong the given regular expression?
(a)*(a+cba)
a) aa
b) aaa
c) acba
d) acbacba
Ans-d

Which of the following CFG's can't be simulated by an FSM ?

A.S --> Sa | b

B.S --> aSb | ab

C.S --> abX, X --> cY, Y --> d |


aX

D.None of these

Ans-B
Regular Grammar is accepted by
a. FA
b. LBA
c. Turing Machine
d. All

Q. If Σ = {a,b} and given productions are


S→XaaX
X→aX| bX|Λ
Then the above grammar defines the language expressed by___________ regular expression
e. (a+b)*aa(a+b)*
f. (a+b)*a(a+b)*a
g. (a+b)*aa(a+b)*aa
h. (a+b)*aba+b)*
Ans-A
Q. The languages which can not accept PDA________
A. REGULAR LANGUAGES
B. CONTEXT FREE
C. CONTEXT SENSITIVE
D. NONE.

Ans- C
Q Regular grammar is
a) Context free grammar
b) Non context free grammar
c) English grammar
d) None of the mentioned
Ans- A
Regular expression are
a) Type 0 language
b) Type 1 language
c) Type 2 language
d) Type 3 language
Ans- A
L and ~L are recursive enumerable then L is
a) Regular
b) Context free
c) Context sensitive
d) Recursive
Ans-D
Regular expressions are closed under
a) Union
b) Intersection
c) Kleene star
d) All of the mentioned

Ans-d

How many strings of length less than 4 contains the language described by the regular expression
(x+y)*y(a+ab)*?
a) 7
b) 10
c) 12
d) 11
Ans-D
Grammatical rules which involve the meaning of words are called:
a. Semantics
b. Syntactic
c. Both a and b
d. None of given
Ans- A
Grammatical rules which do not involve the meaning of words are called:
a. Semantics
b. Syntactic
c. Both a and b
d. None of given
Ans-B
The symbols in a grammar that can’t be replaced by anything are called:
a. Productions
b. Terminals
c. Non-terminals
d. All of above
Ans-B
The symbols in a grammar that must be replaced by other Synbols are called:
e. Productions
f. Terminals
g. Non-terminals
h. None of given
Ans-C
Q1. Consider the languages L1 = ᶲ and L2 = {a}. Which one of the following represents
L1 L2* U L1
a) {€} b)ᶲ c) a* d) {€,a}
Q2. Let S and T be language over ={a,b} represented by the regular expressions (a+b*)*
and (a+b)*, respectively. Which of the following is true?
(a) ScT (S is a subset of T)
(b) TcS (T is a subset of S)
(c) S=T
(d) SnT=Ø
Q3. Let L denotes the language generated by the grammar S – OSO/00. Which of the
following is true?
(a) L = O
(b) L is regular but not O
(c) L is context free but not regular
(d) L is not context free
Q4. Consider the following two statements:
S1: { 0^2n |n >= l} is a regu1ar language
S2: { 0^m 0^n 0^(m+n) l m >= 1 and n >= 2} is a regu1ar language
Which of the following statements is correct? (GATE CS 2001)
a) Only S1 is correct
b) Only S2 is correct
c) Both S1 and S2 are correct
d) None of S1 and S2 is correct
Q5. Which of the following statements in true? (GATE CS 2001)
(a) If a language is context free it can always be accepted by a deterministic push-down
automaton
(b) The union of two context free languages is context free
(c) The intersection of two context free languages is context free
(d) The complement of a context free language is context free
Q6. Given an arbitrary non-deterministic finite automaton (NFA) with N states, the
maximum number of states in an equivalent minimized DFA is at least. (GATE CS 2001)
(a) N^2
(b) 2^N
(c) 2N
(d) N!
Q7. Given the language L = {ab, aa, baa}, whih of the following strings are in L*?
1) abaabaaabaa
2) aaaabaaaa
3) baaaaabaaaab
4) baaaaabaa
(A) 1, 2 and 3
(B) 2, 3 and 4
(C) 1, 2 and 4
(D) 1, 3 and 4
8. Which of the following problems are decidable?
….1) Does a given program ever produce an output?
….2) If L is a context-free language, then is L’ (complement of L) also context-free?
….3) If L is a regular language, then is L’ also regular?
….4) If L is a recursive language, then, is L’ also recursive?
(A) 1, 2, 3, 4
(B) 1, 2,
(C) 2, 3, 4
(D) 3, 4
9. Let P be a regular language and Q be context-free language such that Q ⊆ P. (For
example, let P be the language represented by the regular expression p*q* and Q be
{pnqn
|n ∈ N}). Then which of the following is ALWAYS regular?
(A) P ∩ Q
(B) P – Q
(C) ∑* – P
(D) ∑* – Q
10. (a+b)* is equivalent to
a) b*a*
b) (a*b*)*
c) a*b*
d) none of the mentioned
11. a? is equivalent to
a) a
b) a+Φ
c) a+ϵ
d) wrong expression
12. Regular expression Φ* is equivalent to
a) ϵ
b) Φ
c) 0
d) 1
13. A language is regular if and only if
a) accepted by DFA
b) accepted by PDA
c) accepted by LBA
d) accepted by Turing machine
14. Let the class of language accepted by finite state machine be L1 and the class of languages
represented by regular expressions be L2 then
a) L1<L2
b) L1>=L2
c) L1 U L2 = .*
d) L1=L2
15. Regular expression {0,1} is equivalent to
a) 0 U 1
b) 0 / 1
c) 0 + 1
d) All of the mentioned

1. Transition function of DFA maps.


a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q
Answer: d

2. Minimum Number of states require to accept string ends with 10.


a) 3
b) 2
c) 1
d) can’t be represented.

Answer: a
3. δ*(q,ya) is equivalent to .
a) δ((q,y),a)
b) δ(δ*(q,y),a)
c) δ(q,ya)
d) independent from δ notation
Answer: b
4. Languages of a automata is
a) If it is accepted by automata
b) If it halts
c) If automata touch final state in its life time
d) All language are language of automata
Answer: a
5. Finite automata requires minimum _______ number of stacks.
a) 1
b) 0
c) 2
d) None of the mentioned
Answer: b
6. FSM with output capability can be used to add two given integer in binary representation.
This is
a) True
b) False
c) May be true
d) None of the mentioned
Answer: a
7. If NFA of 6 states excluding the initial state is converted into DFA, maximum possible
number of states for the DFA is ?
a) 64
b) 32
c) 128
d) 127
Answer: c
8. NFA, in its name has ’non-deterministic’ because of :
a) The result is undetermined
b) The choice of path is non-deterministic
c) The state to be transited next is non-deterministic
d) All of the mentioned
Answer: b
9. The construction time for DFA from an equivalent NFA (m number of node)is:
a) O(m2)
b) O(2m)
c) O(m)
d) O(log m)
Answer: b
10. Which of the following option is correct?
a) NFA is slower to process and its representation uses more memory than DFA
b) DFA is faster to process and its representation uses less memory than NFA
c) NFA is slower to process and its representation uses less memory than DFA
d) DFA is slower to process and its representation uses less memory than NFA
Answer: c
11. Choose the correct option for the given statement:
Statement: The DFA shown represents all strings which has 1 at second last position.

a) Correct
b) Incorrect, Incomplete DFA
c) Wrong proposition
d) May be correct

Answer: c

12.

TOC mcq
Definition and description of FA:
1. NFA, in its name has ’non-deterministic’ because of :
a) The result is undetermined
b) The choice of path is non-deterministic
c) The state to be transited next is non-deterministic
d) All of the mentioned
Answer: b

2. Languages of a automata is
a) If a string is accepted by automata
b) If it halts
c) If automata touch final state in its life time
d) All language are language of automata
Answer: a

3. The basic limitation of finite automata is that


a) It can’t remember arbitrary large amount of information.
b) It sometimes recognize grammar that are not regular.
c) It sometimes fails to recognize regular grammar.
d) All of the mentioned
Answer:a

4. What the following DFA accepts?

a) x is a string such that it ends with ‘101’


b) x is a string such that it ends with ‘01’
c) x is a string such that it has odd 1’s and even 0’s
d) x is a strings such that it has starting and ending character as 1
Answer A)

5. What does the following figure most correctly represents?

a) Final state with loop x


b) Transitional state with loop x
c) Initial state as well as final state with loop x
d) Insufficient Data
Answer: c

6. Number of final state requires to accept Φ in minimal finite automata.


a) 1
b) 2
c) 3
d) None of the mentioned
Answer:d
Explanation: No final state requires.

7. Which of the following is an application of Finite Automaton?


a) Compiler Design
b) Grammar Parsers
c) Text Search
d) All of the mentioned
Answer: d

8. Which DFA is correct for the given Language: accepting string ending with '01' over input alphabets ∑={a.b}

a) b) c) d) None of these Ans c

9. How many Final states in the given language : {an | where n >=1 but n ≠ 2,6 } , Σ= {a}
a) 2 b) 4 c) 3 d) 6
Ans b)
10. Transition function maps.
a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q Ans d)

11. Finite automata has only


a) Finite memory
b) Read only head
c) Finite control
d) All of them Ans d)

The Equivalence of deterministic and non-deterministic finite automata


12. The relation between NFA-accepted languages and DFA accepted languages is
a) >
b) <
c) =
d) <= Ans c)
13. Which of the following is correct proposition?
Statement 1: Non determinism is a generalization of Determinism.
Statement 2: Every DFA is automatically an NFA
a) Statement 1 is correct because Statement 2 is correct
b) Statement 2 is correct because Statement 2 is correct
c) Statement 2 is false and Statement 1 is false
d) Statement 1 is false because Statement 2 is false Ans a)

14. Which NFA is correct for the transition table as given below:
Present State 0 1

→q0 q0, q1 q0, q2


q1 q3 ε
q2 q2, q3 q3
→q3 q3 q3

a) b)

c) d) None of these Ans a)

15. Given a NFA with N states, the maximum number of states in an equivalent minimized DFA is at least
a) N^2
b) 2^N
c) 2N
d) N! Ans b)

Q1 What is wrong in the given definition?

Def: ({q0, q1, q2}, {0,1}, δ, q3, {q3})

a) The definition does not satisfy 5 Tuple definition of NFA


b) There are no transition definition

c) Initial and Final states do not belong to the Graph

d) Initial and final states can’t be same

Answer: c

Q2) Number of states require to accept string ends with 10.


a) 3
b) 2
c) 1
d) can’t be represented.
Answer: a

Q3) δ(q,ya) is equivalent to .


a) δ((q,y),a)
b) δ(δ(q,y),a)
c) δ(q,ya)
d) independent from δ notation
answer: b

Q4 Finite automata requires minimum _______ number of stacks.


a) 1
b) 0
c) 2
d) None of the mentioned
answer: b

Q 5 An NFA’s transition function returns

a. A Boolean value

b. A state

c. A set of states

d. An edge

answer: c

Q6 Choose the correct option for the given statement:


Statement: The DFA shown represents all strings which has 1 at second last
position.

a) Correct
b) Incorrect, Incomplete DFA
c) Wrong proposition
d) May be correct
Answer: c ( bcz it is nfa)
Q7. Which of the following is a not a part of 5-tuple finite automata?

a) Input alphabet
b) Transition function

c) Initial State

d) Output Alphabet

Answer: d

Q8)Transition function maps.


a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q
Answer: d
Q9 The sum of minimum and maximum number of final states for a DFA having
‘n’ states is equal to:
a)n+1
b)n
c) n-2
d) n+2
answer : a
Q 10 The maximum number of transitions which can be performed over a state in a
DFA using Σ={a,b,c} ?
a)1
b)2
c)3
d) 4
answer : c
5. Given an arbitrary non-deterministic finite automaton (NFA) with N states, the maximum
number of states in an equivalent minimized DFA is at least. (GATE CS 2001)
(a) N^2
(b) 2^N
(c) 2N
(d) N!

Answer: (b)
References:
http://en.wikipedia.org/wiki/Powerset_construction

Consider L= {(ap)* | P is a prime number} over the alphabet {a}, then what is the minimum
number of states in NFA that accepts the language L?

(A) three
(B) five
(C) four
(D) six

Explanation:

L = {(ap)* | P is a prime number}


L = (a2)* U (a3)* U (a5)* U ......
L = {epsilon, a2, a3, a4, a5, ......}

That is, all strings of a’s except ‘a’


In the above NFA, only string ‘a’ is not accepted. Hence, number of states required is three.

So, option (A) is correct.

Let w be any string of length n in {a, b}*. Consider ‘L’ be the set of all strings ending with at
least n a’s. What is the minimum number of states in non deterministic finite automata that
accept ‘L’?

(A) (n+3)
(B) (n+1)
(C) n
(D) 2n

Explanation:
It is correct since, the minimum number of states required for NFA for ending with at least 2 a’s
is (2 + 1) i.e., regular expression will be (a + b)*aa

Hence, Number of states required for at least n a’s will be (n+1).

Option (B) is true.

What is the minimum number of states in deterministic finite automata (DFA) for string starting
with ba2 and ending with ‘a’ over alphabet {a, b}?

(A) Ten
(B) Nine
(C) Eight
(D) Six
n the above DFA, minimum number of states required is six.

Option (D) is correct.

Ques-5: What is the number of states in minimal NFA(non deterministic finite automata), which
accepts set of all strings in which the third last symbol is ‘a’ over alphabet {a, b}?

(A) three
(B) four
(C) six
(D) five
3)Definition of a language L with alphabet {a} is given as following. L= { a nk | k > 0, and n is
a positive integer constant} What is the minimum number of states needed in a DFA to
recognize L?
(A) k+1
(B) n+1
(C) 2n+1
(D) 2k+1

Answer (B)
A) k+1
(B) n+1
(C) 2n+1
(D) 2k+1

Answer (B)
Note that n is a constant and k is any positive integer. For example, if n is given as 3, then the
DFA must be able to accept 3a, 6a, 9a, 12a, .. To build such a DFA, we need 4 states.

4) Let w be any string of length n is {0,1}*. Let L be the set of all substrings of w. What is
the minimum number of states in a non-deterministic finite automaton that accepts L?
(A) n-1
(B) n
(C) n+1
(D) 2n-1

Answer (C)
We need minimum n+1 states to build NFA that accepts all substrings of a binary string. For
example, following NFA accepts all substrings of “010” and it has 4 states.
1) The lexical analysis for a modern language such as Java needs the power of which one of
the following machine models in a necessary and sufficient sense?
(A) Finite state automata
(B) Deterministic pushdown automata
(C) Non-deterministic pushdown automata
(D) Turing machine

Answer (A)
Lexical analysis is the first step in compilation. In lexical analysis, program is divided into
tokens. Lexical analyzers are typically based on finite state automata. Tokens can typically be
expressed as different regular expressions:
An identifier is given by [a-zA-Z][a-zA-Z0-9]*
The keyword if is given by if.
Integers are given by [+-]?[0-9]+.

3) A deterministic finite automation (DFA)D with alphabet ∑= {a,b} is given below


Which of the following finite state machines is a valid minimal DFA which accepts the same
language as D?
Answer (A)
Options (B) and (C) are invalid because they both accept ‘b’ as a string which is not accepted by
give DFA. D is invalid because it accepts bb+a which are not accepted by given DFA.

Following questions have been asked in GATE CS 2012 exam.

1) What is the complement of the language accepted by the NFA shown below? Assume ∑ =
{a} and ε is the empty string

(A) Φ
(B) ε
(C) a
(D) {a, ε}

Answer (B)
The given alphabet ∑ contains only one symbol {a} and the given NFA accepts all strings with
any number of occurrences of ‘a’. In other words, the NFA accepts a+. Therefore complement of
the language accepted by automata is empty string.
4) Consider the set of strings on {0,1} in which, every substring of 3 symbols has at most
two zeros. For examples, 001110 and 011001 are in the language, but 100010 is not. All
strings of length less than 3 are also in the language. A partially completed DFA that
accepts this language is shown below.

The missing arcs in the DFA are


Answer (D)
State ‘q’ is trap state. All other states are accept states. In state 00, DFA must move to ‘q’ for
input symbol 0. All (non-trap) states indicate names indicate the characters seen before reaching
that particular state. Option (D) is the only option that follows these rules.

Ques-1: Consider the following statements:

 X: For any language either a language L or its compliment L’ must be finite.


 Y: DFA for language which contains epsilon must have initial state as final state.
 Z: Non-deterministic finite automata is more powerful than deterministic finite automata.

https://www.sanfoundry.com/automata-theory-mcqs-finite-automata/
2. In DFA Transition function maps.
a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q
Answer:d

3. Number of states require to accept string ends with 10.


a) 3
b) 4
c) 5
d) can’t be represented.
Answer :a

8. Language of finite automata is.


a) Type 0
b) Type 1
c) Type 2
d) Type 3
View Answer

Answer:d
Explanation: According to Chomsky classification.

Finite automata requires minimum _______ number of stacks.


a) 1
b) 0
c) 2
d) None of the mentioned
View Answer

Answer:b
Explanation: Finite automata doesn’t require any stack operation

13. The basic limitation of finite automata is that


a) It can’t remember arbitrary large amount of information.
b) It sometimes recognize grammar that are not regular.
c) It sometimes fails to recognize regular grammar.
d) All of the mentioned

Answer:a
Explanation:Because there is no memory associated with automata.

15. FSM with output capability can be used to add two given integer in binary representation.
This is
a) True
b) False
c) May be true
d) None of the mentioned
View Answer

Answer:a
Explanation: Use them as a flip flop output

5. NFA, in its name has ’non-deterministic’ because of :


a) The result is undetermined
b) The choice of path is non-deterministic
c) The state to be transited next is non-deterministic
d) All of the mentioned
View Answer

Answer: b
Explanation: Non deterministic or deterministic depends upon the definite path defined for the
transition from one state to another or undefined(multiple paths).

1. Which of the following options is correct?


Statement 1: Initial State of NFA is Initial State of DFA.
Statement 2: The final state of DFA will be every combination of final state of NFA.
a) Statement 1 is true and Statement 2 is true
b) Statement 1 is true and Statement 2 is false
c) Statement 1 can be true and Statement 2 is true
d) Statement 1 is false and Statement 2 is also false
View Answer

Answer: a
Explanation: Statement 1 and 2 always true for a given Language.

6. Convert the NFA to DFA


c) All of the mentioned
d) None of the mentioned
View Answer

Answer: a
Explanation: Initially Q is empty. Then since the initial state of the DFA is {0} , {0} is added to
Q.
Since 2( 0 , a ) = { 1 , 2 } , { 1 , 2 } is added to Q and ( { 0 } , a ) = { 1 , 2 } .
Since 2( 0 , b ) = , is added to Q and ( { 0 } , b ) = .
At this point Q = { {0} , { 1 , 2 }, }. Similarly ( { 1 , 2 } , b ) = { 1 , 3 } . Hence { 1 , 3 } is added
to Q . Similarly ( { 1 , 3 } , a ) = { 1 , 2 } and ( { 1 , 3 } , b ) = . Thus there are no new states to
be added to Q . Since the transitions from all states of Q have been computed and no more states
are added to Q, the conversion process stops here.

1. Let S and T be language over ={a,b} represented by the regular expressions (a+b*)* and
(a+b)*, respectively. Which of the following is true? (GATE CS 2000)

(a) ScT (S is a subset of T)


(b) TcS (T is a subset of S)
(c) S=T
(d) SnT=Ø

Answer: (c).
2) Which one of the following languages over the alphabet {0,1} is described by the regular
expression: (0+1)*0(0+1)*0(0+1)*?
(A) The set of all strings containing the substring 00.
(B) The set of all strings containing at most two 0’s.
(C) The set of all strings containing at least two 0’s.
(D) The set of all strings that begin and end with either 0 or 1.

Answer (C)
The regular expression has two 0’s surrounded by (0+1)* which means accepted strings must
have at least 2 0’s.

3) Let L={w ∈ (0 + 1)*|w has even number of 1s}, i.e. L is the set of all bit strings with even
number of 1s. Which one of the regular expression below represents L?
(A) (0*10*)*
(B) 0*(10*10*)*
(C) 0*(10*1*)*0*
(D) 0*1(10*1*)*10*

Answer (B)
Option (A) is incorrect because it cannot accept “110”
Option (C) is incorrect because it accept a string with single 1.
Option (D) is incorrect because it cannot accept 11101

4Which of the following statement(s) is/are correct?

(A) only X
(B) only Y
(C) only Z
(D) all of the above.

Explanation:
X: It is incorrect. since, a language L and its compliment can be infinite.
Y: It is correct.since, if the language contains epsilon then its initial state must be final also,
otherwise the DFA wont be able to accept epsilon.
Z: It is incorrect. since, every language accepted by NFA is also accepted by some DFA. Hence,
NFA and DFA both are equivalent in power.

Option (B) is true.

5 Which one of the following regular expression describes the language over {a, b} which
consists of no pair of consecutive b’s?

(A) (a*baa*)(b + epsilon)


(B) (a + ba)*(b + epsilon)
(C) (a*baa*)*(b + epsilon) + a*
(D) (a*ba*)*(b + epsilon) + a*(b + epsilon)

Explanation:

 (A) It is incorrect. since, it does not contains (a or epsilon).


 (B) It is correct. since, it contains (epsilon, a, b, ba, ab, …..), i.e., no pair of consecutive
b’s.
 (C) It is incorrect. since, it does not contains ‘ab’ or ‘aab’.
 (D) It is incorrect. since, it contains ‘bb’, which is not allowed.

Option (B) is true.

6 What is the length of the shortest string not in the language over alphabet {0, 1} for regular
expression given below:

1*(0 + 1)*1*

(A) seven
(B) five
(C) six
(D) four

Explanation:
Check each string generated over the alphabet {0, 1} until you reach the shortest string which is
not generated by the given regular expression.
In this case, smallest string which is not generated by the given regular expression is 0110,
whose length is four.

so, option (D) is true.

7 Consider X and Y are two languages over alphabet {0, 1} represented by regular expression
0*(10*)* and (0* + 1*)* respectively. which of the following is true?

(A) X is proper subset of Y


(B) Y is proper subset of X
(C) X = Y
(D) none

Explanation:
Here,

L(X)
= 0*(10*)*
= {epsilon, 0, 1, 10, 01, 00, 11, ......}
And.

L(Y)
= (0* + 1*)*
= {epsilon, 0, 1, 10, 01, 00, 11, ....}

So, both languages are equivalent to each other.

Option (C) is true.

The Applications of these Automata are given as follows:

https://www.sanfoundry.com/compilers-questions-answers-nfa-epsilon-moves-1/

8. S –> aSa| bSb| a| b ;the language generated by the above grammar is the set of
a) All palindromes.
b) All odd length palindromes
c) Strings beginning and ending with the same symbol
d) All even length palindromes
View Answer

Answer: b
Explanation: The strings accepted by language are {a, b, aaa, bbb, aba, bab,}. All the strings are
odd length palindromes.

9 Which one of the following languages over the alphabet {0, 1} is described by the regular
expression: (0+1)*0(0+1)*0(0+1)*?
a) strings with the substring 00
b) strings with at most two 0’s
c) strings with at least two 0’s
d) strings beginning and ending with either 0 or 1
View Answer

Answer: c
Explanation: The RE having 2 0’s padded by (0+1)* which means accepted strings must have at
least 2 0’s.

10.Does epsilon ring makes any change in the automata


a) Yes
b) No
View Answer

Answer: b
Explanation: It adds nothing new to the automata.
11.Which of the technique can be used to prove that a language is non regular?
a) Ardens theorem
b) Pumping Lemma
c) Ogden’s Lemma
d) None of the mentioned
View Answer

Answer: b
Explanation: We use the powerful technique called Pumping Lemma, for showing certain
languages not to be regular. We use Ardens theorem to find out a regular expression out of a
finite automaton.

12 Which of the following language regular?


a) {aibi|i>=0}
b) {aibi|0<i<5}
c) {aibi|i>=1}
d) None of the mentioned
View Answer

Answer: b
Explanation: Here, i has limits i.e. the language is finite, contains few elements and can be
graphed using a deterministic finite automata. Thus, it is regular. Others can be proved non
regular using Pumping lemma.

13. Which of the following are non regular?


a) The set of strings in {a,b}* with an even number of b’s
b) The set of strings in {a, b, c}* where there is no c anywhere to the left of a
c) The set of strings in {0, 1}* that encode, in binary, an integer w that is a multiple of 3.
Interpret the empty strings e as the number 0.
d) None of the mentioned
View Answer

Answer: d
Explanation: All of the given languages are regular and finite and thus, can be represented using
respective deterministic finite automata. We can also use mealy or moore machine to represent
remainders for option c.

14. If L is DFA-regular, L’ is
a) Non regular
b) DFA-regular
c) Non-finite
d) None of the mentioned
View Answer
Answer: b
Explanation: This is a simple example of a closure property: a property saying that the set of
DFA-regular languages is closed under certain operations.

If L is DFA-regular, L’ is
a) Non regular
b) DFA-regular
c) Non-finite
d) None of the mentioned
View Answer

Answer: b
Explanation: This is a simple example of a closure property: a property saying that the set of
DFA-regular languages is closed under certain operations.

15. Which of the following options is incorrect?


a) A language L is regular if and only if ~L has finite number of equivalent classes.
b) Let L be a regular language. If ~L has k equivalent classes, then any DFA that recognizes L
must have atmost k states.
c) A language L is NFA-regular if and only if it is DFA-regular.
d) None of the mentioned
View Answer

Answer: b
Explanation: Let L be a regular language. If ~L has k equivalent classes, then any DFA that
recognizes L must have atleast k states.

16 Myhill Nerode does the following:


a) Minimization of DFA
b) Tells us exactly when a language is regular
c) Both (a) and (b)
d) None of the mentioned
View Answer

Answer: c
Explanation: In automata theory, the Myphill Nerode theorem provides a necessary and
sufficient condition for a language to be regular. The Myphill Nerode theorem can be used to
show a language L is regular by proving that the number of equivalence classes of RL(relation) is
finite.

17. NDFAs where introduced by ____________


a) Michael O Rabin & Dana Scott
b) Dan Brown
c) Sun micro system Labs
d) SAP Labs
View Answer

Answer: a
Explanation: NFAs were introduced Dana Scott and Michael O. Rabin who also showed their
equivalence to DFAs.

18 The regular languages are not closed under


a) Concatenation
b) Union
c) Kleene star
d) Complement
View Answer

Answer: d
Explanation: RE are closed under
• Union (cf. picture)
• Intersection
• Concatenation
• Negation
• Keene closure.

19. An NFA’s transition function returns


a) A Boolean value
b) A state
c) A set of states
d) An edge
View Answer

Answer: c
Explanation: A transition function Δ: Q × Σ → P (Q).Where P (Q) denotes the power set of Q…

20. How many strings of length less than 4 contains the language described by the regular
expression (x+y)*y(a+ab)*?
a) 7
b) 10
c) 12
d) 11
View Answer

Answer : d
Explanation : string of length 0 = 1
string of length 1 = 4
string of length 2 = 3
string of length 3 = 3
21. Which of the following is true?
a) (01)*0 = 0(10)*
b) (0+1)*0(0+1)*1(0+1) = (0+1)*01(0+1)*
c) (0+1)*01(0+1)*+1*0* = (0+1)*
d) All of the mentioned
View Answer

Answer : d
Explaination : None.

22.A language is regular if and only if


a) accepted by DFA
b) accepted by PDA
c) accepted by LBA
d) accepted by Turing machine
View Answer

Answer : a
Explanation : All of above machine can accept regular language but all string accepted by
machine is regular only for DFA.

23. Let the class of language accepted by finite state machine be L1 and the class of languages
represented by regular expressions be L2 then
a) L1<L2
b) L1>=L2
c) L1 U L2 = .*
d) L1=L2
View Answer

Answer : d
Explanation : Finite state machine and regular expression have same power to express a
language.

24. Which of the following is not a regular expression?


a) [(a+b)*-(aa+bb)]*
b) [(0+1)-(0b+a1)*(a+b)]*
c) (01+11+10)*
d) (1+2+0)*(1+2)*
View Answer

Answer : b
Explanation : Except b all are regular expression*

25. Regular expression are


a) Type 0 language
b) Type 1 language
c) Type 2 language
d) Type 3 language
View Answer

Answer : a
Explanation : According to Chomsky hierarchy .

26.Which of the following is true?


a) Every subset of a regular set is regular
b) Every finite subset of non-regular set is regular
c) The union of two non regular set is not regular
d) Infinite union of finite set is regular
View Answer

Answer : b
Explanation : None.

27. Regular expressions are closed under


a) Union
b) Intersection
c) Kleen star
d) All of the mentioned
View Answer

Answer : d
Explanation : According to definition of regular expression.

7. Myphill Nerode does the following:


a) Minimization of DFA
b) Tells us exactly when a language is regular
c) Both (a) and (b)
d) None of the mentioned
View Answer

Answer: c
Explanation: In automata theory, the Myphill Nerode theorem provides a necessary and
sufficient condition for a language to be regular. The Myphill Nerode theorem can be used to
show a language L is regular by proving that the number of equivalence classes of RL(relation) is
finite.

28. Which of the following strings do not belong the given regular expression?
(a)*(a+cba)
a) aa
b) aaa
c) acba
d) acbacba
View Answer

Answer: d
Explanation: The string acbacba is unacceptable by the regular expression (a)*(a+cba).

2. Let L denotes the language generated by the grammar S – OSO/00. Which of the following is
true? (GATE CS 2000)
(a) L = O
(b) L is regular but not O
(c) L is context free but not regular
(d) L is not context free

Answer: (b)
Explanation: Please note that grammar itself is not regular but language L is regular as L can be
represented using a regular grammar, for example S -> S00/00.
References:
http://en.wikipedia.org/wiki/Regular_grammar

3. Consider the following two statements:


S1: { 0^2n |n >= l} is a regu1ar language
S2: { 0^m 0^n 0^(m+n) l m >= 1 and n >= 2} is a regu1ar language
Which of the following statements is correct? (GATE CS 2001)
a) Only S1 is correct
b) Only S2 is correct
c) Both S1 and S2 are correct
d) None of S1 and S2 is correct

Answer: (c)
Explanation:
S1 can be written as (00)^n where n >= 1. And S2 can be written as (00)^(m+n) where m >=2
and n >= 1. S2 can be further reduced to (00)^x where x >= 3.
We can easily write regular grammars for both S1 and S2.
G1 -> G100/00 (For S1)
G2 -> G200/000000 (For S2)

Ques-1: Which one of the following language is Regular?


(A) {wxwR | w,x ∈ (a+b)+}
(B) {wxwR | w ∈ (a+b)*, x ∈ {a,b}}
(C) {wwRx | w,x ∈ (a+b)+}
(D) {wwR | w ∈ (a+b)*}

Explanation:

 (A) It is correct, since this language can form regular expression which is {{ a(a + b)+a }
+ {b(a + b)+b}}, i.e., start and end with same symbol.
 (B) It is deterministic context free language since, string before and and after ‘x’ are same
so, it is matched.
 (C) It cannot be regular since, wwR is done at first which requires comparison which
cannot be done via finite automata.
 (D) It is also not regular since, comparison is required.

Option (A) is true.

Ques-4: Consider the following statements:

S1 = {(an)m | n = 0}
S2 = {anbn | n>=1} U {anbm | n>=1, m>=1}

Which one of the following is regular?

(A) only S1
(B) only S2
(C) both S1 and S2
(D) none

Explanation:
Both given languages are regular. Option (C) is correct.

1) S –> aSa| bSb| a| b ;The language generated by the above grammar over the alphabet {a,b} is
the set of
(A) All palindromes.
(B) All odd length palindromes.
(C) Strings that begin and end with the same symbol
(D) All even length palindromes.

Answer (B)
The strings accepted by language are {a, b, aaa, bbb, aba, bab, ..}. All of these strings are odd
length palindromes.

1) Let P be a regular language and Q be context-free language such that Q ⊆ P. (For example, let
P be the language represented by the regular expression p*q* and Q be {pnqn|n ∈ N}). Then
which of the following is ALWAYS regular?
(A) P ∩ Q
(B) P – Q
(C) ∑* – P
(D) ∑* – Q

Answer (C)
The expression ∑* – P represents complement of P which is a regular language. Complement of
Regular languages is also regular. Then a DFA that accepts the complement of L, i.e. ∑* – L,
can be obtained by swapping its accepting states with its non-accepting states.

2) Given the language L = {ab, aa, baa}, whih of the following strings are in L*?
….1) abaabaaabaa
….2) aaaabaaaa
….3) baaaaabaaaab
….4) baaaaabaa
(A) 1, 2 and 3
(B) 2, 3 and 4
(C) 1, 2 and 4
(D) 1, 3 and 4

Answer (C)
Any combination of strings in set {ab, aa, baa} will be in L*.
….1) “abaabaaabaa” can be partitioned as a combination of strings in set {ab, aa, baa}. The
partitions are “ab aa baa ab aa”
….2) “aaaabaaaa” can be partitioned as a combination of strings in set {ab, aa, baa}. The
partitions are “aa ab aa aa”
….3) “baaaaabaaaab” cannot be partitioned as a combination of strings in set {ab, aa, baa}
….4) “baaaaabaa” can be partitioned as a combination of strings in set {ab, aa, baa}. The
partitions are “baa aa ab aa”

3. Which of the following relates to Chomsky hierarchy?


a) Regular<CFL<CSL<Unrestricted
b) CFL<CSL<Unrestricted<Regular
c) CSL<Unrestricted<CF<Regular
d) None of the mentioned
View Answer

Answer: a
Explanation: The chomsky hierarchy lays down the following order:
Regular<CFL<CSL<Unrestricted

8. Which of the following strings is not generated by the given grammar:


S->SaSbS|e
a) aabb
b) abab
c) abaabb
d) None of the mentioned
View Answer

Answer: d
Explanation: All the given options are generated by the given grammar. Using the methods of
left and right derivations, it is simpler to look for string which a grammar can generate.
If L and L' are recursively enumerable, then L is
A Regular
B context-free
context-sensitive

. The class of recursively enumerable language is known as:


a) Turing Class
b) Recursive Languages
c) Universal Languages
d) RE
View Answer

Answer: d
Explanation: RE or recursively ennumerable is only called the class of recursively ennumerable
language.

. Which of the following statements are false?


a) Every recursive language is recursively ennumerable
b) Recursively ennumerable language may not be recursive
c) Recursive languages may not be recursively ennumerable
d) None of the mentioned
View Answer

Answer: c
Explanation: Every recursive language is recursively ennumerable but there exists recursively
ennumerable languages that are not recursive. If L is accepted by a Non deterministic TM T, and
every possible sequence of moves of T causes it to halt, then L is recursive.

4. Choose the correct option:


Statement: If L1 and L2 are recursively enumerable languages over S, then the following is/are
recursively enumerable.
a) L1 U L2
b) L2 ∩ L2
c) Both (a) and (b)
d) None of the mentioned
View Answer
Answer: c
Explanation: Both the union and intersection operations preserve the property of recursive
ennumerablity(Theorem).

5. If L is a recursive language, L’ is:


a) Recursive
b) Recursively Ennumerable
c) Both (a) and (b)
d) None of the mentioned
View Answer

Answer: c
Explanation: If T is a turing machine recognizing L, we can make it recognize L’ by
interchanging the two outputs. And every recursive language is recursively ennumerable.

6. Choose the appropriate option:


Statement: If a language L is recursive, it is closed under the following operations:
a) Union
b) Intersection
c) Complement
d) All of the mentioned
View Answer

Answer: d
Explanation: The closure property of recursive languages include union, intersection and
complement operations.

. A recursively ennumerable language L can be recursive if:


a) L’ is recursively ennumerable
b) Every possible sequence of moves of T, the TM which accept L, causes it to halt
c) Both (a) and (b)
d) None of the mentioned
View Answer

Answer: c
Explanation: Theorem- If L is a recursively ennumerable language whose complement is
recursively ennumerable, then L is recursive.

3. A language is regular if and only if


a) accepted by DFA
b) accepted by PDA
c) accepted by LBA
d) accepted by Turing machine
View Answer

Answer : a
Explanation : All of above machine can accept regular language but all string accepted by
machine is regular only for DFA.

4. Regular grammar is
a) context free grammar
b) non context free grammar
c) english grammar
d) none of the mentioned
View Answer

Answer : a
Explanation : Regular grammar is subset of context free grammar.

5. Let the class of language accepted by finite state machine be L1 and the class of languages
represented by regular expressions be L2 then
a) L1<L2
b) L1>=L2
c) L1 U L2 = .*
d) L1=L2
View Answer

Answer : d
Explanation : Finite state machine and regular expression have same power to express a
language.

7. Regular expression are


a) Type 0 language
b) Type 1 language
c) Type 2 language
d) Type 3 language
View Answer

Answer : a
Explanation : According to Chomsky hierarchy

S → SS S → λ S → aSb S → bSa which type of grammar is it?


a) Linear
b) Nonlinear
c) Both of the mentioned
d) None of the mentioned
View Answer
Answer: a
Explanation: Grammar is non-linear because one of the rules (the first one) has two non-
terminals on the right-hand side.

5. S → abS S → a is which grammar


a) Right Linear Grammar
b) Left Linear Grammar
c) Right & Left Linear Grammar
d) None of the mentioned
View Answer

Answer: a
Explanation: grammars in which all of the rules contain only one non-terminal on the left-hand
side, and where in every case that non-terminal is the first symbol are called right Linear.

6. What are the two types of Linear Grammar?


a) Right Linear
b) Left Linear
c) None of the mentioned
d) Right & Left Linear
View Answer

Answer: d
Explanation: Linear grammar is of 2 types Left and Right Linear Grammar

8. Which Type of Grammar is it?


S → Aa A → Aab | λ
a) Right Linear
b) Left Linear
c) None of the mentioned
d) Right & Left Linear
View Answer

Answer: b
Explanation: In this case they both correspond to the regular expression (ab)*a

• Accepts a string a followed by


b{a,b}
• Accepts a string containing even
number of a’s and any number of
b’s {a,b}
• Accepts a string containing 2
consectutive a’s followed by 2
consectutive b’s {a,b}
• Accepts a string that doesnot
contain 3 consecutive a’s {a,b}

• Accepts a string that contains


even number of 0’s and even
number of 1’s
• Ends with one b and even number
of a’s
• Accepts string aab
• Accepts string that ends b not aa
• Accepts a string that must not end
withaa
1. Transition function of DFA maps.
a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q
Answer: d

2. Minimum Number of states require to accept string ends with 10.


a) 3
b) 2
c) 1
d) can’t be represented.

Answer: a
3. δ*(q,ya) is equivalent to .
a) δ((q,y),a)
b) δ(δ*(q,y),a)
c) δ(q,ya)
d) independent from δ notation
Answer: b
4. Languages of a automata is
a) If it is accepted by automata
b) If it halts
c) If automata touch final state in its life time
d) All language are language of automata
Answer: a
5. Finite automata requires minimum _______ number of stacks.
a) 1
b) 0
c) 2
d) None of the mentioned
Answer: b
6. FSM with output capability can be used to add two given integer in binary representation.
This is
a) True
b) False
c) May be true
d) None of the mentioned
Answer: a
7. If NFA of 6 states excluding the initial state is converted into DFA, maximum possible
number of states for the DFA is ?
a) 64
b) 32
c) 128
d) 127
Answer: c
8. NFA, in its name has ’non-deterministic’ because of :
a) The result is undetermined
b) The choice of path is non-deterministic
c) The state to be transited next is non-deterministic
d) All of the mentioned
Answer: b
9. The construction time for DFA from an equivalent NFA (m number of node)is:
a) O(m2)
b) O(2m)
c) O(m)
d) O(log m)
Answer: b
10. Which of the following option is correct?
a) NFA is slower to process and its representation uses more memory than DFA
b) DFA is faster to process and its representation uses less memory than NFA
c) NFA is slower to process and its representation uses less memory than DFA
d) DFA is slower to process and its representation uses less memory than NFA
Answer: c
11. Choose the correct option for the given statement:
Statement: The DFA shown represents all strings which has 1 at second last position.

a) Correct
b) Incorrect, Incomplete DFA
c) Wrong proposition
d) May be correct

Answer: c

12.
TOC mcq
Definition and description of FA:
1. NFA, in its name has ’non-deterministic’ because of :
a) The result is undetermined
b) The choice of path is non-deterministic
c) The state to be transited next is non-deterministic
d) All of the mentioned
Answer: b

2. Languages of a automata is
a) If a string is accepted by automata
b) If it halts
c) If automata touch final state in its life time
d) All language are language of automata
Answer: a

3. The basic limitation of finite automata is that


a) It can’t remember arbitrary large amount of information.
b) It sometimes recognize grammar that are not regular.
c) It sometimes fails to recognize regular grammar.
d) All of the mentioned
Answer:a

4. What the following DFA accepts?

a) x is a string such that it ends with ‘101’


b) x is a string such that it ends with ‘01’
c) x is a string such that it has odd 1’s and even 0’s
d) x is a strings such that it has starting and ending character as 1
Answer A)
5. What does the following figure most correctly represents?

a) Final state with loop x


b) Transitional state with loop x
c) Initial state as well as final state with loop x
d) Insufficient Data
Answer: c

6. Number of final state requires to accept Φ in minimal finite automata.


a) 1
b) 2
c) 3
d) None of the mentioned
Answer:d
Explanation: No final state requires.

7. Which of the following is an application of Finite Automaton?


a) Compiler Design
b) Grammar Parsers
c) Text Search
d) All of the mentioned
Answer: d

8. Which DFA is correct for the given Language: accepting string ending with '01' over input alphabets
∑={a.b}

a) b) c) d) None of these
Ans c

9. How many Final states in the given language : {an | where n >=1 but n ≠ 2,6 } , Σ= {a}
a) 2 b) 4 c) 3 d) 6
Ans b)
10. Transition function maps.
a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q Ans d)
11. Finite automata has only
a) Finite memory
b) Read only head
c) Finite control
d) All of them Ans d)

The Equivalence of deterministic and non-deterministic finite automata


12. The relation between NFA-accepted languages and DFA accepted languages is
a) >
b) <
c) =
d) <= Ans c)

13. Which of the following is correct proposition?


Statement 1: Non determinism is a generalization of Determinism.
Statement 2: Every DFA is automatically an NFA
a) Statement 1 is correct because Statement 2 is correct
b) Statement 2 is correct because Statement 2 is correct
c) Statement 2 is false and Statement 1 is false
d) Statement 1 is false because Statement 2 is false Ans a)

14. Which NFA is correct for the transition table as given below:
Present State 0 1

→q0 q0, q1 q0, q2


q1 q3 ε
q2 q2, q3 q3
→q3 q3 q3

a) b)

c) d) None of these Ans a)

15. Given a NFA with N states, the maximum number of states in an equivalent minimized DFA is at least
a) N^2
b) 2^N
c) 2N
d) N! Ans b)
Transition Function – mcq’s

Q1 What is wrong in the given definition?

Def: ({q0, q1, q2}, {0,1}, δ, q3, {q3})

a) The definition does not satisfy 5 Tuple definition of NFA

b) There are no transition definition

c) Initial and Final states do not belong to the Graph

d) Initial and final states can’t be same

Answer: c

Q2) Number of states require to accept string ends with 10.


a) 3
b) 2
c) 1
d) can’t be represented.
Answer: a

Q3) δ(q,ya) is equivalent to .


a) δ((q,y),a)
b) δ(δ(q,y),a)
c) δ(q,ya)
d) independent from δ notation
answer: b
Q4 Finite automata requires minimum _______ number of stacks.
a) 1
b) 0
c) 2
d) None of the mentioned
answer: b

Q 5 An NFA’s transition function returns

a. A Boolean value

b. A state

c. A set of states

d. An edge

answer: c

Q6 Choose the correct option for the given statement:


Statement: The DFA shown represents all strings which has 1 at second last
position.

a) Correct
b) Incorrect, Incomplete DFA
c) Wrong proposition
d) May be correct
Answer: c ( bcz it is nfa)
Q7. Which of the following is a not a part of 5-tuple finite automata?

a) Input alphabet

b) Transition function

c) Initial State

d) Output Alphabet

Answer: d

Q8)Transition function maps.


a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Σ * Σ -> Q
d) Q * Σ -> Q
Answer: d
Q9 The sum of minimum and maximum number of final states for a DFA
having ‘n’ states is equal to:
a)n+1
b)n
c) n-2
d) n+2
answer : a
Q 10 The maximum number of transitions which can be performed over a state
in a DFA using Σ={a,b,c} ?
a)1
b)2
c)3
d) 4
answer : c

You might also like