0% found this document useful (0 votes)
52 views16 pages

FLA Unit 1 - Question Bank

The document consists of a series of questions and answers related to formal languages, automata theory, and regular expressions. It covers topics such as regular languages, finite state machines, DFA, NFA, and various properties of languages. The questions are designed to test knowledge on concepts like pumping lemma, state transitions, and language complements.
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)
52 views16 pages

FLA Unit 1 - Question Bank

The document consists of a series of questions and answers related to formal languages, automata theory, and regular expressions. It covers topics such as regular languages, finite state machines, DFA, NFA, and various properties of languages. The questions are designed to test knowledge on concepts like pumping lemma, state transitions, and language complements.
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/ 16

lOMoARcPSD|29703923

UNIT I- PART A
1. 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
2. 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
3. Given: ∑= {a, b} L= {xϵ∑*|x is a string combination} ∑4 represents which among the
following
a){aa, ab, ba, bb}
b) {aaaa, abab, ε, abaa, aabb}
c) {aaa, aab, aba, bbb}
d) {ε}
4. Mealy and Moore machine can be categorized as:
a) Inducers
b) Transducers
c) Turing Machines
d) Linearly Bounder Automata
5. A Language for which no DFA exist is a________
a) Regular Language
b) Non-Regular Language
c) May be Regular
d) Cannot be said
6. Which of the following is not an example of finite state machine system?
a) Control Mechanism of an elevator

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

b) Combinational Locks
c) Traffic Lights
d) Digital Watches
7. Numbers of states require to accept string ends with 10.
a) 3
b) 2
c) 1
d) 0
8. L1= {w | w does not contain the string tr }
L2= {w | w does contain the string tr}
Given ∑= {t, r}, The difference of the minimum number of states required to form L1
and L2?
a) 0
b) 1
c) 2
d) Infinite
9. 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
10. Given Language: {x | it is divisible by 3}
The total number of final states to be assumed in order to pass the number constituting
{0, 1} is
a) 0
b) 1
c) 2
d) 3

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

11. 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) (0+1)*
12. Which among the following cannot be accepted by a regular grammar?
a) L is a set of numbers divisible by 2
b) L is a set of binary complement
c) L is a set of string with odd number of 0
d) L is a set of 0n1n
13. Consider the languages L1 = φ and L2 = {1}. Which one of the following represents
L*1∪ L*1 L*2?
(A) {∈}
(B) {∈, 1}
(C) φ
(D) 1*
14. 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
15. Transition function maps.
a) Σ * Q -> Σ
b) Q * Q -> Σ

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

c) Σ * Σ -> Q
d) Q * Σ -> Q
16. δ*(q,ya) is equivalent to .
a) δ((q,y),a)
b) δ(δ*(q,y),a)
c) δ(q,ya)
d) independent from δ notation
17. 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) xz
18. 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) p
19. Predict the analogous operation for the given language:
A: {[p, q] | p ϵ A1, q does not belong to A2}
a) A1-A2
b) A2-A1
c) A1.A2
d) A1+A2
20. e-transitions are
a) conditional
b) unconditional
c) input dependent
d) independent

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

21. RR* can be expressed in which of the forms:


a) R+
b) R-
c) R+ U R-
d) R
22. Simplify the following regular expression:
ε+1*(011) *(1*(011) *) *
a) (1+011) *
b) (1*(011) *)
c) (1+(011) *) *
d) (1011) *
23. Precedence of regular expression in decreasing order is
a) * , . , +
b) . , * , +
c) . , + , *
d) + , a , *
24. L and ~L are recursive enumerable then L is
a) Regular
b) Context free
c) Context sensitive
d) Recursive
25. Which of the following statements is false?
(A) Every NFA can be converted to an equivalent DFA
(B) Every non-deterministic Turing machine can be converted to an equivalent
deterministic Turing machine
(C) Every regular language is also a context-free language
(D) Every subset of a recursively enumerable set is recursive

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

UNIT I- PART B

1. If d is a final state, which of the following is correct according to the given diagram?

a) x=p, y=qr, z=s


b) x=p, z=qrs
c) x=pr, y=r, z=s
d) All of the mentioned
Answer: A
Explanation: The FSA accepts the string pqrs. In terms of pumping lemma, the string
pqrs is broken into an x portion an a, a y portion qr and a z portion s.
2. Which of the following one can relate to the given statement:
Statement: If n items are put into m containers, with n>m, then atleast one container must
contain more than one item.
a) Pumping lemma
b) Pigeon Hole principle
c) Count principle
d) None of the mentioned
Answer: B
Explanation: Pigeon hole principle states the following example: If there exists n=10
pigeons in m=9 holes, then since 10>9, the pigeonhole principle says that at least one
hole has more than one pigeon.
3. Statement 1: NFA computes the string along parallel paths.
Statement 2: An input can be accepted at more than one place in an NFA.

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

Which among the following options are most appropriate?


a) Statement 1 is true while 2 is not
b) Statement 1 is false while is not
c) Statement 1 and 2, both are true
d) Statement 1 and 2, both are false
Answer: C
Explanation: While the machine runs on some input string, if it has the choice to split, it
goes in all possible way and each one is different copy of the machine. The machine
takes subsequent choice to split further giving rise to more copies of the machine getting
each copy run parallel. If any one copy of the machine accepts the strings, then NFA
accepts, otherwise it rejects.
4. Statement 1: ε- transition can be called as hidden non-determinism.
Statement 2: δ (q, ε) = p means from q it can jump to p with a shift in read head.
Which among the following options is correct?
a) Statement 1 and 2, both are correct
b) Statement 1 and 2, both are wrong
c) Statement 1 is correct while Statement 2 is wrong
d) Statement 1 is wrong while Statement 2 is correct
Answer: C
Explanation: The transition with ε leads to a jump but without any shift in read head.
Further, the method can be called one to introduce hidden non-determinism.
5. Reverse of a DFA can be formed by
a) using PDA
b) making final state as non-final
c) making final as starting state and starting state as final state
d) Not possible
Answer: C
Explanation: By making final state as starting state string starting from end will be
accepted.
6. Which among the following looks similar to the given expression?
((0+1). (0+1)) *

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

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
Explanation: The given regular expression corresponds to a language of binary strings
which is of even length including a length of 0.
7. Generate a regular expression for the following problem statement:
Password Validation: String should be 8-15 characters long. String must contain a
number, an Uppercase letter and a Lower case letter.
a) ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,15}$
b) ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{9,16}$
c) ^(?=.[a-z])(?=.[A-Z])(?=.\d).{8,15}$
d) None of the mentioned
Answer: A
Explanation: Passwords like abc123, 123XYZ, should not be accepted . If one also
wants to include special characters as one of the constraint, one can use the following
regular expression:
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-za-Z]).{8,15}$
8. 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

9. Consider the DFA given.

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

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 {0,1} of length at least 2
(A) 1 and 3 only
(B) 2 and 4 only
(C) 2 and 3 only
(D) 3 and 4 only
Answer: (D)
Explanation: 1 is true. L(A) is regular, its complement would also be regular. A regular
language is also context free.
2 is true.
3 is false, the DFA can be minimized to two states. Where the second state is final state
and we reach second state after a 0.
4 is clearly false as the DFA accepts a single 0.

10. Consider the following Deterministic Finite Automata

Which of the following is true?


(A) It only accepts strings with prefix as “aababb”

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

(B) It only accepts strings with substring as “aababb”


(C) It only accepts strings with suffix as “aababb”
(D) None of the above
Answer: (B)
Explanation:
To reach the accepting state, any string will have to go through edges having aababb as
labels in order. Though it might not be a continuous substring, but it sure will be a
substring. There might be some cases where same substring always exists as a prefix or
suffix for some DFA, but in this situation we don’t have to consider those cases, given
this question has single choice answer.
− > O − a− > O − a− > O − b− > O − a− > O − b− > O − b− > O
Hence, correct answer should be (B).
UNIT I- PART C
1. Consider the set of strings on {0,1} in which, every substring of 3 symbols has at most
two zeros. For example, 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.

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

The missing arcs in the DFA are

a. A
b. B
c. C
d. 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 follow these rules.

2. What is the complement of the language accepted by the NFA shown below? Assume ∑
= {a} and ε is the empty string

(A) Φ
(B) ε

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

(C) a
(D) {a, ε}
Answer (B)
Explanation: 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.
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?

(A) A
(B) B

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

(C) C
(D) D

Answer: (A)
Explanation: 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 “bba” which are not
accepted by given DFA.

4. Which one of the following is FALSE?


(A) There is unique minimal DFA for every regular language
(B) Every NFA can be converted to an equivalent PDA.
(C) Complement of every context-free language is recursive.
(D) Every nondeterministic PDA can be converted to an equivalent deterministic PDA.

Answer: (D)
Explanation: Power of Deterministic PDA is not same as the power of Non-
deterministic PDA. Deterministic PDA cannot handle languages or grammars with
ambiguity, but NDPDA can handle languages with ambiguity and any context-free
grammar. So every non-deterministic PDA can not be converted to an equivalent
deterministic PDA.
5.

(A) {q0, q1, q2}


(B) {q0, q1}
(C) {q0, q1, q2, q3}

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

(D) {q3}

Answer: (A)
Explanation:

So, q0, q1 and q2 are reachable states for the input string 0011, but q3 is not.
So, option (A) is answer.
6. Consider the machine M:

The language recognized by M is :

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

(A) {w ∈ {a, b}* / every a in w is followed by exactly two b’s}


(B) {w ∈ {a, b}* every a in w is followed by at least two b’}
(C) {w ∈ {a, b}* w contains the substring ‘abb’}
(D) {w ∈ {a, b}* w does not contain ‘aa’ as a substring}

Answer: (B)
Explanation:
Here w ∈ {a, b}* means w can be any string from the set of {a, b}* and {a, b}* is set of
all strings composed of a and b (any string of a and b that you can think of) like null, a, b,
aaa, abbaaa, bbbbb, aaaaa, aaaabbbbaabbababab etc.
These type of questions are frequently asked in GATE, where it is asked to choose best
fit language among the options. To slove the question like this, there is a better way, we
try to eliminate wrong options by choosing testing strings intelligently until we are left
with one right option.As given in question, let’s we try to eliminate option (A), it
recognizes only those string (composed of a and b) in which every a in w is followed by
exactly two b’s , so if we take string abbb(three b’s), then it is accepted by machine , so
this options is wrong. Now we try to eliminate option (C), it recognizes only those
strings(composed of a and b) in which w contains the substring ‘abb’, so if we take string
abbaa (has substring abb), then it is not accepted by machine, so this options is also
wrong. Now we try to eliminate option (D), it recognizes only those string(composed of a
and b) in which w does not contains ‘aa’ as a substring , so if we take string abbaba(‘aa’
not as a substring), then it is not accepted by machine ,so this options is also wrong. Only
option with which we are left, is option (b) in which every a in w is followed by at least
two b’ ,is correct. So answer is option (B).
7. The following finite state machine accepts all those binary strings in which the number of
1’s and 0’s are respectively.

Downloaded by Gaurav ([email protected])


lOMoARcPSD|29703923

(A) divisible by 3 and 2


(B) odd and even
(C) even and odd
(D) divisible by 2 and 3

Answer: (A)
Explanation:
Option (B) is eliminated because string 100 contains odd number of 1s and even number
of 0s but is not accepted by the DFA.
Option(C) is eliminated because string 011 contains even number of 1s and odd number
of 0s but is not accepted by the DFA.
Option (D) is eliminated because string 11000 has number of 1s divisible by 2 and
number of 0s divisible by 3 but still not accepted by the DFA.
Option (A) accepts all strings with number of 1s divisible by 3 and number of 0s divisible
by 2.

Downloaded by Gaurav ([email protected])

You might also like