Merged Mcqs
Merged Mcqs
a) 1024
b) 256
c) 625
d) 2048
Answer : a , 45 = 1024
a) 3125
b) 15625
c) 625
d) 2048
Answer : b, 56=15625
a)
b)
c)
answr: A
Q4 How many number of states are there in a minimal DFA that accepts the strings with even number
of a’s and even number of b’s with inputs=a,b ?
a) 3
b) 4
c) 5
d) 2
Answer: b
Q5 How many final states are there in a minimal DFA that accepts the strings with even number of a’s
and any number of b’s with ∑={a,b} ?
a) 3
b) 4
c) 1
d) 2
Answer : c
Q6 How many number of Tuples are there in an “unrealistic finite automata without output ?
a) 4
b) 5
c) 6
d) Cant determined
Answer : b
a) Finding 0-Equivalence
b) Finding 1-Equivalence
c) Delete all the states that are unreachable from initial state
d) Convert it into NFA
Answer : c
Q 10 If user enters input “ aabab “ using ∑= {a,b} in a moore machine, the length of output will be ?
a) 4
b) 5
c) 6
d) Cant determined
Answer : c
Q 11 If user enters input of length ‘n’ using ∑= {a,b,c} in a mealy machine, the length of output will be ?
a) n
b) n+1
c) n+2
d) Cant determined
Answer : a
Q 12
How many number of states are there in a minimal DFA that accepts the strings that ends with ‘ab’
using ∑={a,b} ?
a) 2
b) 3
c) 4
d) 5
Answer : b
Q 13
How many number of states are there in a minimal DFA that accepts the language,
a) 4
b) 3
c) 2
d) 5 Answer : a
a) 4
b) 5
c) 6
d) unlimited
Answer : b
a) Σ * Q -> Σ
b) Q * Q -> Σ
c) Q * Σ -> Q
d) none of these
a) 3
b) 2
c) 1
d) can’t be represented.
Answer : a
a) 1
b) 0
c) 2
Q 18 The minimum number of transition which can be performed over a state in a DFA using ∑= {a, b, c}.
a) 1
b) 2
c) 3
d) 4
Answer : c
Q 19 The sum of minimum and maximum number of final states for a DFA having ‘n+1’ states is equal
to:
a) n+1
b) n
c) n-1
d) n+2
Answer : d
Q 20 The maximum sum of in degree and out degree over a state in a DFA can be determined as:
∑= {a, b, c, d}
a) 4+4
b) 4+16
c) 4+0
d) cant determined
Answer : d
Q 21 .
a) abbabb
b) abbabba
c) aabba
d) aaba
answer : a
Q 22
Which DFA is accept the string in which every a is followed by b where Σ = {a,b} .
a)
b)
c)
d) None of these
a) Same
b) Increased
c) Decreased
d) Depends upon the language
Answer : b
a) q2
b) q3
c) q1
d) q4
Answer : c
a) an
b) anbn
c) anbncn
1)c
2) a ,b
3) a,b,c
4) a
Answer : 4
Q 26
Answer: c
Q 27
δ(q,ya) is equivalent to .
a) δ((q,y),a)
b) δ(δ(q,y),a)
c) δ(q,ya)
d) independent from δ notation
answer: b
a. A Boolean value
b. A state
c. A set of states
d. An edge
answer: c
Q 29
a) Correct
b) Incorrect, Incomplete DFA
c) Wrong proposition
d) May be correct
Answer: d
Q 31 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
Q32
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
Answer : a
Q 35
Answer : c
q1 q3 Ε
q2 q2, q3 q3
→q3 q3 q3
a) b)
c) d) None of these
Answer : a
Q 37
Answer : a
Answer : a
Q 39 Find output string for the input string 0111 from the following Moore Machine
a) 00010
b) 10110
c) 11111
d) 10101
Answer : a
Q 40
Find output string for the input string 1111 from the following Moore Machine
a) 01000
b) 00110
c) 11111
d) 10101
Answer : a
Q 41 . The major difference between Mealy and Moore machine is about:
a) Output Variations
b) Input Variations
c) Both
d) None of the mentioned
Answer : a
Q 42
a) 9’s Complement
b) 2’s Complement
c) 1’s Complement
d) 10’s Complement
Answer : c
Q 43 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]
Answer : d
Ans:- C
a) D
b) A
c) B
d) C
Answer : c
Q 46
a) Same
b) Increased
c) Decreased
d) Depends upon the language
Answer : a
48 . Find the correct answer after, converting the following Mealy to Moore machine
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)
48
How many states are require to construct a minimal dfa from the given DFA
answer b
8/27/2019 Finite Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “Finite
Automata-Introduction”.
1. Assume the R is a relation on a set A, aRb is partially ordered such that a and b are _____________
a) reflexive
b) transitive
c) symmetric
d) reflexive and transitive
View Answer
Answer: d
Explanation: A partially ordered relation refers to one which is Reflexive, Transitive and Antisymmetric.
advertisement
2. The non- Kleene Star operation accepts the following string of finite length over set A = {0,1} | where
string s contains even number of 0 and 1
a) 01,0011,010101
b) 0011,11001100
c) ε,0011,11001100
d) ε,0011,11001100
View Answer
Answer: b
Explanation: The Kleene star of A, denoted by A*, is the set of all strings obtained by concatenating
zero or more strings from A.
3. A regular language over an alphabet ∑ is one that cannot be obtained from the basic languages
using the operation
a) Union
b) Concatenation
c) Kleene*
d) All of the mentioned
View Answer
Answer: d
Explanation: Union, Intersection, Concatenation, Kleene*, Reverse are all the closure properties of
Regular Language.
4. Statement 1: A Finite automata can be represented graphically; Statement 2: The nodes can be its
states; Statement 3: The edges or arcs can be used for transitions
Hint: Nodes and Edges are for trees and forests too.
https://www.sanfoundry.com/automata-theory-questions-answers-finite-automata-introduction/ 1/3
8/27/2019 Finite Automata Theory Questions and Answers - Sanfoundry
5. The minimum number of states required to recognize an octal number divisible by 3 are/is
a) 1
b) 3
c) 5
d) 7
View Answer
Answer: b
Explanation: According to the question, minimum of 3 states are required to recognize an octal number
divisible by 3.
advertisement
7. If an Infinite language is passed to Machine M, the subsidiary which gives a finite solution to the
infinite input tape is ______________
a) Compiler
b) Interpreter
c) Loader and Linkers
d) None of the mentioned
View Answer
Answer: a
Explanation: A Compiler is used to give a finite solution to an infinite phenomenon. Example of an
infinite phenomenon is Language C, etc.
https://www.sanfoundry.com/automata-theory-questions-answers-finite-automata-introduction/ 2/3
8/27/2019 Finite Automata Theory Questions and Answers - Sanfoundry
8. The number of elements in the set for the Language L={xϵ(∑r) *|length if x is at most 2} and ∑={0,1}
is_________
a) 7
b) 6
c) 8
d) 5
View Answer
Answer: a
Explanation: ∑r= {1,0} and a Kleene* operation would lead to the following
set=COUNT{ε,0,1,00,11,01,10} =7.
9. For the following change of state in FA, which of the following codes is an incorrect option?
a) δ (m, 1) =n
b) δ (0, n) =m
c) δ (m,0) =ε
d) s: accept = false; cin >> char;
if char = “0” goto n;
View Answer
Answer: b
Explanation: δ(QX∑) = Q1 is the correct representation of change of state. Here, δ is called the
Transition function.
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-finite-automata-introduction/ 3/3
8/27/2019 Moore Machine - Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “Moore
Machine”.
advertisement
3. For a give Moore Machine, Given Input=’101010’, thus the output would be of length:
a) |Input|+1
b) |Input|
c) |Input-1|
d) Cannot be predicted
View Answer
Answer: a
Explanation: Initial state, from which the operations begin is also initialized with a value.
https://www.sanfoundry.com/automata-theory-questions-answers-moore-machine/ 1/4
8/27/2019 Moore Machine - Automata Theory Questions and Answers - Sanfoundry
5. The total number of states and transitions required to form a moore machine that will produce
residue mod 3.
a) 3 and 6
b) 3 and 5
c) 2 and 4
d) 2 and 5
View Answer
Answer: a
Explanation:
advertisement
Present State
Next State
Output
0
1
https://www.sanfoundry.com/automata-theory-questions-answers-moore-machine/ 2/4
8/27/2019 Moore Machine - Automata Theory Questions and Answers - Sanfoundry
Q0
Q1
Q2
1
Q1
Q2
1
Q2
Q0
a) Q0, Q2, 0
b) Q0, Q2, 1
c) Q1, Q2, 1
d) Q1, Q0, 0
View Answer
Answer: a
Explanation: The table can be filled accordingly seeing the graph.
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-moore-machine/ 3/4
8/27/2019 Moore Machine - Automata Theory Questions and Answers - Sanfoundry
https://www.sanfoundry.com/automata-theory-questions-answers-moore-machine/ 4/4
8/27/2019 Mealy Machine - Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “Mealy
Machine”.
advertisement
a) 9’s Complement
b) 2’s Complement
c) 1’s Complement
d) 10’s Complement
View Answer
https://www.sanfoundry.com/automata-theory-questions-answers-mealy-machine/ 1/3
8/27/2019 Mealy Machine - Automata Theory Questions and Answers - Sanfoundry
Answer: b
Explanation: The input can be taken in form of a binary string and can be verified.
advertisement
5.The ratio of number of input to the number of output in a mealy machine can be given as:
a) 1
b) n: n+1
c) n+1: n
d) None of the mentioned
View Answer
Answer: a
Explanation: The number of output here follows the transitions in place of states as in Moore machine.
https://www.sanfoundry.com/automata-theory-questions-answers-mealy-machine/ 2/3
8/27/2019 Mealy Machine - Automata Theory Questions and Answers - Sanfoundry
advertisement
a) 9’s Complement
b) 2’s Complement
c) 1’s Complement
d) 10’s Complement
View Answer
Answer: c
Explanation: Inputs can be taken and can be verified.
https://www.sanfoundry.com/automata-theory-questions-answers-mealy-machine/ 3/3
8/27/2019 Mealy Machine Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “Mealy
Machine-II”.
1. Which of the following does not belong to input alphabet if S={a, b}* for any language?
a) a
b) b
c) e
d) none of the mentioned
View Answer
Answer: c
Explanation: The automaton may be allowed to change its state without reading the input symbol using
epsilon but this does not mean that epsilon has become an input symbol. On the contrary, one
assumes that the symbol epsilon does not belong to any alphabet.
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-mealy-machine-1/ 1/5
8/27/2019 Mealy Machine Questions and Answers - Sanfoundry
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-mealy-machine-1/ 2/5
8/27/2019 Mealy Machine Questions and Answers - Sanfoundry
a) 0
b) 1
c) 2
d) 3
View Answer
Answer: c
Explanation: The epsilon closure set of f2 consist of the elements:{f2, f3}. Thus the count of the
element in the closure set is 2.
https://www.sanfoundry.com/automata-theory-questions-answers-mealy-machine-1/ 3/5
8/27/2019 Mealy Machine Questions and Answers - Sanfoundry
advertisement
8. Which of the steps are non useful while eliminating the e-transitions for the given diagram?
9. Is the language preserved in all the steps while eliminating epsilon transitions from a NFA?
a) yes
b) no
View Answer
Answer: a
Explanation: Yes, the language is preserved during the dteps of construction: L(N)=L(N1)=L(N2)=L(3).
10. Remove all the epsilon transitions in the given diagram and compute the number of a-transitions in
the result?
https://www.sanfoundry.com/automata-theory-questions-answers-mealy-machine-1/ 4/5
8/27/2019 Mealy Machine Questions and Answers - Sanfoundry
a) 5
b) 7
c) 9
d) 6
View Answer
Answer: b
Explanation:
https://www.sanfoundry.com/automata-theory-questions-answers-mealy-machine-1/ 5/5
8/27/2019 Automata Theory Interview Questions and Answers - Sanfoundry
This set of Automata Theory Interview Questions and Answers focuses on “Deterministic Finite
Automata-Introduction and Definition”.
advertisement
https://www.sanfoundry.com/automata-theory-interview-questions-answers/ 1/5
8/27/2019 Automata Theory Interview Questions and Answers - Sanfoundry
advertisement
https://www.sanfoundry.com/automata-theory-interview-questions-answers/ 2/5
8/27/2019 Automata Theory Interview Questions and Answers - Sanfoundry
a) ababaabaa
b) abbbaa
c) abbbaabb
d) abbaabbaa
View Answer
Answer: a
Explanation: All the Strings are getting accepted except ‘ababaabaa’ as it is directed to dumping state.
Dumping state also refers to the reject state of the automata.
advertisement
https://www.sanfoundry.com/automata-theory-interview-questions-answers/ 3/5
8/27/2019 Automata Theory Interview Questions and Answers - Sanfoundry
a) ε
b) 11010
c) 10001010
d) String of letter count 11
View Answer
Answer: a
Explanation: As the initial state is not made an acceptance state, thus ε will not be accepted by the
given DFA. For the automata to accept ε as an entity, one should make the initial state as also the final
state.
https://www.sanfoundry.com/automata-theory-interview-questions-answers/ 4/5
8/27/2019 Automata Theory Interview Questions and Answers - Sanfoundry
Answer: b
Explanation: Language to accept a palindrome number or string will be non-regular and thus, its DFA
cannot be obtained. Though, PDA is possible.
10. Which of the following is not an example of finite state machine system?
a) Control Mechanism of an elevator
b) Combinational Locks
c) Traffic Lights
d) Digital Watches
View Answer
Answer: d
Explanation: Proper and sequential combination of events leads the machines to work in hand which
includes The elevator, Combinational Locks, Traffic Lights, vending machine, etc. Other applications of
Finite machine state system are Communication Protocol Design, Artificial Intelligence Research, A
Turnstile, etc.
https://www.sanfoundry.com/automata-theory-interview-questions-answers/ 5/5
8/27/2019 DFA Processing Strings - Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “DFA
Processing Strings”.
1. The password to the admins account=”administrator”. The total number of states required to make
a password-pass system using DFA would be __________
a) 14 states
b) 13 states
c) 12 states
d) A password pass system cannot be created using DFA
View Answer
Answer: a
Explanation: For a string of n characters with no repetitive substrings, the number of states required to
pass the string is n+1.
advertisement
3. Let ∑= {a, b, …. z} and A = {Hello, World}, B= {Input, Output}, then (A*∩B) U (B*∩A) can be
represented as:
a) {Hello, World, Input, Output, ε}
b) {Hello, World, ε}
c) {Input, Output, ε}
d) {}
View Answer
Answer: d
Explanation: Union operation creates the universal set by combining all the elements of first and
second set while intersection operation creates a set of common elements of the first and the second
state.
4. Let the given DFA consist of x states. Find x-y such that y is the number of states on minimization of
DFA?
a) 3
b) 2
c) 1
d) 4
View Answer
Answer: b
Explanation: Use the equivalence theorem or Myphill Nerode theorem to minimize the DFA.
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-dfa-processing-strings/ 2/5
8/27/2019 DFA Processing Strings - Automata Theory Questions and Answers - Sanfoundry
5. For a machine to surpass all the letters of alphabet excluding vowels, how many number of states in
DFA would be required?
a) 3
b) 2
c) 22
d) 27
View Answer
Answer: a
Explanation:
https://www.sanfoundry.com/automata-theory-questions-answers-dfa-processing-strings/ 3/5
8/27/2019 DFA Processing Strings - Automata Theory Questions and Answers - Sanfoundry
advertisement
8. Given:
L= {xϵ∑= {0,1} |x=0n1n for n>=1}; Can there be a DFA possible for the language?
a) Yes
b) No
View Answer
Answer: b
Explanation: It is not possible to have a count of equal number of 0 and 1 at any instant in DFA. Thus,
It is not possible to build a DFA for the given Language.
9. δ(A,1) = B, δ(A,0) =A
Δ (B, (0,1)) =C
δ(C,0) = A (Initial state =A)
String=”011001” is transit at which of the states?
a) A
b) C
c) B
d) Invalid String
View Answer
Answer: a
Explanation: It is east and simple to create the table and then the corresponding transition graph in
order to get the result, at which state the given string would be accepted.
https://www.sanfoundry.com/automata-theory-questions-answers-dfa-processing-strings/ 4/5
8/27/2019 DFA Processing Strings - Automata Theory Questions and Answers - Sanfoundry
https://www.sanfoundry.com/automata-theory-questions-answers-dfa-processing-strings/ 5/5
8/27/2019 Simpler Notations - Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “Simpler
Notations”.
1.Given Language: L= {xϵ∑= {a, b} |x has a substring ‘aa’ in the production}. Which of the
corresponding representation notate the same?
a)
advertisement
b)
c)
d)
View Answer
Answer: a
Explanation: The states transited has been written corresponding to the transitions as per the row and
column. The row represents the transitions made and the ultimate.
2.Let u=’1101’, v=’0001’, then uv=11010001 and vu= 00011101.Using the given information what is the
identity element for the string?
a) u-1
b) v-1
c) u-1v-1
d) ε
View Answer
Answer: d
Explanation: Identity relation: εw = wε = w, thus the one satisfying the given relation will be the identity
element.
https://www.sanfoundry.com/automata-theory-questions-answers-simpler-notations/ 1/5
8/27/2019 Simpler Notations - Automata Theory Questions and Answers - Sanfoundry
advertisement
a) 0101011
b) 0101010
c) 010100
d) 100001
View Answer
Answer: c
Explanation: The given DFA notation accepts the string of even length and prefix ‘01’.
4.Predict the following step in the given bunch of steps which accepts a strings which is of even length
and has a prefix=’01’
δ (q0, ε) =q0 < δ(q0,0) =δ (δ (q0, ε),0) =δ(q0,0) =q1 < _______________
a) δ (q0, 011) =δ (δ (q0,1), 1) =δ (q2, 1) =q3
b) δ (q0, 01) =δ (δ (q0, 0), 1) = δ (q1, 1) =q2
c) δ (q0, 011) =δ (δ (q01, 1), 1) =δ (q2, 0) =q3
d) δ (q0, 0111) =δ (δ (q0, 011), 0) = δ (q3, 1) =q2
View Answer
Answer: b
Explanation: Here, δ refers to transition function and results into new state or function when an
transition is performed over its state.
a) Q0
b) Q1
c) Q2
d) No Transition
View Answer
https://www.sanfoundry.com/automata-theory-questions-answers-simpler-notations/ 2/5
8/27/2019 Simpler Notations - Automata Theory Questions and Answers - Sanfoundry
Answer: Q1
Explanation: The tabular representation of DFA is quite readable and can be used to some ore
complex problems. Here, we need to form the transition graph and fill up the given blank.
6.Which among the following is the missing transition in the given DFA?
L= {xϵ∑= {a, b} | x starts with a and ends with b}
a) δ (q0, a) =q0
b) δ (F, a) =q1
c) δ (F, a) =D
d) δ (q1, a) =D
View Answer
Answer: b
Explanation: For the given Language, the transition missing is δ (F, a) =q1.
advertisement
7.The complement of a language will only be defined when and only when the __________ over the
language is defined.
a) String
b) Word
c) Alphabet
d) Grammar
View Answer
Answer: c
Explanation: It is not possible to define the complement of a language without defining the input
alphabets. Example: A language which does not consist of substring ‘ab’ while the complement would
be the language which does contain a substring ‘ab’.
https://www.sanfoundry.com/automata-theory-questions-answers-simpler-notations/ 3/5
8/27/2019 Simpler Notations - Automata Theory Questions and Answers - Sanfoundry
9.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
View Answer
Answer: b
Explanation: According to the given language, q2 Is to become the final/acceptance state in order to
satisfy.
10.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}
https://www.sanfoundry.com/automata-theory-questions-answers-simpler-notations/ 4/5
8/27/2019 Simpler Notations - Automata Theory Questions and Answers - Sanfoundry
a) q0, q1
b) q0, q2
c) q1, q2
d) q0, q1, q2
View Answer
Answer: d
Explanation: According to the given language, the length is at most 2, thus the answer is found
accordingly.
https://www.sanfoundry.com/automata-theory-questions-answers-simpler-notations/ 5/5
8/27/2019 DFA Language - Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “The
Language of DFA”
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-the-language-dfa/ 1/4
8/27/2019 DFA Language - Automata Theory Questions and Answers - Sanfoundry
advertisement
5. For a DFA accepting binary numbers whose decimal equivalent is divisible by 4, what are all the
possible remainders?
a) 0
b) 0,2
c) 0,2,4
d) 0,1,2,3
View Answer
Answer: d
Explanation: All the decimal numbers on division would lead to only 4 remainders i.e. 0,1,2,3 (Property
of Decimal division).
6. 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
View Answer
https://www.sanfoundry.com/automata-theory-questions-answers-the-language-dfa/ 2/4
8/27/2019 DFA Language - Automata Theory Questions and Answers - Sanfoundry
Answer: d
Explanation: The given DFA accepts all the binary strings such that they are divisible by 3 and 2.Thus,
it can be said that it also accepts all the strings which is divisible by 6.
7. Given:
L1= {xϵ ∑*|x contains even no’s of 0’s}
L2= {xϵ ∑*|x contains odd no’s of 1’s}
No of final states in Language L1 U L2?
a) 1
b) 2
c) 3
d) 4
View Answer
Answer: c
Explanation:
advertisement
8. The maximum number of transition which can be performed over a state in a DFA?
∑= {a, b, c}
a) 1
b) 2
c) 3
d) 4
View Answer
Answer: c
Explanation: The maximum number of transitions which a DFA allows for a language is the number of
elements the transitions constitute.
https://www.sanfoundry.com/automata-theory-questions-answers-the-language-dfa/ 3/4
8/27/2019 DFA Language - Automata Theory Questions and Answers - Sanfoundry
9. The maximum sum of in degree and out degree over a state in a DFA can be determined as:
∑= {a, b, c, d}
a) 4+4
b) 4+16
c) 4+0
d) depends on the Language
View Answer
Answer: d
Explanation: The out degree for a DFA I fixed while the in degree depends on the number of states in
the DFA and that cannot be determined without the dependence over the Language.
10. The sum of minimum and maximum number of final states for a DFA n states is equal to:
a) n+1
b) n
c) n-1
d) n+2
View Answer
Answer: a
Explanation: The maximum number of final states for a DFA can be total number of states itself and
minimum would always be 1, as no DFA exits without a final state. Therefore, the solution is n+1.
https://www.sanfoundry.com/automata-theory-questions-answers-the-language-dfa/ 4/4
8/27/2019 Finite Automata Interview Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “Regular
Language & Expression”.
advertisement
5. δ*(q,ya) is equivalent to .
a) δ((q,y),a)
b) δ(δ*(q,y),a)
c) δ(q,ya)
d) independent from δ notation
View Answer
Answer:b
Explanation: First it parse y string after that it parse a.
advertisement
7. 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
View Answer
Answer:a
Explanation: If a string accepted by automata it is called language of automata.
https://www.sanfoundry.com/automata-theory-mcqs-finite-automata/ 2/4
8/27/2019 Finite Automata Interview Questions and Answers - Sanfoundry
11. Regular expression for all strings starts with ab and ends with bba is.
a) aba*b*bba
b) ab(ab)*bba
c) ab(a+b)*bba
d) All of the mentioned
View Answer
Answer:c
Explanation: Starts with ab then any number of a or b and ends with bba.
12. How many DFA’s exits with two states over input alphabet {0,1} ?
a) 16
b) 26
c) 32
d) 64
View Answer
Answer:d
Explanation: Number of DFA’s = 2n * n(2*n).
advertisement
https://www.sanfoundry.com/automata-theory-mcqs-finite-automata/ 3/4
8/27/2019 Finite Automata Interview Questions and Answers - Sanfoundry
14. Number of states require to simulate 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
View Answer
Answer:b
Explanation: 2(m*n) states requires .
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 .
https://www.sanfoundry.com/automata-theory-mcqs-finite-automata/ 4/4
8/27/2019 Non Deterministic Finite Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “Non
Deterministic Finite Automata – Introduction”
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-non-deterministic-finite-automata-introduction/ 1/4
8/27/2019 Non Deterministic Finite Automata Theory Questions and Answers - Sanfoundry
4. 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
View Answer
Answer: c
Explanation: The maximum number of sets for DFA converted from NFA would be not greater than 2n.
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-non-deterministic-finite-automata-introduction/ 2/4
8/27/2019 Non Deterministic Finite Automata Theory Questions and Answers - Sanfoundry
8. 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)
View Answer
Answer: b
Explanation: From the coded NFA-DFA conversion.
9. If n is the length of Input string and m is the number of nodes, the running time of DFA is x that of
NFA.Find x?
a) 1/m2
b) 2m
c) 1/m
d) log m
View Answer
Answer: a
Explanation: Running time of DFA: O(n) and Running time of NFA =O(m2n).
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-non-deterministic-finite-automata-introduction/ 3/4
8/27/2019 Non Deterministic Finite Automata Theory Questions and Answers - Sanfoundry
https://www.sanfoundry.com/automata-theory-questions-answers-non-deterministic-finite-automata-introduction/ 4/4
8/27/2019 Extended Transition Function - Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “Extended
Transition Function”.
advertisement
a) Correct
b) Incorrect, Incomplete DFA
c) Wrong proposition
d) May be correct
View Answer
Answer: c
Explanation: The given figure is an NFA. The statement contradicts itself.
https://www.sanfoundry.com/automata-theory-questions-answers-extended-transition-function/ 1/4
8/27/2019 Extended Transition Function - Automata Theory Questions and Answers - Sanfoundry
4. If δ is the transition function for a given NFA, then we define the δ’ for the DFA accepting the same
language would be:
Note: S is a subset of Q and a is a symbol.
a) δ’ (S, a) =Upϵs δ (p, a)
b) δ’ (S, a) =Up≠s δ (p, a)
c) δ’ (S, a) =Upϵs δ(p)
d) δ’ (S) =Up≠s δ(p)
View Answer
Answer: a
Explanation: According to subset construction, equation 1 holds true.
5. What is the relation between DFA and NFA on the basis of computational power?
a) DFA > NFA
b) NFA > DFA
c) Equal
d) Can’t be said
View Answer
Answer: c
Explanation: DFA is said to be a specific case of NFA and for every NFA that exists for a given
language, an equivalent DFA also exists.
advertisement
6. If a string S is accepted by a finite state automaton, S=s1s2s3……sn where siϵ∑ and there exists a
sequence of states r0, r1, r2…… rn such that δ(r(i), si+1) =ri+1 for each 0, 1, …n-1, then r(n) is:
a) initial state
b) transition symbol
c) accepting state
d) intermediate state
View Answer
Answer: c
Explanation: r(n) is the final state and accepts the string S after the string being traversed through r(i)
other states where I ϵ 01,2…(n-2).
7. According to the given table, compute the number of transitions with 1 as its symbol but not 0:
a) 4
b) 3
https://www.sanfoundry.com/automata-theory-questions-answers-extended-transition-function/ 2/4
8/27/2019 Extended Transition Function - Automata Theory Questions and Answers - Sanfoundry
c) 2
d) 1
View Answer
Answer: d
Explanation: The transition graph is made and thus the answer can be found.
a) {q0}
b) {q1} U {q0, q1, q2}
c) {q2, q1}
d) {q3, q1, q2, q0}
View Answer
Answer: b
Explanation: δ*(q0,011) = Urϵδ*(q0,01) δ (r, 1) = {q0, q1, q2}.
a) 6
b) 5
https://www.sanfoundry.com/automata-theory-questions-answers-extended-transition-function/ 3/4
8/27/2019 Extended Transition Function - Automata Theory Questions and Answers - Sanfoundry
c) 4
d) 7
View Answer
Answer: a
Explanation: According to the question, presence of q2 or q1 would count so it does and the answer
according to the diagram is 6.
1.Δ(Q0, ε) ={Q0},
2.Δ(Q0, 01) = {Q0, Q1}
3.δ(Q0, 010) =?
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-extended-transition-function/ 4/4
8/27/2019 NFA Language - Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “The
Language of NFA”.
advertisement
2. Given Language:
Ln= {xϵ {0,1} * | |x|≥n, nth symbol from the right in x is 1}
How many state are required to execute L3 using NFA?
a) 16
b) 15
c) 8
d) 7
View Answer
Answer: b
Explanation: The finite automaton for the given language is made and thus, the answer can be
obtained.
https://www.sanfoundry.com/automata-theory-questions-answers-the-language-nfa/ 1/4
8/27/2019 NFA Language - Automata Theory Questions and Answers - Sanfoundry
4. The number of transitions required to convert the following into equivalents DFA:
a) 2
b) 3
c) 1
d) 0
View Answer
Answer: a
Explanation:
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-the-language-nfa/ 2/4
8/27/2019 NFA Language - Automata Theory Questions and Answers - Sanfoundry
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-the-language-nfa/ 3/4
8/27/2019 NFA Language - Automata Theory Questions and Answers - Sanfoundry
10. Which of the following recognizes the same formal language as of DFA and NFA?
a) Power set Construction
b) Subset Construction
c) Robin-Scott Construction
d) All of the mentioned
View Answer
Answer: d
Explanation: All the three option refers to same technique if distinguishing similar constructions for
different type of automata.
https://www.sanfoundry.com/automata-theory-questions-answers-the-language-nfa/ 4/4
8/27/2019 Equivalence of NFA & DFA - Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “Equivalence
of NFA and DFA”.
advertisement
2. It is less complex to prove the closure properties over regular languages using
a) NFA
b) DFA
c) PDA
d) Can’t be said
View Answer
Answer: a
Explanation: We use the construction method to prove the validity of closure properties of regular
languages. Thus, it can be observe, how tedious and complex is the construction of a DFA as
compared to an NFA with respect to space.
https://www.sanfoundry.com/automata-theory-questions-answers-equivalence-nfa-dfa/ 1/4
8/27/2019 Equivalence of NFA & DFA - Automata Theory Questions and Answers - Sanfoundry
4. John is asked to make an automaton which accepts a given string for all the occurrence of ‘1001’ in
it. How many number of transitions would John use such that, the string processing application works?
a) 9
b) 11
c) 12
d) 15
View Answer
Answer: a
Explanation:
advertisement
6. Which among the following can be an example of application of finite state machine(FSM)?
a) Communication Link
b) Adder
c) Stack
d) None of the mentioned
View Answer
Answer: a
Explanation: Idle is the state when data in form of packets is send and returns if NAK is received else
waits for the NAK to be received.
https://www.sanfoundry.com/automata-theory-questions-answers-equivalence-nfa-dfa/ 2/4
8/27/2019 Equivalence of NFA & DFA - Automata Theory Questions and Answers - Sanfoundry
c) State charts
d) None of the mentioned
View Answer
Answer: d
Explanation: Finite state automation is used in Lexical Analyser, Computer BOT (used in games), State
charts, etc.
advertisement
9. Predict the number of transitions required to automate the following language using only 3 states:
L= {w | w ends with 00}
a) 3
b) 2
https://www.sanfoundry.com/automata-theory-questions-answers-equivalence-nfa-dfa/ 3/4
8/27/2019 Equivalence of NFA & DFA - Automata Theory Questions and Answers - Sanfoundry
c) 4
d) Cannot be said
View Answer
Answer: a
Explanation:
10. The total number of states to build the given language using DFA:
L= {w | w has exactly 2 a’s and at least 2 b’s}
a) 10
b) 11
c) 12
d) 13
View Answer
Answer: a
Explanation: We need to make the number of a as fixed i.e. 2 and b can be 2 or more. Thus, using this
condition a finite automata can be created using 1 states.
https://www.sanfoundry.com/automata-theory-questions-answers-equivalence-nfa-dfa/ 4/4
8/27/2019 DFA Applications - Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “Applications
of DFA”.
advertisement
3. Let L be a language whose FA consist of 5 acceptance states and 11 non final states. It further
consists of a dumping state. Predict the number of acceptance states in Lc .
a) 16
b) 11
c) 5
d) 6
View Answer
Answer: a
Explanation: If L leads to FA1, then for Lc , the FA can be obtained by exchanging the final and non-
final states.
https://www.sanfoundry.com/automata-theory-questions-answers-aplications-dfa/ 1/4
8/27/2019 DFA Applications - Automata Theory Questions and Answers - Sanfoundry
advertisement
6. Which among the following NFA’s is correct corresponding to the given Language?
L= {xϵ {0, 1} | 3rd bit from right is 0}
a)
b)
https://www.sanfoundry.com/automata-theory-questions-answers-aplications-dfa/ 2/4
8/27/2019 DFA Applications - Automata Theory Questions and Answers - Sanfoundry
c)
https://www.sanfoundry.com/automata-theory-questions-answers-aplications-dfa/ 3/4
8/27/2019 DFA Applications - Automata Theory Questions and Answers - Sanfoundry
advertisement
9. Let N (Q, ∑, δ, q0, A) be the NFA recognizing a language L. Then for a DFA (Q’, ∑, δ’, q0’, A’), which
among the following is true?
a) Q’ = P(Q)
b) Δ’ = δ’ (R, a) = {q ϵ Q | q ϵ δ (r, a), for some r ϵ R}
c) Q’={q0}
d) All of the mentioned
View Answer
Answer: d
Explanation: All the optioned mentioned are the instruction formats of how to convert a NFA to a DFA.
10. There exists an initial state, 17 transition states, 7 final states and one dumping state, Predict the
maximum number of states in its equivalent DFA?
a) 226
b) 224
c) 225
d) 223
View Answer
Answer: a
Explanation: The maximum number of states an equivalent DFA can comprise for its respective NFA
with k states will be 2k .
https://www.sanfoundry.com/automata-theory-questions-answers-aplications-dfa/ 4/4
8/27/2019 NFA Applications - Automata Theory Questions and Answers - Sanfoundry
This set of Automata Theory Multiple Choice Questions & Answers (MCQs) focuses on “Applications
of NFA”.
advertisement
2. It is less complex to prove the closure properties over regular languages using:
a) NFA
b) DFA
c) PDA
d) Can’t be said
View Answer
Answer: a
Explanation: None.
4. John is asked to make an automaton which accepts a given string for all the occurrence of ‘1001’ in
it. How many number of transitions would John use such that, the string processing application works?
a) 9
https://www.sanfoundry.com/automata-theory-questions-answers-applications-nfa/ 1/3
8/27/2019 NFA Applications - Automata Theory Questions and Answers - Sanfoundry
b) 11
c) 12
d) 15
View Answer
Answer: a
Explanation: None.
advertisement
6. Which among the following can be an example of application of finite state machine(FSM)?
a) Communication Link
b) Adder
c) Stack
d) None of the mentioned
View Answer
Answer: a
Explanation: Idle is the state when data in form of packets is send and returns if NAK is received else
waits for the NAK to be received.
advertisement
https://www.sanfoundry.com/automata-theory-questions-answers-applications-nfa/ 2/3
8/27/2019 NFA Applications - Automata Theory Questions and Answers - Sanfoundry
9. Predict the number of transitions required to automate the following language using only 3 states:
L= {w | w ends with 00}
a) 3
b) 2
c) 4
d) Cannot be said
View Answer
Answer: a
Explanation: None.
10. The total number of states to build the given language using DFA:
L= {w | w has exactly 2 a’s and at least 2 b’s}
a) 10
b) 11
c) 12
d) 13
View Answer
Answer: a
Explanation: We need to make the number of a as fixed i.e. 2 and b can be 2 or more. Thus, using this
condition a finite automata can be created using 1 states.
https://www.sanfoundry.com/automata-theory-questions-answers-applications-nfa/ 3/3
MCQ
• Write the regular expression for the language
accepting all the string which are starting with 1
and ending with 0, over ∑ = {0, 1}.
•
• Write the regular expression for the language
accepting all the string which are starting with 1
and ending with 0, over ∑ = {0, 1}.
•
R = 1 (0+1)* 0
• Write the regular expression for the language
starting and ending with a and having any having
any combination of b's in between.
• Write the regular expression for the language
starting and ending with a and having any having
any combination of b's in between.
• R = a+a b* a
• Write the regular expression for the language
starting with a but not having consecutive b's.
•
• Write the regular expression for the language
starting with a but not having consecutive b's.
•
L = {a, aba, aab, aba, aaa, abab, .....}
•
R = {a + ab}*
•
• Describe the language denoted by following regular
expression
•
RE = (b* (aaa)* b*)*
•
• Describe the language denoted by following regular
expression
•
RE = (b* (aaa)* b*)*
•
(any combination of b's) (aaa)* (any combination of b's)
The lemma says, the portion y in xyz cannot be zero or empty i.e. |y|>0, this
condition needs to be fulfilled to check the conclusion condition
3. 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
3. 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
• 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 above
• 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 above
• A) (PQ)*P = P(QP)*(identity)
• 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
• 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
• A) baaaaabaaaab
• B) baaaaabaa
• C) aabab
• D) baab
• Given the language L = {ab, aa, baa}, which of the
following strings are in L*?
• A) baaaaabaaaab
• B) baaaaabaa
• C) aabab
• D) baab
• L1 = set of all strings of 0’s and 1’s that ends with
00
• L1 = set of all strings of 0’s and 1’s that ends with
00
• Ans: (0+1)* 00
• L1 = set of all strings of 0’s and 1’s that starts with 0
and ends with 1
• L1 = set of all strings of 0’s and 1’s that starts with 0
and ends with 1
• Ans: 0(0+1)*1
• Prove (1+00*1) + (1+00*1)(0+10*1)*(0+10*1) =
0*1(0+10*1)*
• Let N be an NFA with n states. Let k be the number
of states of a minimal DFA which is equivalent to N.
Which one of the following is necessarily true?
Is it regular a regular language or not
• {ai bj : i, j ≥ 0 and i + j = 5}
•
Is it regular a regular language or not
• {ai bj : i, j ≥ 0 and i + j = 5}
• Regular.
Is it regular a regular language or not
• {w ϵ {a, b}* : w contains exactly two more b's
than a's}
E) Answer: (10)*(01)*(00+11)*
5. The following CFG:
S -> aB | bA
A -> b | aS | Baa
B-> a | bS | aBB
generates strings that have:
a) Equal number of a’s and b’s
b) Odd number of a’s and odd number of b’s
c) Even number of a’s and even number of b’s
d) None of the above
a) Regular
b) Context free but not regular
c) Context Sensitive but not context free
• Q*Q = QQ* TRUE
• Q+ = QQ* TRUE
• Prove: P+ PQ*Q = PQ*
• LHS = P+PQ*Q
= PQ*
= (b+aa*b)Q*
= a*bQ*
=RHS
• Show using pumping lemma, following languages
are not regular
• L = { anb2n | n> 0}
• L = { anbm | 0<n<m}
Pumping Lemma
• We can break w into three strings, s = xyz, such
that:
• |w| ≥ c
y = ar 1< r<q
• S → abS
•S→a
• a) Right Linear Grammar
• b) Left Linear Grammar
• c) Right & Left Linear Grammar
• d) None of the mentioned
• . Which Type of Grammar is it?
• S → Aa
• A → Aab | E
• a) Right Linear
• b) Left Linear
• c) None of the mentioned
• d) Right & Left Linear
• Transition of finite automata is ___________
a) Finite Diagram
b) State Diagram
c) Node Diagram
d) E-R Diagram
• Which of the following identity is wrong?
a) R + R = R
b) (R*)* = R*
c) ƐR = RƐ = R
d) ØR = RØ = RR*
THEORY OF COMPUTATION
Solutions
A. 37 B. 35 C. 2 D. 36
Solution: Option C
2. Let the string be defined over symbols a and b then what will be the number of states in minimal
DFA, if every string starts and ends with different symbols?
A. 5 B. 4 C. 3 D. None
Solution: Option A
A. 7 B. 10 C. 11 D. 8
Solution: Option C
4. Let ∑= {a, b}, what are the number of states in minimal DFA, length of every string congruent
to mod 5.
A. 2 B. 3 C. 5 D. None
Solution: Option C
Solution: Option D
Solution: Option D
1
7. S AB
A BB/ a
B AB/ b
Solution: Option B
8. One of the following Regular Expressions is not the same as others. Which one?
Solution: Option C
Solution: Option A
Solution: Option D
11. Consider the regular grammar generating the set of all strings ending with ‘00’.
S 1S/ 0P
P 0C/ 0/ 1S
Solution: Option A
2
12. Consider a DFA with
Solution: Option D
13. What are the number of states needed in minimal DFA, that accepts (1+1111)*
A. 5 B. 4 C. 1 D. None
Solution: Option C
The smallest string for which the grammar has two derivation trees:
Solution: Option A
Solution: Option A
Solution: Option A
3
17. Let ∑= {0, 1}
What will be the number of states in minimal DFA, if the Binary number string is congruent
to (mod 8).
A. 8 B. 9 C. 7 D. 4
Solution: Option D
18.
The FA above recognizes a set of stings of length 6, what is the total number of strings that can
be generated from the FA?
A. 18 B. 20 C. 130 D. None.
Solution: Option B
19. What are the number of final states in minimal DFA, where ∑= {a, b}, if every string starts
with “aa” and length of string is not congruent to 0 (mod 4).
A. 7 B. 6 C. 3 D. 5
Solution: Option C
20. How many DFA with four states can be constructed over the alphabet ∑= {a, b} with
designated initial state?
Solution: Option B
21. Let ∑= {a}, assume language, L= { a2012.K/ K> 0}, what is minimum number of states
needed in a DFA to recognize L?
4
Solution: Option B
SaB/ bA
A a/ aS/ bAA
B b/ bS/ aBB generates strings with
Solution: Option C
23. Let A= (a + b)* ab (a + b)*, B= a*b* and C= (a + b)*. Then the relation between A, B and C:
Solution: Option C
Solution: Option B
25.
Let M1 be the NFA obtained by interchanging final and non-final states of M. Let the
language accepted by M be L and that accepted by M1 be L1. Choose correct statement:
A. L1= L
5
B. L1∩ L2= Φ
C. L1⊆ L2
D. L1= (0+1)*
Solution: Option D
26. Assertion (a): The language L= Set of all strings not containing 101 as a substring is regular set
Regular (r): L satisfies the regular set but not the pumping lemma.
A. Both (a) and (r) are true and (r) is a reason for (a)
B. Both (a) and (r) are true and (r) is not correct reason (a)
C. Both (a) and (r) are false
D. (a) is true but (r) is false
Solution: Option B
27. Let M= (Q, ∑, δ, S, F) and M’= (Q, ∑, δ, S, Q-F ) where M accepts L and M’ accepts L1 and
M is NFA, what could be the relation between L and L’ ?
Solution: Option C
28.
Solution: Option B
6
29. The minimal DFA of the above machine has:
Solution: Option A
Consider the grammar given below where the flowers are non-terminals and animals are
terminals:
X XX/ aX/ bX/ null string
where, a is tiger and b is for lion
Solution: Option B
31. The string for which the grammar has maximum of two derivation trees is:
A. lion tiger lion B. lion tiger C. tiger lion D. None of the above
Solution: Option D
Solution: Option B
7
33. What will be this TM?
Solution: Option C
8
THEORY OF COMPUTATION
AUTOMATA- 1
SOLUTIONS
1.
r1 = 1 (0 + 1)*
r2 = 1 (1 + 0)+
r3 = 11*0
Relation?
(a) L (r1) ⊆ L (r2) and L(r1) ⊆ L(r3) (b) L (r1) ⊇ L (r2) and L(r2) ⊇ L(r3)
(c) L (r1) ⊇ L (r2) and L(r2) ⊆ L(r3) (d) L (r1) ⊆ L (r3) and L(r2) ⊆ L(r1)
2. Give the strongest correct statement about finite language over finite Ʃ ?
3. Let n1 be the number of states in minimal NFA of a partial language and n2 be the DFA.
Relation?
(a) n1 ≥ n2 (b) n1 ≤ n2
(c) n1 < n2 (d) n2 > n1
4.
S1: L is regular. Infinite union of L will also be regular i.e. (L0 ∪ L1 ∪ L2 . . .)
S2: L is regular. It’s subset will also be regular.
1
(c) S1 → T, S2 → F (d) S1 → F, S2 → T
5. Consider r = (11 + 111)* over Ʃ = {0, 1}. Number of states in minimal NFA and DFA
respectively:
(a) N – 3, D – 4 (b) N – 3, D – 3
(c) N – 3, D – 3 (d) N – 4, D – 4
Explanation:
A DFA
Explanation:
As a DFA with multiple final states, cannot be converted to DFA with single final state.
2
7. Consider 2 scenarios:
Explanation:
As in case of NFA even is F = ϕ, dead state rejection is there so L ≠ Ʃ*.
How many strings will be there in the complement of the language accepted by this Finite
Automata?
Explanation:
As L is (a + b)*
L={ }
3
(a) (L ∪ D)* (b) (L ∙ D)*
(c) L ∙ (L ∪ D)* (d) L ∙ (L ∙ D)*
10. Total number of DFA possible with 2 states q0 → start and non-final, q1 → final
over Ʃ = {a,b} is
(a) 16 (b) 32
(c) 48 (d) 64
Explanation:
0 1
→q0 2 2
2 2
Total = 2 × 2 × 2 × 2 = 16
11.
Ʃ = {0, 1}
L = Ʃ*
R = { On 1n such that n > 1}
Explanation:
L ∪ R → Regular
R → CFL
4
12.
L1 = { am | m ≥ 0}
L2 = { bm | m ≥ 0}
L1 ∙ L2 = ?
Solution: Option ( b)
(L)∗ ≠ (L∗ )
Explanation:
Infinite can also be regular → 𝑎∗
(L)∗ will surely contain ∈
but (L∗ ) will not contain ∈.
So, they are not equal.
14. Which of the following R.E. over Ʃ = {0, 1} denotes set of all strings not containing as sub-
string.
5
(b) Numbers 1, 3, 4, 8, . . . 2n written in unary
(c) Set of binary strings in which number of zeroes is same as number of 1’s
(d) Set {1, 101, 11011, 1110111, . . .}
Explanation:
L = 1 0*
6
THEORY OF COMPUTATION
AUTOMATA SET – 2
SOLUTIONS
1. Which of the following are not equivalent to expression (a + b + c)* ?
2. M = (K, Ʃ, δ, S, F) be a FA.
K = {A, B} F = {B}
δ(A, a) = A δ(B, a) = B
δ(A, b) = B δ(B, b) = A
Relation?
1
(c) S1 → T, S2 → F (d) S1 → F, S2 → T
Explanation:
For S1: Take L = { ab, ba }
For S2: Take L1 = { a, aa }, L2 = { ab, b }
4. Consider NFA:
Consider:
S1: For DFA, L(M) = L(M)
S2: For NFA, L(M) = L(M)
6. Based on the answer to the above question, if for any of the machines, statement is false, what
could be the reason?
2
(a) Presence of ∈- Move
(b) Dead- State Rejection
(c) Choice of State i.e. Non- determinism
(d) All of the above ie a,b,c
(e) For Both machines, statements are true
Explanation:
Language is having atleast 2 a’s.
8.
Explanation:
R = (aa)* (bb)* + a(aa)* b(bb)* = L1
3
S2 → r + ԑ = r = ԑ + r
Explanation:
r may not contain ԑ, so r + ԑ ≠ r
10.
Explanation:
L2 is important and specific case.
4
(d) None of the above
Explanation:
All CSL’s are decidable.
Explanation:
If DPDA is possible for L, surely NPDA can also be made.
13. L ⊆ Ʃ* is said to be co-finite iff their complement is finite. What can you say?
Explanation:
If complement is Finite → Lc is Regular
So, L has to be Regular.
5
Using closure properties
15. Let G be grammar in CNF. Let w1, w2 ∈ L(G) such that |w1| < |w2|
(a) Any derivation of w1 has exactly same number of steps as any derivation of w2
(b) Some derivation of w2 may be shorter than of steps as any derivation of w1
(c) All derivations ofw1 will be shorter than any derivation of w2
(d) None
Explanation:
Derivation always required 2n – 1 steps in CNF
n = length of string.
6
THEORY OF COMPUTATION
SET – 4
SOLUTIONS
1. Consider an ambiguous grammar G and its disambiguated version D. Let the language
recognized by them are L(G) and L(D) respectively. Which one is true?
1
Solution: Option (a)
2
(d) None of above
4. Which one of the Regular Expression given defines the same language as defined by R?
3
(c) Ln is regular only for small value of n
(d) None of above
Explanation:
b is depending on a and number of a’s are unbounded.
6. Let L1 be an infinite regular language. Let L2 be an infinite set such that L2 ⊂ L1.
Explanation:
Take L1 → (a + b)*
L2 can be 0n 1n
Explanation:
Take L1 = (a + b)*
8. wR denotes the reverse of w. For L ⊆ Ʃ*, LR = {wR | w ∈ L}. Suppose LR is not regular.
Then,
4
Explanation:
If LR is regular, L has to be regular.
S1: a*. ϕ = a*
S2: ϕ* = ϕ
Explanation:
ϕ* = ∈
a*ϕ = ϕ
10.
Explanation:
For S1, take
L1 = a* - a0
L2 = a* - a1
L3 = a* - a4 All non-primes I am taking.
6
L4 = a* - a
L5 = a* - a8
:
:
After taking their intersection, u will get like this.
L = {ap, p is prime}
i.e. Not Regular
5
For S2:
L is nothing but language of even length strings.
R.E. = (00 + 01 + 10 +11)*
So, L is regular.
6
THEORY OF COMPUTATION
AUTOMATA
SOLUTIONS
1. There are ___________ tuples in finite state machine.
(a) 4 (b) 5
(c) 6 (d) unlimited
Explanation:
States, input symbols, initial state, accepting state and transition function.
Explanation:
Inputs are state and input string output is states.
(a) 3 (b) 2
(c) 1 (d) can’t be represented
Explanation:
This is minimal finite automata.
1
Explanation:
This takes single state and string of input to produce a state.
5. δ*(q,cya) is equivalent to
Explanation:
First it parse y string after that it parse a.
Explanation:
If automata starts with starting state and after finite moves if reaches to final step then it called
accepted.
7. Languages of an automata is
Explanation:
If a string accepted by automata it is called language of automata.
2
(c) Type 2 (d) Type 3
Explanation:
According to Chomsky classification.
(a) 1 (b) 0
(c) 2 (d) None of the mentioned
Explanation:
Finite automata doesn’t require any stack operation.
(a) 1 (b) 2
(c) 3 (d) None of the mentioned
Explanation:
No final state requires.
11. Regular expression for all strings starts with ab and ends with bba is
Explanation:
Starts with ab then any number of a or b and ends with bba.
12. How many DFA’s exits with two states over input alphabet {0,1} ?
(a) 16 (b) 26
3
(c) 32 (d) 64
Explanation:
Number of DFA’s = 2^n * n^(2*n)
Explanation:
Because there is no memory associated with automata.
14. Number of states require to simulate a computer with memory capable of storing ‘3’ words
each of length ‘8’.
Explanation:
2^(m*n) states requires.
15. FSM with output capability can be used to add two given integer in binary representation.
This is
Explanation:
Use them as a flip flop output.
4
16. 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
Explanation:
string of length 0 = 1
string of length 1 = 4
string of length 2 = 3
string of length 3 = 3
Explanation:
All of above machine can accept regular language but all string accepted by machine is regular
only for DFA.
Explanation:
Regular grammar is subset of context free grammar.
5
20. Let the class of language accepted by finite state machine be L1 and the class of languages
represented by regular expressions be L2 then
Explanation:
Finite state machine and regular expression have same power to express a language.
6
THEORY OF COMPUTATION
SOLUTIONS
1. Consider this R.E. = (0 + 1)* (00 + 11)
What will be the number of states in minimal DFA and NFA?
Explanation:
2. Number of states in minimal DFA to accept the language (a + aaa)* over Ʃ = {a, b} ?
(a) 1 (b) 2
(c) 3 (d) None
Explanation:
(a + aaa)* ≡ a*
3. Consider 2 statements:
1
S1: There doesn’t exist FA for every CFL.
S2: Let Ʃ = {a, b} and L = {an w an | n ≥ 1, w ∈ Ʃ*}
Explanation:
S1: (a +b)* is also CFL
S2: L is regular. R.E. = a(a + b)* a
4. Consider this:
Explanation:
S1 → F
S2 → T
r1 represents strings of length atmost 100.
5. r1 = (01 + 1)* (ԑ + 0)
r2 = (0 + ԑ) (10 + 1)*
2
Explanation:
Both are regular expression represents strings with no consecutive zeroes.
(a) 2 (b) 3
(c) 4 (d) 5
Explanation:
Explanation:
S1: NTM ≡ DTM
S2: 𝐿̅ is Recursive.
L is ?
Explanation:
3
We just need 13 states to remainders (0, 1, . . . 12). We start by state with 0 remainder and as we
visit new character, we change state to next remainder.
Explanation:
Not possible to check for w as stack will be empty after checking for a and b.
10. Which of the following is true for i/p alphabet Ʃ and tape alphabet Γ of a standard TM?
Explanation:
Γ always contains members of Ʃ and special Block symbol also, which is not in Ʃ.
11. Suppose M1 and M2 are 2 TM’s such that L(M1) = L(M2). Then
Explanation:
M2 accepts strings in L(M1) so it will halt. Other 2 are not guaranteed.
4
(a) Decidable
(b) Turing-recognizable but may not be decidable
(c) May not be Turing recognizable
(d) None of above
Explanation:
We can build a TM for union but decidability may not always be guaranteed.
13.
Consider u = abbaba
v = bab
w = aabb
Explanation:
Language of palindromes it is.
5
15. R.E. best describing this below NFA?
Explanation:
⊛ (b) is not because aab is rejected.
Explanation:
(a) is CSL.
(b) & (c) are accepted by DPDA.
16. Which of the following statements about regular languages is Not true?
6
19. Consider the CFG below:
S → aSAb | ԑ
A → bA | ԑ
Grammar generates:
Explanation:
Verify using aab. It is getting rejected.
S → bS | aA | ԑ
A → aS | bA
Explanation:
M – N equivalent classes are actually the number of states in FA.
True?
7
22. Which of the following R.E. are equivalent?
i. (00)* (ԑ + 0)
ii. (00)*
iii. 0*
iv. 0(00)*
(a) all binary strings with unequal number of 0’s and 1’s
(c) all binary strings with exactly | more 0 than the number of 1’s
or one more | than number of 0’s
Explanation:
init (L) = (a +b)*
8
THEORY OF COMPUTATION
SOLUTIONS
1. Let Prefix(u) = {x | u = xy}
(a) n (b) n – 1
(c) n + 1 (d) None
Explanation:
Ex. u = ab Prefix (u) = {ԑ, a, ab}
ԑ.ab
a.b
ab.ԑ
2. Consider this:
S1: Language L and its complement 𝐿̅ will have same number of states in minimal DFA.
S2: Language L and its complement 𝐿̅ will have same number of states in minimal NFA.
Explanation:
Only in DFA, we can say that.
3. Let L be a Finite language in which maximum length of string is n and minimum length is
m(m < n). Minimum number of states in the DFA will be:
(a) m + 1 (b) n + 1
(c) n + 2 (d) m + 2
Explanation:
1
In case of finite, maximum n length has to be accepted in n + 1 states and 1 permanent rejector
will also be required.
4. Let w be any string of length n in (0, 1)*. Let L be set of all sub-strings of w. Minimum
number of states in NFA that accepts L?
(a) n (b) n + 1
(c) n + 2 (d) n – 1
Explanation:
Exactly the above question.
Here |wmax| = n and since it’s a NFA, Permanent rejector would not be required.
5. Consider these:
Explanation:
For S1: ϕ* = ԑ
For S2: a* . ϕ = ϕ
2
7. Let L = {x ∈ {a, b, c}* : x contains exactly one a and exactly one b}.
Which is true?
(a) R. E. = c+ a c+ b c+ + c+ b c+ a c+
(b) R.E. = c* a c* b c* + c* b c* a c*
(c) Both (a) and (b)
(d) R.E. not possible as L is context-free
8. Consider:
S1: Every regular language can be accepted by NFA with only one Final state
S2: There is a language for which L = L*
Explanation:
For S1: Because of ԑ-moves
For S2: L = {ԑ}
9. If L is Turing-recognizable. Then
3
(c) S1 → T, S2 → F (d) S1 → F, S2 → T
Explanation:
For S2: Take L = (0 + 1)* which is R.E. and L’ = Ld which is not R.E.
Enumerator for L outputs all strings in L’ but also outputs strings that may not be in L’, So it is
not enumerator for L’.
11. Which of the following C. F.G. is not producing the same language as others?
(a) S → aS | bS | a | b | ԑ
(b) S → Sa | Sb | a | b | ԑ
(c) S → a | b | SS | ԑ
(d) S → aS | b A
A → bA | ԑ
Explanation:
a, b, c are producing (a + b)*
Explanation:
All regular, DCFL are unambiguous languages.
Language is ambiguous when all the grammars producing that L are ambiguous.
For S2: We can always create ambiguous grammar to produce Regular language.
Say L = (a +b )*
S → a | b | SS | ԑ → Ambiguous
4
13. L1 = {ambncp | m ≥ n or n = p}
L2 = {ambncp | m ≥ n and n = p}
Explanation:
L2 is CSL.
I. G is ambiguous
II. Language is a*b*
III. G can be accepted by DPDA
IV. r = (a + b)*
Explanation:
Language is (a + b)*
Explanation:
Because of c & d at starting, we can decide how much to pop and push in stack.
5
THEORY OF COMPUTATION
SET-8
SOLUTIONS
1. Regular Expression for this DFA:
i. ϕ* + a+ + b+ + (a + b)+ → r1
ii. ϕ+ + a* + b* + (a + b)* → r2
Explanation:
Both are (a + b)*
1
4. Consider this regular expression:
r = (a*b)* + (b*a)*
This is equivalent to
Explanation:
r = All strings ending with either a or b
+ԑ
Explanation:
All DCFL’s are unambiguous languages.
̅̅̅̅̅̅̅
6. Let A and B be disjoint, R.E. languages. Let A ∪ B also be recursive enumerable. What can
you say about A and B?
Explanation:
w can be either in A or B or in neither of them. Build 3 TM’s of A, B, ̅̅̅̅̅̅̅
𝐴∪𝐵
2
Surely in finite time, one of them would say yes, which identifies where w is.
S denotes set of seven bit binary strings in which first, fourth, last bit is 1. Number of strings in L
are:
(a) 5 (b) 6
(c) 7 (d) 8
8. Following language:
L = {anbncndn, n ≥ 1} is
(a) CFL but nor regular (b) CSL but not CFL
(c) Regular (d) Type 0 language but not Type 1
3
(c) L1 is regular but L2 is not (d) L1 is not regular but L2 is regular
Explanation:
L1 will contain finite number of strings.
L2 will contain infinite strings and involves comparison also.
11. Can a Deterministic Finite State machine simulate a Non-Deterministic Finite State machine?
Explanation:
Always DFA is possible for an NFA.
(a) L∗ = ⋃∞i=1 L
i
(b) L∗ = L+ ∪ {ε}
(c) L∗ = L+ (d) L∗ = L+ ∩ {ε}
4
13. Concept of Grammar is used in which part of compiler?
(a) {a (cd)n b, n ≥ 0}
(b) {a (cd)n a, n ≥ 0} ∪ {b (cd)n b, n ≥ 0}
(c) {a (cd)n a, n ≥ 0} ∪ {b (cd)n b, n ≥ 0}
∪ {a (cd)n b, n ≥ 0} ∪ {b (cd)n a, n ≥ 0}
(d) {acndnb, n ≥ 1}
i. b*a* ⋂ a*b* = a* ⋃ b*
ii. a*b* ⋂ c*d* = ϕ
Explanation:
a*b* ⋂ c*d* = ԑ
5
AUTOMATA
SET- 9
SOLUTIONS
1. Let L = {ab, aa, baa}
2. Let M be a Non-deterministic Finite Machine. Let G be the Regular Grammar obtained from
M.
Which is True?
Explanation:
G will be ambiguous.
(a) 3 (b) 4
(c) 5 (d) 6
1
4. Consider the Language:
Which is True?
Explanation:
L is inherently ambiguous.
G will be of type:
S → S1 | S2
abc abc
Explanation:
ρ has minimum string 01 not present in φ.
6. Let R be Regular set. Let S be set consisting of all strings in R which are identical with their
own reverses. What can you say about S?
2
Explanation:
R = 0*10*
S = {0n10n | n ≥ 0} is CFL.
7. Suppose L is a context-free language over Ʃ = {a} i.e. only one alphabet. What can you say
about L?
Explanation:
CFL over one alphabet will always be regular.
8. Minimum number of states in DFA over Ʃ = {0, 1} with each string contains odd number of
0’s or odd number of 1’s.
(a) 3 (b) 4
(c) 5 (d) 6
9. Let L be a Context Free Language. Even(L) is the set of all strings w in L such that |w| is even.
Explanation:
Even(L) is the intersection of L with the DFA that accepts even length strings
i.e. Even (L) = CFL ⋂ Regular
= CFL
So, Even (L) is a closed operation.
3
10. Consider this grammar:
S → bF, S → aS, F → ԑ , F → bF | aF
Explanation:
All regular expression represents the language containing at least 1 b.
L’ is
Explanation:
L’ is concatenation of 2 regular languages basically L and L̅. Regular are closed under
concatenation.
Explanation:
S1 → L = {φ}
S2 → {anbm | n≤m} ⋃ {anbm | n≥m}
4
13. L1 = {ambncmax(m,n) : m,n > 1}
n
L2 = {a2 , n > 1} ⋃ {am, m>1}
Explanation:
L2 → a*
Explanation:
G is producing all even length strings which is a regular language.
Language is