You are on page 1of 29

Practice QUESTIONS

which one is the smallest DFA ?

a)

b)

c)

d)None of the above

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
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

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

The output in moore machine depends upon ?

a) The current state


b) The input
c) Both a and b
d) None of the above
Answer : a

The output in mealy machine depends upon ?

a) The current state


b) The input
c) Both a and b
d) None of the above
Answer : c
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

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

How many number of states are there in a minimal DFA that accepts the language,

L= {0m 1n / m,n > 0 } using ∑={0,1} ?

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

Finite automata requires minimum ___ number of stacks.

a) 1

b) 0

c) 2
d) None of the mentioned Answer : b

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

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

From the given DFA which string is accepted


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

answer : a

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

a)

b)

c)

d) None of these
Which string is accepted by DFA

a) an

b) anbn

c) anbncn

1)c

2) a ,b

3) a,b,c

4) a

Answer : 4

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

δ(q,ya) is equivalent to .

a) δ((q,y),a)

b) δ(δ(q,y),a)

c) δ(q,ya)
d) independent from δ notation

answer: b

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)

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

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
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

The relation between NFA-accepted languages and DFA accepted languages is


a) >
b) <
c) =
d) <=
Answer : c
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

Answer : a

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
Answer : a

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

Present Next State Output


State 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

Answer : a

Find output string for the input string 1111 from the following Moore
Machine

Present Next State Output


State 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

Answer : a

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

At which state String 'aa' accepted

a) D
b) A
c) B
d) C
Answer : c
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

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)
Next State Output
Present a=0 a=1
State
->q1 q3 q20 0
q20 q1 q4 0
q21 q1 q4 1
q3 q21 q1 0
q4 q4 q3 1

b)

Present Next State Output


State 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 Next State Output
State 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 Next State Output


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

How many states are require to construct a minimal dfa from the given DFA

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

answer b

Q1

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- C

Q2

Q. The languages which cannot accept PDA________


A. REGULAR LANGUAGES
B. CONTEXT FREE
C. CONTEXT SENSITIVE
D. NONE.
Ans- C

Q3
Consider the production of the grammar
S → AA
A → aa
A → bb
Describe the language specified by the production grammar.
a) L = {aaaa, aabb, bbaa, bbbb}
b) L = {abab, abaa, aaab, baaa}
c) L = {aaab, baba, bbaa, bbbb}
d) L = {aaaa, abab, bbaa, aaab}
Ans A

Q4
Given a production grammar that specified language
L = {a ͥ b² ͥ / i ≥ 1}
a) {S → aSbb, S → abb}
b) {S → aSb, S → b}
c) {S → aA, S → b, A → b}
d) None of these
Ans A

Q5
Which of the following string can be obtained by language
L = {a ͥ b² ͥ / i ≥ 1}
a) aaabbbbbb
b) aabbb
c) abbabbba
d) aaaabbbabb
Ans A
Given a production grammar for the language L = {x/x ∈ (a, b)* , the number of
a’s in x is a multiple of 3}
a) {S → bS, S → b, S → aA, S → bA, A → aB, B → bB, B → aS, S → a}
b) {S → aS, S → bA, A → bB, B → bBa, B → bB}
c) {S → aaS, S → bbA, A → bB, B → ba}
d) None of these
Ans A

Q28

Let L1 = {aꜞ bʲ / i, j ≥ 1, i≠ j} and L2 = {aꜞ bʲ / i < j}, the union of L1 and L2 is


given by
a) {aꜞ bʲ / i > j ≥ 1}
b) {aꜞ bʲ / i, j ≥ 1}
c) {aꜞ bʲ / i > j ≥ 1}
d) {aꜞ bʲ / i, j ≥ 1, i≠ j}
Ans D

Given a production grammar for the language


L = {aꜞ bʲ / i, j ≥ 1, i≠ j}
a) {S → aS, S → aB, B → ab, A → aaB, B → b}
b) {S → A, S → C, A → aA, A → aB, B → aBb, B → ab, C → Cb, C → Bb}
c) {S → A, A → aA, A → aB, B → ab}
d) None of these
Ans B

Which of the following strings is not generated by the following grammar?


S → SaSbS|ε
a) aabb
b) abab
c) aababb
d) aaabbb
Answer: d

The production Grammar is {S->aSbb,S->abb} is


a) Type-3 grammar
b) Type-2 grammar
c) Type-1 grammar
d) Type-0 grammar
Answer: b
Explanation: As per the definition of type-2 grammar.

According to Chomsky classification, language of finite automata is.


a) Type 0
b) Type 1
c) Type 2
d) Type 3
Answer: d

CFG

A context free grammar G is in Chomsky normal form if every production is of


the form
a) A → BC or A → A
b) A → BC or A → a
c) A → BCa or B → b
d) None of these
Ans A

A context free language is called ambiguous if


a) It has two or more leftmost derivations for some terminal string ѡ є L (G)
b) It has one or more leftmost derivations for some terminal string ѡ є L (G)
c) Both (a) and (b)
d) None of these
Ans a
Which of the following statement is false?
a) The context free language can be converted into Chomsky normal form
b) The context free language can be converted into Greibach normal form
c) The context free language is accepted by pushdown automata
d) None of these
Ans D
The context free grammar S → SS | 0S1 | 1S0 | ɛ generates
a) Unequal number of 0’s and 1’s
b) Equal number of 0’s and 1’s
c) Any number of 0’s followed by any number of 1’s
d) None of these
Ans B

Chomsky normal form

Every grammar in Chomsky Normal Form is:


a) regular
b) context sensitive
c) context free
d) all of the mentioned
Answer: c

Which of the production rule can be accepted by Chomsky grammar?


a) A->BC
b) A->a
c) S->e
d) All of the mentioned
Answer: d
Given grammar G:
(1)S->AS
(2)S->AAS
(3)A->SA
(4)A->aa
Which of the following productions denies the format of Chomsky Normal Form?
a) 2,4
b) 1,3
c) 1, 2, 3, 4
d) 2, 3, 4
Answer: a

Which of the following grammars are in Chomsky Normal Form:


a) S->AB|BC|CD, A->0, B->1, C->2, D->3
b) S->AB, S->BCA|0|1|2|3
c) S->ABa, A->aab, B->Ac
d) All of the mentioned
Answer: a

Greibach normal form

The format: A->aB refers to which of the following?


a) Chomsky Normal Form
b) Greibach Normal Form
c) Backus Naur Form
d) None of the mentioned
Answer: b

Which of the following does not have left recursions?


a) Chomsky Normal Form
b) Greibach Normal Form
c) Backus Naur Form
d) All of the mentioned
Answer: b

While converting the context free grammar into Greibach normal form, which of
the following is not necessary
a) Elimination of null production
b) Elimination of unit production
c) Converting given grammar in Chomsky normal form
d) None of these
Ans D
The variable which produces an epsilon is called:
a) empty variable
b) nullable
c) terminal
d) all of the mentioned
Simplification of grammar
The use of variable dependency graph is in:
a) Removal of useless variables
b) Removal of null productions
c) Removal of unit productions
d) None of the mentioned
Answer: a
Simplify the given grammar:
S->aXb
X->aXb | e
a) S->aXb | ab, X-> aXb | ab
b) S->X | ab, X-> aXb | ab
c) S->aXb | ab, X-> S | ab
d) None of the mentioned
Answer: a

Consider the following grammar:


A->e
B->aAbC
B->bAbA
A->bB
The number of productions added on the removal of the nullable in the given
grammar:
a) 3
b) 4
c) 2
d) 0
Answer: b

Context free languages are applied in _________

a. Parser Design
b. DFA
c. NFA
d. None of the above

A derivation A w is a ________________________ if we apply production to


the rightmost variable at every step
a. Rightmost derivation
b. Leftmost derivation
c. Both (a) and (b)
d. None of the above

Let Grammar G = ({S}, {a,b,+,*}, P, S), where P consists of S->S+S | S*S |a| b.
What will be the possible derivation trees for the yield

a.

b.

c. Both (a) and (b)


d. None of the above
----------------
------

a. Non Terminal String


b. Terminal String
c. Both (a) and (b)
d. None of the above\

a. ({S, A, B, E}, {a,b,c}, { S-> AB, A->a, B->b, E->c}, S)


b. ({S, A, B,C, E}, {a,b,c}, { S-> AB, A->a, B->ab, E->c}, S)
c. ({S, A, B,C, E}, {a,b,c}, { S-> AB, A->ba, B->b, B->C,E->c}, S)
d. None of the above

a. ({S,A, B,D}, {a,b}, { S->aS, S->AB, S->Sa, S->A, S->b, D->b},S)


b. ({S,A, B,D}, {a,b}, { S->aSS, S->AB, S->a, S->A, S->B, D->b},S)
c. ({S,A, B,D}, {a,b}, { S->aS, S->AB, S->ba, S->A, S->B, D->a},S)
d. ({S,A, B,D}, {a,b}, { S->aS, S->AB, S->a, S->A, S->B, D->b},S)

a. ({S,A,B,C}, {a,b}, {S->CA, A->a, B->bb}, S)


b. ({S,A,C}, {a,b}, {S->CA, C->a, A->bb}, S)
c. ({S,A,C}, {a,b}, {S->CA, A->a, C->b}, S)
d. ({S,A,C}, {a,b}, {S->CA, B->A, C->b}, S)

a. ({S,A,E,C}, {a,b}, {S->aaAa,A->Sb |bCC, C->abb}, S)


b. ({S,A,C}, {a,b}, {S->aAa, A->Sb |bCC, C->abb}, S)
c. ({S,A,C,E}, {a,b}, {S->aAa,A->Sb |bCC,E->abC C->abb}, S)
d. ({S,A,D}, {a,b}, {S->aAa, A->SBb |bCC, D->aDA}, S)

A grammar in CNF, the derivation tree has the following property: Every node has
atmost two descendants

a. Either single internal vertice or a single leaf


b. Either two internal vertices or two leaves
c. Either two internal vertices or a single leaf
d. Either single internal vertice or two leaves

Pumping Lemma for Context Free language prove that certain languages are

a. Context Free
b. Not Regular
c. Not Context Free
d. Regular

An initial ID is (q0,x,Z0). This means that initially the PDA is in the initial state q0,
the input string to be processed is

a. x
b. q0
c. Z0
d. None of the above

Top down parsing is equivalent to finding a

a. Rightmost Derivation
b. Leftmost Derivation
c. Both (a) & (b)
d. None of the above

Answer: a

answer: b

answer: d

answer: a
answer:a

The technique of avoiding non determinism is called _____________________

a. Left recursion
b. Left Factoring
c. Both (a) & (b)
d. None of the above

For constructing ID in Turing Machine, we simply insert the current state in the
___________________ to the left of the symbol under the R/W head

a. Input string
b. Output string
c. Both (a) & (b)
d. None of the above

Below mentioned turing machine is used to obtain


a. Sequence of the input string 00
b. Sequence of M for processing the input string 0011
c. Both (a) and (b)
d. None of the above

Consider the Turing Machine M described by the transition table given below and
check which of the following string is accepted by M

a. 011
b. 001
c. 0011
d. 0111

Consider the Turing machine given below and recognize which type of string it
will accept

a. {1n2n3n | n≥1}
b. {2n3n1n | n≥1}
c. {3n 2n1n | n≥1}
d. All of the above

A linear bounded automaton is a _____________________ which has a single tape


whose length is not infinite but bounded by a linear function of the length of the
input string

a. Nondeterministic Turing machine


b. Deterministic Turing Machine
c. Nondeterministic Finite Automata
d. Deterministic Finite Automata
Consider the Turing machine given below and recognize which type of string it
will accept

a. Copies strings of 1’s


b. Copies Strings of a’s
c. All strings over {0,1} ending with 010
d. All of the above

You might also like