TOC Imp Questions
TOC Imp Questions
TOC Imp Questions
Solution: (c)
Explanation:
For any string, there will always be only 2 trivial substrings, ∈ and the given string itself.
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
(c) 3
(b) 4
(d) None
4. Let ∑= {a, b}, what are the number of states in minimal DFA, length of every string congruent
to mod 5.
(a) 2
(c) 5
(b) 3
(d) None
Solution: Option (c)
7. S→AB
A→BB/ a
B→AB/ b
Choose incorrect statement?
A. aabbb can be derived from above grammar
B. aabb can be derived from above grammar
C. ababab can be derived from above grammar
D. abbb can be derived from above grammar
Solution: Option (b)
Explanation:
abb cannot be generated by C, whereas it is generated by all other regular expressions. Another
method to approach this:
(a) (a*+ b*a*)* , assume a* is epsilon then it is equal to (a*+b*)* == (a+b)* // as this is identity of
regular expression.
(b) (a*b*+b*a*)*(a*b*)* // assume all highlighted one is epsilon so this is again equal to (a+b)*
(d) (a+b)*a*b*a*b* // assume all highlighted one is epsilon so this is again equal to (a+b)*
But (c) ((ab)*+a*)* here you cannot make it equal to (a+b)* hence this is odd one.
8. One of the following Regular Expressions is not the same as others. Which one?
(a) (a* + b*a*)*
(c) ((ab)* + a*)*
(b) (a*b* + b*a*)* (a*b*)*
(d) (a + b)* a*b*a*b*
Solution: Option (c)
Explanation:
abb cannot be generated by C, whereas it is generated by all other regular expressions.
Hence If L is CFL then its complement L' may or may not be CFL.
As every CFL is CSL also, so we can assume CFL as CSL.
As CSL is closed under complement so complement of CSL must be CSL
11. Consider the regular grammar generating the set of all strings ending with ‘00’, with terminals
{0,1} and non-terminals {S, A, B}, S being the initial state and B, the final state.
S 1S/ 0A
A → 0B
B → 0B/1S/0
The production missing is
(a) A → 1S
(c) A → 1B
(b) B → ε
(d) S → 1B
Solution: Option (a)
Explanation:
12. What are the number of states needed in minimal DFA, that accepts (1+1111)*, with 1 as
alphabet.
(a) 5
(c) 1
(b) 4
(d) None
Solution: Option (c)
Explanation:
The language is 1*.
16. Let ∑= {a}, assume language, L= {a 2012.K / K> 0}, what is minimum number of states
needed in a DFA to recognize L?
(a) 2 2012 + 1
(c) 2 2013
(b) 2013
(d) None
Solution: Option (b)
Explanation:
Let M 1 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 M 1 be L 1 . Choose correct statement:
(a) L 1 = L
(b) L 1 ∩ L 2 = Φ
(c) L 1 ⊆ L 2
(d) L 1 = (0+ 1) *
Solution: Option (d)
Explanation:
By interchanging final and non-final states, we get L 1 = (0 + 1) ∗ .
20. Let M= (Q, ∑, δ, S, F) and M’= (Q, ∑, δ, S, Q – F) where M accepts L and M’ accepts L 1 and
M is NFA, what could be the relation between L and L’ ?
(a) L and L’ are complement to each other
(b) L and L’ are similar to each other
(c) L and L’ relation cannot be predicted
(d) None of the above
Solution: Option (c)
M is an NFA where set F is final state and M' we have Q-F final state, means all the non final state
in NFA M are final states in NFA, M'.
In other words this question says that if we complement an NFA (change all non final states into
final states and vice versa) which accept language L, then do we get automata which accept L' ?
The answer is no in NFA its not true while if M is DFA then it is true. The reason is NFA don't have
dead states so even though if we change all non final states in NFA but the dead state will be not
present hence some string which is suppose to accept in L' will be missed.
If M is a DFA and if language accepted by DFA is L then if we make every non final state as final
state and every final state as non final state then the DFA after modification will accept L' (i.e.
complement of L)\
But M is an NFA and changing final state to non final state and vice versa will not work here ,
hence L and L' don't have any relation.
21.
24. The string for which the grammar has maximum of two derivation trees is:
(a) lion tiger lion
(c) tiger lion
(b) lion tiger
(d) None of the above
Solution: Option (d)