0% found this document useful (0 votes)
239 views50 pages

Nikhil

The document discusses various concepts related to formal languages and automata theory such as Boolean operations on languages, regular expressions, finite automata, context-free grammars, pumping lemma, and decidability of problems. Some key points include: - Regular expressions can be used to define regular languages and describe Boolean operations like union and complement. - Finite automata are machines that accept or reject strings in a language. Non-deterministic finite automata can have multiple transitions from a state. - Context-free grammars generate context-free languages through rewrite rules involving terminals and non-terminals. Chomsky normal form is a restriction on the form of productions. - Pumping lemma is a tool to prove that certain languages are

Uploaded by

Sachin Gupta
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)
239 views50 pages

Nikhil

The document discusses various concepts related to formal languages and automata theory such as Boolean operations on languages, regular expressions, finite automata, context-free grammars, pumping lemma, and decidability of problems. Some key points include: - Regular expressions can be used to define regular languages and describe Boolean operations like union and complement. - Finite automata are machines that accept or reject strings in a language. Non-deterministic finite automata can have multiple transitions from a state. - Context-free grammars generate context-free languages through rewrite rules involving terminals and non-terminals. Chomsky normal form is a restriction on the form of productions. - Pumping lemma is a tool to prove that certain languages are

Uploaded by

Sachin Gupta
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/ 50

(1) For a given input, it provides the compliment of Boolean AND output.

NAND box (NOT AND)


DELAY box
OR box
AND box

(2) It delays the transmission of signal along the wire by one step (clock pulse).

NAND box (NOT AND)


DELAY box
OR box
AND box

(3) For the given input, it provides the Boolean OR output

NAND box (NOT AND)


DELAY box
OR box
AND box

(4) For the given input, AND box provides the Boolean AND output.
True
False

(5) The current in the wire is indicated by 1 and 0 indicates the absence of the current.
True
False

(6) Any language that can not be expressed by a RE is said to be regular language.
True
False

(7) If L1 and L2 are regular languages is/are also regular language(s).

L1 + L2
L1L2
L1
All of above

(8) Let L be a language defined over an alphabet Σ, then the language of strings, defined over
Σ, not belonging to L, is called Complement of the language L, denoted by Lc or L’.
True False

(9) To describe the complement of a language, it is very important to describe the ----------- of
that language over which the language is defined.

Alphabet
Regular Expression
String
Word

(10) For a certain language L, the complement of Lc is the given language L i.e. (Lc)c = Lc
True
False

(11) If L is a regular language then, --------- is also a regular language.


Lm
Ls
Lx
Lc
(12) Converting each of the final states of F to non-final states and old non-final states of F to final
states, FA thus obtained will reject every string belonging to L and will accept every string, defined
over Σ, not belonging to L. is called

Transition Graph of L
Regular expression of L
Complement of L
Finite Automata of L

(13) If L1 and L2 are two regular languages, then L1 U L2 is not a regular.


True
False

(14) De-Morgan's law for sets is expressed by,

(15) If L1 and L2 are regular languages, then these can be expressed by the corresponding FAs.
True
False

(16) L= language of words containing even number of a’s. Regular Expression is

(a+b)aa(a+b)
(b+aba)
a+bbaaba
(a+b)ab(a+b)

(17) The regular expression defining the language L1 U L2 can be obtained, converting and
reducing the previous ------------- into a ------------ as after eliminating states.

GTG, TG
FA, GTG
FA, TG
TG, RE

(18) The language that can be expressed by any regular expression is called a Non regular
language.
True
False

(19) The languages -------------- are the examples of non regular languages.

PALINDROME and PRIME


PALINDROME and EVEN-EVEN
EVEN-EVEN and PRIME
FACTORIAL and SQURE
(20) Let L be any infinite regular language, defined over an alphabet Σ then there exist three
strings x, y and z belonging to Σsuch that all the strings of the form XY^ n Z for n=1,2,3, … are
the words in L. called.

Complement of L
Pumping Lemma
Kleene’s theorem
None in given

(21) Languages are proved to be regular or non regular using pumping lemma.
True
False

(22) ------------------- is obviously infinite language.


EQUAL-EQUAL
EVEN-EVEN
PALINDROME
FACTORIAL

(23) If, two strings x and y, defined over Σ, are run over an FA accepting the language L, then x
and y are said to belong to the same class if they end in the same state, no matter that state is
final or not.
True
False

Myhill Nerode theorem is consisting of the followings,

L partitions Σinto distinct classes.


If L is regular then, L generates finite number of classes.
If L generates finite number of classes then L is regular.
All of above

The language Q is said to be quotient of two regular languages P and R, denoted by--- if
PQ=R.
R=Q/P
Q=R/P
Q=P/R
P=R/Q

If two languages R and Q are given, then the prefixes of Q in R denoted by Pref(Q in R).
True
False

(27) Let Q = {aa, abaaabb, bbaaaaa, bbbbbbbbbb} and R = {b, bbbb, bbbaaa,
bbbaaaaa}
Pref (Q in R) is equal to,

{b,bbba,bbbaaa}
{b,bba,bbaaa}
{ab,bba,bbbaa}
{b,bba,bbba}

If R is regular language and Q is any language (regular/ non regular), then Pref (Q in R) is ---------
.

Non-regular
Equal
Regular
Infinite

"CFG" stands for _________


Context Free Graph
Context Free Grammar
Context Finite Graph
Context Finite Grammar

(29) ___________ states are called the halt states.

ACCEPT and REJECT


ACCEPT and READ
ACCEPT AND START
ACCEPT AND WRITE

(30) The part of an FA, where the input string is placed before it is run, is called _______

State
Transition
Input Tape
Output Tape

In new format of an FA (discussed in lecture 37), This state is like dead-end non final state

ACCEPT
REJECT
STATR
READ

For language L defined over {a, b}, then L partitions {a, b}into …… classes

Infinite
Finite
Distinct
Non-distinct

The major problem in the earliest computers was

To store the contents in the registers


To display mathematical formulae
To load the contents from the registers
To calculate the mathematical formula

Between the two consecutive joints on a path

One character can be pushed and one character can be popped


Any no. of characters can be pushed and one character can be popped
One character can be pushed and any no. of characters can be popped
Any no. of characters can be pushed and any no. of characters can be popped

(35) In pumping lemma theorem (x y^n z) the range of n is

n=1, 2, 3, 4……….
n=0, 1, 2, 3, 4……….
n=…….-3,-2,-1, 0, 1, 2, 3, 4……
n=…….-3,-2,-1, 1, 2, 3, 4……

(36) The PDA is called non-deterministic PDA when there are more than one out going edges
from……… state

START or READ
POP or REJECT
READ or POP
PUSH or POP

Identify the TRUE statement:

A PDA is non-deterministic, if there are more than one READ states in PDA
A PDA is never non-deterministic
Like TG, A PDA can also be non-deterministic
A PDA is non-deterministic, if there are more than one REJECT states in PDA

There is a problem in deciding whether a state of FA should be marked or not when the language
Q is infinite.

True
False

If an effectively solvable problem has answered in yes or no, then this solution is called ---------

Decision procedure
Decision method
Decision problem
Decision making

The following problem(s) ------------- is/are called decidable problem(s).

The two regular expressions define the same language


The two FAs are equivalent
Both a and b
None of given

To examine whether a certain FA accepts any words, it is required to seek the paths from -------
state.

Final to initial
Final to final
Initial to final
Initial to initial

The high level language is converted into assembly language codes by a program called compiler.

TRUE
FALSE

Grammatical rules which involve the meaning of words are called ---------------

Semantics
Syntactic
Both a and b
None of given

Grammatical rules which do not involve the meaning of words are called ---------------

Semantics
Syntactic
Both a and b
None of given

The symbols that can’t be replaced by anything are called -----------------


Productions
Terminals
Non-terminals
All of above
The symbols that must be replaced by other things are called __________

Productions
Terminals
Non-terminals
None of given

(47) The grammatical rules are often called_____________

Productions
Terminals
Non-terminals
None of given

The terminals are designated by ________ letters, while the non-terminals are designated by
________ letters.

Capital, bold
Small, capital
Capital, small
Small, bold

The language generated by __________ is called Context Free Language (CFL).

FA
TG
CFG
TGT

(49) Σ = {a,b} Productions S→XaaX X→aX X→bX X→Λ


This grammar defines the language expressed by___________

(a+b)aa(a+b)
(a+b)a(a+b)a
(a+b)aa(a+b)aa
(a+b)aba+b)

(50) S → aXb|b XaX → aX|bX|Λ The given CFG generates the language in English __________

Beginning and ending in different letters


Beginning and ending in same letter
Having even-even language
None of given

(51) The CFG is not said to be ambiguous if there exists atleast one word of its language that
can be generated by the different production trees,

TRUE
FALSE

The language generated by that CFG is regular if _________

No terminal → semi word


No terminal → word
Both a and b
None of given

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

TRUE
FALSE
(54) A production is called null able production if it is of the form N → Λ

TRUE
FALSE

(55) The productions of the form nonterminal → one nonterminal, is called _________

Null production
Unit production
Null able production
None of given

(56) CNF is stands for

Context Normal Form


Complete Normal Form
Chomsky Normal Form
Compared Null Form

Proof(Kleene’s Theorem Part II)


If a TG has more than one start states, then

Introduce the new start state


Eliminate the old start state
Replace the old start state with final state
Replace the old final state with new start state

Question # 2
While finding RE corresponding to TG, we connect the new start state to the old start state by the
transition labeled by
Select correct option:
a
b
null string
None of the given options

Question # 3 of 10 ( Start time: 05:49:03 PM ) Total Marks: 1


Which of the following regular expression represents same language? a. (a+ab)b. (ba+a)c.
a(aab)d. (ab)
a+b)a(a+b)b(a+b)+ (a+b)b(a+b)a(a+b).

{ x}, { x}+, {a+b}

Select correct option:


a and b
a and c
c and d

Question # 4 of 10 ( Start time: 05:50:32 PM ) Total Marks: 1


(a+ b)= (a + b)this expression is __________
Select correct option:
True
False

Question # 5 of 10 ( Start time: 05:51:30 PM ) Total Marks: 1


Let FA3 be an FA corresponding to FA1+FA2, then the initial state of FA3 must correspond to the
initial state of
Select correct option:
FA1 only
FA2 only
FA1 or FA2
FA1 and FA2
Question # 6 of 10 ( Start time: 05:53:01 PM ) Total Marks: 1
Which of the following statement is NOT true about TG?
Select correct option:
There exists exactly one path for certain string
There may exist more than one paths for certain string
There may exist no path for certain string
There may be no final state

Question # 7 of 10 ( Start time: 05:54:06 PM ) Total Marks: 1


Kleene’s theorem states
Select correct option:
All representations of a regular language are equivalent.
All representations of a context free language are equivalent.
All representations of a recursive language are equivalent
Finite Automata are less powerful than Pushdown Automata.

Question # 8 of 10 (Start time: 05:55:36 PM) Total Marks: 1


What do automata mean?
Select correct option:
Something done manually
Something done automatically

Question # 9 of 10 ( Start time: 05:56:51 PM ) Total Marks: 1


A language accepted by an FA is also accepted by
Select correct option:
TG only
GTG only
RE only
All of the given

Question # 10 of 10 ( Start time: 05:58:16 PM ) Total Marks: 1


If r1 = (aa + bb) and r2 = (a + b) then the language (aa + bb)(a + b) will be generated by
Select correct option:
(r1)(r2)
(r1 + r2)
(r2)(r1)
(r1)

Question No: 1 ( Marks: 1 ) - Please choose one

If r1 = (aa + bb) and r2 = ( a + b) then the language (aa + bb)(a + b) will be generated by
► (r1)(r2)
► (r1 + r2)
► (r2)(r1)
► (r1)

Question No: 2 ( Marks: 1 ) - Please choose one

“One language can be expressed by more than one FA”. This statement is ______
► True
► False
► Some times true & sometimes false
► None of these

Question No: 3 ( Marks: 1 ) - Please choose one

Who did not invent the Turing machine?


► Alan Turing
► A. M. Turing
► Turing
► None of these
Question No: 4 ( Marks: 1 )- Please choose one

Which statement is true?


► The tape of turing machine is infinite.
► The tape of turing machine is finite.
► The tape of turing machine is infinite when the language is regular
► The tape of turing machine is finite when the language is nonregular.

Question No: 5 ( Marks: 1 ) - Please choose one

A regular language:
► Must be finite
► Must be infinite
► Can be finite or infinite
► Must be finite and cannot be infinite

Question No: 6 ( Marks: 1 ) - Please choose one

Every regular expression can be expressed as CFG but every CFG cannot be expressed as a
regular expression. This statement is:
► Depends on the language
► None of the given options
► True
► False

Question No: 7 ( Marks: 1 ) - Please choose one

Above given FA corresponds RE r. then FA corresponding to rwill be

This statement is
► True
► False
► Depends on language
► None of these

Question No: 8 ( Marks: 1 ) - Please choose one


Consider the language L of strings, defined over Σ = {a,b}, ending in a
► There are finite many classes generated by L, so L is regular
► There are infinite many classes generated by L, so L is regular
► There are finite many classes generated by L, so L is non-regular
► There are infinite many classes generated by L, so L is non-regular

Question No: 9 ( Marks: 1 ) - Please choose one

Above given TG has _____________ RE.


► (aa+aa+(ab+ab)(aa+ab)(ab+ba))
► (aa+bb+(ab+ba)(aa+bb)(ab+ba))
► (aa+bb+(ab+ba)(aa+bb)(ab+ba))
► None of these

Question No: 10 ( Marks: 1 ) - Please choose one

The word ‘formal’ in formal languages means


► The symbols used have well defined meaning
► They are unnecessary, in reality
► Only the form of the string of symbols is significant
► None of these

Question No: 11 ( Marks: 1 ) - Please choose one

Let A = {0, 1}. The number of possible strings of length ‘n’ that can be formed by the elements of
the set A is
► n!
► n2
► nm
► 2n

Question No: 12 ( Marks: 1 ) - Please choose one

Choose the correct statement.


► A Mealy machine generates no language as such
► A Moore machine generates no language as such
► A Mealy machine has no terminal state
► All of these

Question No: 13 ( Marks: 1 ) - Please choose one

TM is more powerful than FSM because


► The tape movement is confined to one direction
► It has no finite state control
► It has the capability to remember arbitrary long sequences of input symbols
► None of these

Question No: 14 ( Marks: 1 ) - Please choose one

If L1 and L2 are expressed by regular expressions r1 and r2, respectively then the language
expressed by r1 + r2 will be _________
► Regular
► Ir-regular
► Can’t be decided
► Another Language which is not listed here

Question No: 15 ( Marks: 1 ) - Please choose one

Like TG, a PDA can also be non-deterministic


► True
► False

Question No: 16 ( Marks: 1 ) - Please choose one

The above machine is a/anTG ___________


► Finite Automata
► Turing machine
► FA
► TG

Question No: 17 ( Marks: 1 ) - Please choose one

The language of all words (made up of a’s and b’s) with at least two a’s can not be described by
the regular expression.
► a(a+b)a(a+b)(a+b)ab
► (a+b)aba(a+b)
► baba(a+b)
► none of these

Question No: 18 ( Marks: 1 ) - Please choose one

In FA, if one enters in a specific state but there is no way to leave it, then that specific state is
called
► Dead State
► Waste Basket
► Davey John Locker
► All of these

Question No: 19 ( Marks: 1 ) - Please choose one

If L is a regular language then, Lc is also a _____ language.


► Regular
► Non-regular
► Regular but finite
► None of the given

Question No: 20 ( Marks: 1 ) - Please choose one

In CFG, the symbols that can’t be replaced by anything are called___


► Terminal
► Non-Terminal
► Production
► All of given

Question No: 21 ( Marks: 1 ) - Please choose one

Which of the following is NOT a regular language?


► String of 0’s whose length is a perfect squere
► Set of all palindromes made up of 0’s and 1’s
► String of 0’s whose length is a prime number
► All of the given options

Question No: 22 ( Marks: 1 ) - Please choose one

Choose the incorrect (FALSE) statement.


► A Mealy machine generates no language as such
► A Mealy machine has no terminal state
► For a given input string, length of the output string generated by a Moore machine is
not more than the length of the output string generated by that of a Mealy machine
► All of these

Question No: 23 ( Marks: 1 ) - Please choose one

Pumping lemma is generally used to prove that:


► A given language is infinite
► A given language is not regular
► Whether two given regular expressions of a regular language are equivalent or not
► None of these

Question No: 24 ( Marks: 1 ) - Please choose one

Which of the following is a regular language?


► String of odd number of zeroes
► Set of all palindromes made up of 0’s and 1’s
► String of 0’s whose length is a prime number
► All of these

Question No: 25 ( Marks: 1 ) - Please choose one

Choose the incorrect statement:


► (a+b)aa(a+b)generates Regular language.
► A language consisting of all strings over ∑={a,b} having equal number of a’s and b’s is a
regular language
► Every language that can be expressed by FA can also be expressed by RE
► None of these

Question No: 26 ( Marks: 1 ) - Please choose one

Left hand side of a production in CFG consists of:


► One terminal
► More than one terminal
► One non-terminal
► Terminals and non-terminals
1. Let S and T be language over ={a,b} represented by the regular expressions
(a+b*)* and (a+b)*, respectively. Which of the following is true? (GATE CS
2000)

(a) ScT (S is a subset of T)


(b) TcS (T is a subset of S)
(c) S=T
(d) SnT=Ø
Answer: (c).

2. Let L denotes the language generated by the grammar S – OSO/00. Which of


the following is true? (GATE CS 2000)
(a) L = O
(b) L is regular but not O
(c) L is context free but not regular
(d) L is not context free
Answer: (b)
Explanation: Please note that grammar itself is not regular but language L is regular
as L can be represented using a regular grammar, for example S -> S00/00.
References:
http://en.wikipedia.org/wiki/Regular_grammar

3. Consider the following two statements:


S1: { 0^2n |n >= l} is a regu1ar language
S2: { 0^m 0^n 0^(m+n) l m >= 1 and n >= 2} is a regu1ar language
Which of the following statements is correct? (GATE CS 2001)
a) Only S1 is correct
b) Only S2 is correct
c) Both S1 and S2 are correct
d) None of S1 and S2 is correct

Answer: (c)
Explanation:
S1 can be written as (00)^n where n >= 1. And S2 can be written as (00)^(m+n)
where m >=2 and n >= 1. S2 can be further reduced to (00)^x where x >= 3.
We can easily write regular grammars for both S1 and S2.
G1 -> G100/00 (For S1)
G2 -> G200/000000 (For S2)

4. Which of the following statements in true? (GATE CS 2001)


(a) If a language is context free it can always be accepted by a deterministic push-
down automaton
(b) The union of two context free languages is context free
(c) The intersection of two context free languages is context free
(d) The complement of a context free language is context free
Answer: (b)
Explanation:
Context-free languages are closed under the following operations. That is, if L and P
are context-free languages and D is a regular language, the following languages are
context-free as well:
• the Kleene star L * of L
• the image Ø(L) of L under a homomorphism Ø
• the concatenation of L and P
• the union of L and P
• the intersection of L with a regular language D (L n D).
Context-free languages are not closed under complement, intersection, or difference.
Why a) is not true?
The language recognized by deterministic pushdown automaton is deterministic
context free language. Not all context-free languages are deterministic. This is unlike
the situation for deterministic finite automata, which are also a subset of the
nondeterministic finite automata but can recognize the same class of languages (as
demonstrated by the subset construction).
References:
http://en.wikipedia.org/wiki/Context-free_language
http://en.wikipedia.org/wiki/Deterministic_pushdown_automaton

5. Given an arbitrary non-deterministic finite automaton (NFA) with N states,


the maximum number of states in an equivalent minimized DFA is at least.
(GATE CS 2001)
(a) N^2
(b) 2^N
(c) 2N
(d) N!
Answer: (b)
Following questions have been asked in GATE CS 2012 exam.
1) What is the complement of the language accepted by the NFA shown
below? Assume ∑ = {a} and ε is the empty string

(A) Φ
(B) ε
(C) a
(D) {a, ε}
Answer (B)
The given alphabet ∑ contains only one symbol {a} and the given NFA accepts all
strings with any number of occurrences of ‘a’. In other words, the NFA accepts a+.
Therefore complement of the language accepted by automata is empty string.

2) Given the language L = {ab, aa, baa}, whih of the following strings are in L*?
….1) abaabaaabaa
….2) aaaabaaaa
….3) baaaaabaaaab
….4) baaaaabaa
(A) 1, 2 and 3
(B) 2, 3 and 4
(C) 1, 2 and 4
(D) 1, 3 and 4
Answer (C)
Any combination of strings in set {ab, aa, baa} will be in L*.
….1) “abaabaaabaa” can be partitioned as a combination of strings in set {ab, aa,
baa}. The partitions are “ab aa baa ab aa”
….2) “aaaabaaaa” can be partitioned as a combination of strings in set {ab, aa, baa}.
The partitions are “aa ab aa aa”
….3) “baaaaabaaaab” cannot be partitioned as a combination of strings in set {ab,
aa, baa}
….4) “baaaaabaa” can be partitioned as a combination of strings in set {ab, aa, baa}.
The partitions are “baa aa ab aa”

3) Which of the following problems are decidable?


….1) Does a given program ever produce an output?
….2) If L is a context-free language, then is L’ (complement of L) also context-
free?
….3) If L is a regular language, then is L’ also regular?
….4) If L is a recursive language, then, is L’ also recursive?
(A) 1, 2, 3, 4
(B) 1, 2,
(C) 2, 3, 4
(D) 3, 4
Answer (D)
….1) Is a variation of Turing Machine Halting problem and it is undecidable.
….2) Context Free Languages are not closed under intersection and complement.
See this for details.
….3) Complement of Regular languages is also regular. Then a DFA that accepts
the complement of L, i.e. ∑* – L, can be obtained by swapping its accepting states
with its non-accepting states.
….4) Recursive Languages are closed under complement. See this for details.

4) Consider the set of strings on {0,1} in which, every substring of 3 symbols


has at most two zeros. For examples, 001110 and 011001 are in the language,
but 100010 is not. All strings of length less than 3 are also in the language. A
partially completed DFA that accepts this language is shown below.
The missing arcs in the DFA are

Answer (D)
State ‘q’ is trap state. All other states are accept states. In state 00, DFA must move
to ‘q’ for input symbol 0. All (non-trap) states indicate names indicate the characters
seen before reaching that particular state. Option (D) is the only option that follow
these rules.
Please see GATE Corner for all previous year paper/solutions/explanations,
syllabus, important dates, notes, etc.
Please write comments if you find any of the answers/explanations incorrect, or you
want to share more information about the topics discussed above.
1) The lexical analysis for a modern language such as Java needs the power of
which one of the following machine models in a necessary and sufficient
sense?
(A) Finite state automata
(B) Deterministic pushdown automata
(C) Non-deterministic pushdown automata
(D) Turing machine
Answer (A)
Lexical analysis is the first step in compilation. In lexical analysis, program is divided
into tokens. Lexical analyzers are typically based on finite state automata. Tokens
can typically be expressed as different regular expressions:
An identifier is given by [a-zA-Z][a-zA-Z0-9]*
The keyword if is given by if.
Integers are given by [+-]?[0-9]+.

2) Which of the following pairs have DIFFERENT expressive power?


(A) Deterministic finite automata (DFA) and Non-Deterministic finite automata(NFA)
(B) Deterministic push down automata (DPDA) and Non-deterministic pushdown
automata
(C) Deterministic single-tape Turing machine and Non-deterministic single-tape
Turing Machine
(D) Single-tape Turing machine and multi-tape Turing machine
Answer (B)
DPDA cannot handle languages or grammars with ambiguity, but NDPDA can
handle languages with ambiguity and any context-free grammar.

3) A deterministic finite automation (DFA)D with alphabet ∑= {a,b} is given


below

Which of the following finite state machines is a valid minimal DFA which
accepts the same language as D?
Answer (A)
Options (B) and (C) are invalid because they both accept ‘b’ as a string which is not
accepted by give DFA. D is invalid because it accepts bb+a which are not accepted
by given DFA.
Please see GATE Corner for all previous year paper/solutions/explanations,
syllabus, important dates, notes, etc.

Please write comments if you find any of the answers/explanations incorrect, or you
want to share more information about the topics discussed above.
1) Let P be a regular language and Q be context-free language such that Q ⊆ P.
(For example, let P be the language represented by the regular expression p*q*
and Q be {pnqn|n ∈ N}). Then which of the following is ALWAYS regular?
(A) P ∩ Q
(B) P – Q
(C) ∑* – P
(D) ∑* – Q
Answer (C)
The expression ∑* – P represents complement of P which is a regular language.
Complement of Regular languages is also regular. Then a DFA that accepts the
complement of L, i.e. ∑* – L, can be obtained by swapping its accepting states with
its non-accepting states.

2) Consider the language L1,L2,L3 as given below.


L1={0p1q | p,q ∈ N}
L2={0p1q| p,q ∈ N and p=q}
L3={0p1q0r | p,q,r ∈N and p=q=r}
Which of the following statements is NOT TRUE?
(A) Push Down Automata (PDA) can be used to recognize L1 and L2
(B) L1 is a regular language
(C) All the three languages are context free
(D) Turing machine can be used to recognize all the three languages
Answer (C)
The language L3 is not context free. Refer this for more details.

3)Definition of a language L with alphabet {a} is given as following. L= { ank | k >


0, and n is a positive integer constant} What is the minimum number of states
needed in a DFA to recognize L?
(A) k+1
(B) n+1
(C) 2n+1
(D) 2k+1
Answer (B)
Note that n is a constant and k is any positive integer. For example, if n is given as 3,
then the DFA must be able to accept 3a, 6a, 9a, 12a, .. To build such a DFA, we
need 4 states.

Please see GATE Corner for all previous year paper/solutions/explanations,


syllabus, important dates, notes, etc.
Please write comments if you find any of the answers/explanations incorrect, or you
want to share more information about the topics discussed above.
1) S –> aSa| bSb| a| b ;The language generated by the above grammar over the
alphabet {a,b} is the set of
(A) All palindromes.
(B) All odd length palindromes.
(C) Strings that begin and end with the same symbol
(D) All even length palindromes.
Answer (B)
The strings accepted by language are {a, b, aaa, bbb, aba, bab, ..}. All of these
strings are odd length palindromes.

2) Which one of the following languages over the alphabet {0,1} is described
by the regular expression: (0+1)*0(0+1)*0(0+1)*?
(A) The set of all strings containing the substring 00.
(B) The set of all strings containing at most two 0’s.
(C) The set of all strings containing at least two 0’s.
(D) The set of all strings that begin and end with either 0 or 1.
Answer (C)
The regular expression has two 0’s surrounded by (0+1)* which means accepted
strings must have at least 2 0’s.

3) 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)
Deterministic PDA cannot handle languages or grammars with ambiguity, but
NDPDA can handle languages with ambiguity and any context-free grammar. So
every nondeterministic PDA can not be converted to an equivalent deterministic
PDA.
4) Match all items in Group 1 with correct options from those given in Group 2.
Group 1 Group 2
P. Regular expression 1. Syntax analysis
Q. Pushdown automata 2. Code generation
R. Dataflow analysis 3. Lexical analysis
S. Register allocation 4. Code optimization

(A) P-4. Q-1, R-2, S-3


(B) P-3, Q-1, R-4, S-2
(C) P-3, Q-4, R-1, S-2
(D) P-2, Q-1, R-4, S-3
Answer (B)

5) . Let L = L1 ∩ L2, where L1 and L2 are languages as defined below:


L1 = {ambmcanbn | m, n >= 0 }
L2 = {aibjck | i, j, k >= 0 }
Then L is
(A) Not recursive
(B) Regular
(C) Context free but not regular
(D) Recursively enumerable but not context free.
Answer (C)
The language L1 accept strings {c, abc, abcab, aabbcab, aabbcaabb, …} and L2
accept strings {a, b, c, ab, abc, aabc, aabbc, … }. Intersection of these two
languages is L1 ∩L2 = {akbkc | k >= 0} which is context free, but not regular.
Please see GATE Corner for all previous year paper/solutions/explanations,
syllabus, important dates, notes, etc.
Please write comments if you find any of the answers/explanations incorrect, or you
want to share more information about the topics discussed above.
1) Let L={w ∈ (0 + 1)*|w has even number of 1s}, i.e. L is the set of all bit strings
with even number of 1s. Which one of the regular expression below represents
L?
(A) (0*10*1)*
(B) 0*(10*10*)*
(C) 0*(10*1*)*0*
(D) 0*1(10*1)*10*
Answer (B)
Option (A) is incorrect because it cannot accept “110”
Option (C) is incorrect because it accept a string with single 1.
Option (D) is incorrect because it cannot accept 11101

2) Let L1 be a recursive language. Let L2 and L3 be languages that are


recursively enumerable but not recursive. Which of the following statements is
not necessarily true?
(A) L2 – L1 is recursively enumerable.
(B) L1 – L3 is recursively enumberable
(C) L2 ∩ L1 is recursively enumberable
(D) L2 ∪ L1 is recursively enumberable
Answer (B)

3) Consider the languages L1={0i1j | i != j}, L2={0i1j | i = j}, L3 = {0i1j | i = 2j+1}, L4


= {0i1j | i != 2j}. Which one of the following statements is true?
(A) Only L2 is context free
(B) Only L2 and L3 are context free
(C) Only L1 and L2 are context free
(D) All are context free
Answer (D)
A Pushdown Automata can be built for all four languages.

4) Let w be any string of length n is {0,1}*. Let L be the set of all substrings of
w. What is the minimum number of states in a non-deterministic finite
automaton that accepts L?
(A) n-1
(B) n
(C) n+1
(D) 2n-1
Answer (C)
We need minimum n+1 states to build NFA that accepts all substrings of a binary
string. For example, following NFA accepts all substrings of “010” and it has 4 states.

Please see GATE Corner for all previous year paper/solutions/explanations,


syllabus, important dates, notes, etc.
Please write comments if you find any of the answers/explanations incorrect, or you
want to share more information about the topics discussed above.
1. Which of the following derivations does a top-down parser use while
parsing an input string? The input is assumed to be scanned in left to right
order (GATE CS 2000).
(a) Leftmost derivation
(b) Leftmost derivation traced out in reverse
(c) Rightmost derivation
(d) Rightmost derivation traced out in reverse
Answer (a)
Top-down parsing (LL)
In top down parsing, we just start with the start symbol and compare the right side of
the different productions against the first piece of input to see which of the
productions should be used.
A top down parser is called LL parser because it parses the input from Left to right,
and constructs a Leftmost derivation of the sentence.

Algorithm (Top Down Parsing)


a) In the current string, choose leftmost nonterminal.
b) Choose a production for the chosen nonterminal.
c) In the string, replace the nonterminal by the right-hand-side
of the rule.
d) Repeat until no more nonterminals.
LL grammars are often classified by numbers, such as LL(1), LL(0) and so on. The
number in the parenthesis tells the maximum number of terminals we may have to
look at a time to choose the right production at any point in the grammar.
The most common (and useful) kind of LL grammar is LL(1) where you can always
choose the right production by looking at only the first terminal on the input at any
given time. With LL(2) you have to look at two symbols, and so on. There exist
grammars that are not LL(k) grammars for any fixed value of k at all, and they are
sadly quite common.
Let us see an example of top down parsing for following grammar. Let input string be
ax.
S -> Ax
A -> a
A -> b
An LL(1) parser starts with S and asks “which production should I attempt?”
Naturally, it predicts the only alternative of S. From there it tries to match A by calling
method A (in a recursive-descent parser). Lookahead a predicts production
A -> a
The parser matches a, returns to S and matches x. Done. The derivation tree is:
S
/ \
A x
|
a
References:
http://www.garshol.priv.no/download/text/bnf.html
http://en.wikipedia.org/wiki/Top-down_parsing
http://en.wikipedia.org/wiki/LL_parser

2. The process of assigning load addresses to the various parts of the


program and adjusting the code and data in the program to reflect the
assigned addresses is called (GATE CS 2001)
a) Assembly
b) Parsing
c) Relocation
d) Symbol resolution
Answer: (c)
Relocation is the process of replacing symbolic references or names of libraries with
actual usable addresses in memory before running a program. It is typically done by
the linker during compilation (at compile time), although it can be done at runtime by
a relocating loader. Compilers or assemblers typically generate the executable with
zero as the lower-most starting address. Before the execution of object code, these
addresses should be adjusted so that they denote the correct runtime addresses.

Relocation is typically done in two steps:


1. Each object code has various sections like code, data, .bss etc. To combine all the
objects to a single executable, the linker merges all sections of similar type into a
single section of that type. The linker then assigns runtime addresses to each
section and each symbol. At this point, the code (functions) and data (global
variables) will have unique runtime addresses.
2. Each section refers to one or more symbols which should be modified so that they
point to the correct runtime addresses.
References:
http://en.wikipedia.org/wiki/Relocation_(computer_science)

3. Which of the following statements is false? (GATE CS 2001)


a) An unambiguous grammar has same leftmost and rightmost derivation
b) An LL(1) parser is a top-down parser
c) LALR is more powerful than SLR
d) An ambiguous grammar can never be LR(k) for any k
Answer: (a)
If a grammar has more than one leftmost (or rightmost) derivation for a single
sentential form, the grammar is ambiguous. The leftmost and rightmost derivations
for a sentential form may differ, even in an unambiguous grammar

4. Which of the following grammar rules violate the requirements of an


operator grammar? P, Q, R are nonterminals, and r,s,t are terminals (GATE CS
2004).
(i) P -> QR
(ii) P -> QsR
(iii) P -> ε
(iV) P -> QtRr
a) (i) only
b) (i) and (iii) only
c) (ii) and (iii) only
d) (iii) and (iv) only
Answer: (b)
Explanation:
An operator precedence parser is a bottom-up parser that interprets an operator-
precedence grammar. For example, most calculators use operator precedence
parsers to convert from the human-readable infix notation with order of operations
format into an internally optimized computer-readable format like Reverse Polish
notation (RPN).
An operator precedence grammar is a kind of context-free grammar that can be
parsed with an operator-precedence parser. It has the property that no production
has either an empty (ε) right-hand side or two adjacent nonterminals in its right-hand
side. These properties allow the terminals of the grammar to be described by a
precedence relation, and the a parser that exploits that relation is considerably
simpler than more general-purpose parsers such as LALR parsers.

References:
http://en.wikipedia.org/wiki/Operator-precedence_grammar
http://en.wikipedia.org/wiki/Operator-precedence_parser

5. Consider the grammar with the following translation rules and E as the start
symbol.
E -> E1 #T {E.value = E1.value * T.value}
| T {E.value = T.value}
T -> T1 & F {T.value = T1.value + F.value}
|F {T.value= F.value}
F -> num {F.value = num.value}
Compute E.value for the root of the parse tree for the expression:2 # 3 & 5 # 6
&4. (GATE CS 2004)
a) 200
b) 180
c) 160
d) 40
Answer: (c)
Explanation:
We can calculate the value by constructing the parse tree for the expression 2 # 3 &
5 # 6 &4.
Alternatively, we can calculate by considering following precedence and associativity
rules.
Precedence in a grammar is enforced by making sure that a production rule with
higher precedence operator will never produce an expression with operator with
lower precedence.
In the given grammar ‘&’ has higher precedence than ‘#’.
Left associativity for operator * in a grammar is enforced by making sure that for a
production rule like S -> S1 * S2 in grammar, S2 should never produce an
expression with *. On the other hand, to ensure right associativity, S1 should never
produce an expression with *.
In the given grammar, both ‘#’ and & are left-associative.
So expression 2 # 3 & 5 # 6 &4 will become
((2 # (3 & 5)) # (6 & 4))
Let us apply translation rules, we get
((2 * (3 + 5)) * (6 + 4)) = 160.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory
concepts for SDE interviews with the CS Theory Course at a student-friendly price
and become indu

1. Given the following expression grammar:


E -> E * F | F+E | F
F -> F-F | id
which of the following is true? (GATE CS 2000)
(a) * has higher precedence than +
(b) – has higher precedence than *
(c) + and — have same precedence
(d) + has higher precedence than *
Answer(b)
Precedence in a grammar is enforced by making sure that a production rule with
higher precedence operator will never produce an expression with operator with
lower precedence.
In the given grammar ‘-’ has higher precedence than ‘*’

2. Consider a program P that consists of two source modules M1 and M2


contained in two different files. If M1 contains a reference to a function defined
in M2 the reference will be resolved at (GATE CS 2004)
a) Edit time
b) Compile time
c) Link time
d) Load time

Answer (c)
Compiler transforms source code into the target language. The target language is
generally in binary form known as object code. Typically, an object file can contain
three kinds of symbols:
* defined symbols, which allow it to be called by other modules,
* undefined symbols, which call the other modules where these symbols are defined,
and
* local symbols, used internally within the object file to facilitate relocation.
When a program comprises multiple object files, the linker combines these files into
a unified executable program, resolving the symbols as it goes along.
http://en.wikipedia.org/wiki/Compiler
http://en.wikipedia.org/wiki/Linker_%28computing%29

3. Which of the following suffices to convert an arbitrary CFG to an LL(1)


grammar? (GATE CS 2003)
(a) Removing left recursion alone
(b) Factoring the grammar alone
(c) Removing left recursion and factoring the grammar
(d) None of the above
Answer(d)
Removing left recursion and factoring the grammar do not suffice to convert an
arbitrary CFG to LL(1) grammar.
http://pages.cpsc.ucalgary.ca/~robin/class/411/LL1.3.html
4. Assume that the SLR parser for a grammar G has n1 states and the LALR
parser for G has n2 states. The relationship between nl and n2 is (GATE CS
2003)
(a) n1 is necessarily less than n2
(b) n1 is necessarily equal to n2
(c) n1 is necessarily greater than n2
(d) none of the above
Answer (b)
http://parasol.tamu.edu/people/rwerger/Courses/434/lec10.pdf
http://dragonbook.stanford.edu/lecture-notes/Stanford-CS143/11-LALR-Parsing.pdf
Please see GATE Corner for all previous year paper/solutions/explanations,
syllabus, important dates, notes, etc.
Please write comments if you find any
Automata Theory Objective Questions Answers

gkseries.com/automata-theory/multiple-choice-questions-and-answers-on-automata-theory

Questions

1 The recognizing capability of NDFSM and DFSM

A must be the same

B may be different

C must be different

D none of the above

View Answer
Answer: Option [A]

The recognizing capability of NDFSM and DFSM both are same. Because it is possible to

generate equivalent DFSM from NDFSM and Vice versa.

2 Pumping lemma is generally used for proving

A a given grammar is regular

B a given language is not regular

C whether two given regular expressions are equivalent

D none of the above

View Answer

Answer: Option [B]

3 Why Palindromes can't be recognized by any FSM ?

A an FSM can't deterministically fix the mid-point

B an FSM can't remember arbitrarily large amount of information

C even if the mid-point is known, an FSM can’t find whether the second half of the string

matches the first half

D all of the above

View Answer

Answer: Option [D]

4 L = {a b a | n = 1, 2, 3 ……..} is an example of a language that is

nnn

1/3

A not context free but whose complement is CF

B not context free

C only [A]

D both (B) and (C)

View Answer

Answer: Option [D]

5 Any given Transition graph has an equivalent

A DFSM

B NDFSM

C regular expression
D all of the above

View Answer

Answer: Option [D]

6 The lexical analysis for a modern computer language such as Java needs the power of

which one of the following machine models in a necessary and sufficient sense?

A Finite state automata

B Deterministic pushdown automata

C Non-Deterministic pushdown automata

D Turing machine

View Answer

Answer: Option [A]

7 Context-free grammar is not closed under

A complementation

B union

C concatenation

D kleene star

View Answer

Answer: Option [A]

2/3

8 A PDM behaves like an FSM when the number of auxiliary memory it has is

A0

B1

C2

D none of the above

View Answer

Answer: Option [A]

9 A PDM behaves like a TM when number of auxiliary memory it has is

A0

B1

C 2 or more

D none of the above


View Answer

Answer: Option [C]

10 Which of the following statements is/are true?

A DFSM and NDFSM both are equivalent.

B An FSM with 2 stacks is as powerful as a TM.

C A DFSM with 2 stacks and an NDFSM with 2 stacks have the same power.

D All of the above

View Answer

Answer: Option [D]

3/3
Number of states of the FSM required to simulate behaviour of a computer with a memory
capable of storing "m" words, each of length 'n'

A.m x 2n

B. 2mn

C.2m+n

D.all of these

Answer Report Discuss


Option: B

Explanation :

For every data here length is ‘n’ and memory's states are defined in terms of power of 2,
Here the total memory capability for all the words = mn
Hence number of states are 2mn

Click on Discuss to view users comments.

2:
An FSM with

A.1 stack is more powerful than an FSM with no stack


B. 2 stacks is more powerful than a FSM with 1 stack
C.both (a) and (b)
D.None of these
Answer Report Discuss
Option: C

Explanation :

Click on Discuss to view users comments.

3:
If two finite states machine M and N are isomorphic, then
A.M can be transformed to N, merely re-labelling its states
B. M can be transformed to N, merely re-labelling its edges
C.Both (a) and (b)
D.None of these
Answer Report Discuss
Option: A

Explanation :

Click on Discuss to view users comments.

4:
Power of

A.DFSM and NDFSM are same


B. DFSM and NDFSM are different
C.DPDM and NDPDM are diferent
D.Both (A) and (C)
Answer Report Discuss
Option: D

Explanation :

Click on Discuss to view users comments.

5:
Which of the folowing pairs of regular expressions are equivalent ?

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

B. x (xx) * and (xx) * x

C.x+ and x+x*+

D.All of these

Answer Report Discuss


Option: D

Explanation :

Option (a) and option (b) are similar deriving expressions using rule :- (pq)*p = p(qp)*

Option (c) will also be valid since:-

(x+x*+) will be

--->(xx*)(x*x**)

--->(xx*)(x*x*) (Using x** = x*)

--->(xx*)(x*) (Using x*x* = x*)

--->(xx*) (Using x*x* = x*)


--->x+

So, the answer will be all of these (Option d)

Click on Discuss to view users comments

A finite state machine with the following state table has a single input x and a single
output z. If initial state is unknown, then shortest input sequence to reach the inal state C
is

Present
Next state, z
state

X=1 X =0

A D, 0 B, 0

B B, 1 C, 1

C B, 0 D, 1

D B, 1 C, 0

A.01

B. 10

C.110

D.110

Answer Report Discuss


Option: B

Explanation :

Click on Discuss to view users comments.

7:
An FSM can be used to add how many given integers ?

A.1

B. 3

C.4
D.2

Answer Report Discuss


Option: D

Explanation :

Finite Automata (FA) or Finite State Machine to add two integers can be constructed using two
states:
q0: Start state to represent carry bit is 0
q1: State to represent carry bit is 1

Click on Discuss to view users comments.

8:
If two finite state machines are equivalent, they should have the same number of

A.states
B. edges
C.states and edges
D.none of these
Answer Report Discuss
Option: D

Explanation :

Click on Discuss to view users comments.

9:
For which of the following applications regular expressions can be used ?

A.Designing compilers

B. Developing text editors

C.Simulating sequential circuits

D.All of these

Answer Report Discuss


Option: D

Explanation :

Click on Discuss to view users comments.

10:
L = {aP | p ; } is prime is

A.regular
B. not regular
C.accepted by DFA
D.accepted by PDA
Answer Report Discuss
Option: B

Explanation :

Click on Discuss to view users comments.

In an incompletely specified automata

A.no edge should be labelled epsilon


B. from any given state, there can't be any token leading to two different states
C.both (a) and (b)
D.start state may not be there
Answer Report Discuss
Option: D

Explanation :

Click on Discuss to view users comments.

12:
If f : {a, b}* —> (a, b}* be given by f (n) = ax for every value of n ∈ (a, b}, then f is

A.one to one not onto

B. one to one and onto

C.not one to one and not onto

D.not one to one and onto

Answer Report Discuss


Option: A

Explanation :

Click on Discuss to view users comments.

13:
The word 'formal' in formal languages means

A.the symbols used have well-defined meaning


B. they are unnecessary, in reality
C.only form of the string of symbols is significant
D.Both (a) and (b)
Answer Report Discuss
Option: C

Explanation :

Click on Discuss to view users comments.

14:
Running time of NFA to DFA conversion including the case where NFA has e-transition is

A.0 (n3)
B. 0 (n332)

C.0 (n32n)

D.0 (n22n)

Answer Report Discuss


Option: C

Explanation :

Click on Discuss to view users comments.

15:
Which of the following statements is/are false ?

A.The task of lexical analyzer is to translate the input source language text into tokens
and determine the groups of tokens are inter-related.
B. Two basic approaches to translation are generation and interpretation.
C.A load-and-go compiler is capable o translating the source language text on a host
machine A that can be later run on any target machine B.
D.None of these
Answer Report Discuss
Option: D

Explanation :

Click on Discuss to view users comments.

Which of the following are not regular ?

A.String of 0's whose length is a perfect square


B. Set of all palindromes made up of 0's and 1's
C.Strings of 0's, whose length is a prime number
D.All of these
Answer Report Discuss
Option: D

Explanation :
Strings of odd number of zeroes can be generated by the regular expression (00) *0.Pumping
lemma can be used to prove the non-regularity of the other options.

Click on Discuss to view users comments.

17:
The main difference between a DFSA and an NDFSA is

A.in DFSA, ε transition may be present

B. in NDFSA, ε transitions may be present

C.in DFSA, from any given state, there can't be any alphabet leading to two
diferent states
D.in NDFSA, from any given state, there can't be any alphabet leading to two
diferent states

Answer Report Discuss


Option: C

Explanation :

Click on Discuss to view users comments.

18:
If w ∈ (a, b)* satisfy abw = wab, then (w) is

A.even

B. odd

C.null

D.none of these

Answer Report Discuss


Option: A

Explanation :

Click on Discuss to view users comments.

19:
A PDM behaves like an FSM wnen the number of auxiliary memory it has, is

A.0
B. 1
C.2
D.None of these
Answer Report Discuss
Option: A

Explanation :

Click on Discuss to view users comments.

20:
Finite state machine can recognize

A.any grammar
B. only context-free grammar
C.Both (a) and (b)
D.only regular grammar
Answer Report Discuss
Option: D

Explanation :
Click on Discuss to view users comments.

The major difference between a moore and mealy machine is that

A. output of the former depends on the present state and present input

B. output of the former depends only on the present state

C.output of former depends only on the present input

D.all of these

Answer Report Discuss


Option: B

Explanation :

Click on Discuss to view users comments.

22:
Any given transition graph has an equivalent

A. regular expression

B. DFSM

C.NDFSM

D.all of these

Answer Report Discuss


Option: D

Explanation :

Click on Discuss to view users comments.

23:
For which of the following application, regular expressions cannot be used ?

A.Designing computers

B. Designing compilers

C.Both (a) and (b)

D.Developing computers

Answer Report Discuss


Option: D
Explanation :

Click on Discuss to view users comments.

24:
If S be an infinite set and be sets such that S1 ∪ S2 ∪ .....∪ SN = S, then

A.atleast one of the set Si is a finite set

B. not more than one of the sets Si can be finite

C.atleast one of the sets Si is an infinite set

D.not more than one of the sets Si can be infinite

Answer Report Discuss


Option: C

Explanation :

Click on Discuss to view users comments.

25:
Vienna Definition Language is an example of language definition facility based on

A.Mathematical semantics

B. Interpretative semantics

C.Translational semantics

D.Axiomatic semantics

Answer Report Discuss


Option: A

Explanation :

Click on Discuss to view users comments.

Which of the following regular expressions denotes a language comprising all possible
strings over the alphabet {a, b } ?

A. a* b*

B. (a | b)*
C. (ab)+

D. (a | b*)

Answer Report Discuss


Option: B

Explanation :

Click on Discuss to view users comments.

27:
An FSM (Finite State Machine) can be considered to be a TM (Turing Machine) of finite
tape length

A.without rewinding capability and unidirectional tape movement.

B. rewinding capacity, and unidirectional tape movement

C.without rewinding capability and bidirectional tape movement

D.rewinding capability and bidirectional tape movement

Answer Report Discuss


Option: A

Explanation :

Click on Discuss to view users comments.

28:
Palindromes can't be recognized by any FSM because

A.FSM can't remember arbitrarily large of information

B. FSM can't deterministically fix the mid-point

C.even if mid-point is known, FSM be can't be found whether, second half of the
string matches the first half

D.all of these

Answer Report Discuss


Option: D

Explanation :

Click on Discuss to view users comments.

29:
If ∑ = {a, b, c, d, e, f } then number of strings in ∑ of length 4 such that no symbol is used
more than once in a string is

A.35
B. 360

C.49

D.720

Answer Report Discuss


Option: B

Explanation :

Here string length is 4 so we can create string of length 4 by 6 values. Suppose at first place we
can arrange any value by 6 methods.so 6. then Remaining total numbers are 5 so we can
arrange them by 5 methods at second place. then remaining total numbers are 4 so we can
arrange them by 4 methods. now remaining total numbers are 3 and we can arrange them by 3
methods. so according to permutation technique. We multiply them i.e. 6*5*4*3=360. So, 'B'

Click on Discuss to view users comments.

30:
A language L is accepted by a finite automaton if and only if it is

A.context - free

B. context-sensitive

C.recursive

D.Right-linear

Answer Report Discuss


Option: D

Explanation :

Click on Discuss to view users comments.

Can a DFA simulate NFA?

A.NO

B. YES

C.SOMETIMES

D.Depends on NFA

Answer Report Discuss


Option: B

Explanation :

Click on Discuss to view users comments.


32:
Which of the following statements is wrong ?

A.The language accepted by finite automata are the languages denoted by


regular expressions

B. For every DFA there is a regular expression denoting its language

C.For a regular expression r, there does not exist NFA with L(r) any transit that
accept

D.None of these

Answer Report Discuss


Option: C

Explanation :

Click on Discuss to view users comments.

33:
Regular expression a / b denotes the set

A. {a}

B. { ∈ , a, b }

C.{a, b}

D.{ ab }

Answer Report Discuss


Option: C

Explanation :

Click on Discuss to view users comments.

34:
Regular expression (a | b ) (a | b) denotes the set

A.{ a, b, ab, aa }

B. { a, b, ba, bb }

C.{ a, b }

D.{ aa, ab, ba, bb }

Answer Report Discuss


Option: D

Explanation :
Click on Discuss to view users comments.

35:
Which of the following regular expressions denotes zero or more instances of an a or b ?

A.a | b

B. (ab)*

C. (a | b)*

D.a* I b

Answer Report Discuss


Option: C

Explanation :

Click on Discuss to view users comments.

Which of the following regular expressions denotes a language comprising all possible
strings of even length over the alphabet ( 0 , 1 ) ?

A.(0 | 1) *

B. (0 | 1) (0 | 1)*

C.(00 01 10 11 )*

D.(0 | 1 ) (0 | 1)(0 | 1 ) *

Answer Report Discuss


Option: C

Explanation :

Click on Discuss to view users comments.

37:
The regular expression (a | b)* denotes the set of all strings

A.with zero or more instances of a or b

B. with one or more instances of a or b

C.equal to regular expression (a* b*)*

D.both (a) and (c)

Answer Report Discuss


Option: D

Explanation :

Click on Discuss to view users comments.

38:
The string (a) | ((b) * (c)) is equivalent to

A.set of strings with either a or zero or more b's and one c

B. set of strings with either a or one or more b's and one c

C.b* c l a

D.both (a) and (c)

Answer Report Discuss


Option: C

Explanation :

Click on Discuss to view users comments.

39:
An automation is a __________ device and a grammar is a __________ device.

A.generative, cognitive

B. generative, acceptor

C.acceptor, cognitive

D.cognitive, generative

Answer Report Discuss


Option: D

Explanation :

Click on Discuss to view users comments.

40:
In the figure given below, a deterministic finite automation M has start state A and
accepting state D. Which of the following regular expression denoted the set of all words
accepted by
M?

A. 001

B. 10 * 1 * 0

C.( 0 | 1) * 011

D.1* 0 * 001

Answer Report Discuss


Option: C

Explanation :

Click on Discuss to view users comments.

The regular sets are closed under

A.union

B. concatenation

C.Kleene's closure

D. all of these

Answer Report Discuss


Option: D

Explanation :

Click on Discuss to view users comments.

42:
Dynamic errors can be detected at

A.compile time

B. Run time
C.both (a) and (b)

D.none of these

Answer Report Discuss


Option: B

Explanation :

Click on Discuss to view users comments.

43:
If a and b be the regular expressions, then ( a* ∪ b* ) * is equivalent to

A.(a ∪ b) *

B. (b* ∪ a*)*

C. (b ∪ a)*

D.All of above

Answer Report Discuss


Option: D

Explanation :

Click on Discuss to view users comments.

44:
Finite state machines _________ recognize palindromes

A.can

B. can't

C.may

D.may not

Answer Report Discuss


Option: B

Explanation :

Click on Discuss to view users comments.

45:
If S and T be language over Σ = {a, b } represented by regular expression (a + b * ) * and
(a + b) * , respectively, then

A.S ⊂ T
B. T⊂ S

C. S = T

D.S ∩ T= φ

Answer Report Discuss


Option: C

Explanation :

Consider regular expression (0 + 1) (0 + 1) ....... n times. Minimum state finite automaton


that recognizes the language represented by this regular expression contains

A.n states

B. n + 1 states

C. n + 2 states

D. none of these

Answer Report Discuss


Option: B

Explanation :

Click on Discuss to view users comments.

47:
If regular set A is represented by A = (01 + 1)* and the regular set 'B' is represented by B =
((01)*1*)*, then

A.A ⊂ B

B. B ⊂ A

C.A and B are uncomparable

D. A=B

Answer Report Discuss


Option: D

Explanation :

Click on Discuss to view users comments.

48:
Which of the following can be recognized by a Deterministic Finite-state Automaton ?

A. Numbers, 1,2,4, ....... zN ..... written in binary.

B.

Numbers 1, 2, 4, ........, zN ...... written in unbinary.


C.Set of binary string in which number of zeros is same as the number of ones.

D. Set (1,101,11011,1110111, ......}

Answer Report Discuss


Option: A

Explanation :

Click on Discuss to view users comments.

49:
Which of the following are not regular ?

A.String of 0’s whose length is a perfect square

B. Set of all palindromes made up of 0’s and 1's

C.Strings of 0’s, whose length is a prime number

D.All of these

Answer Report Discuss


Option: D

Explanation :

Click on Discuss to view users comments.

50:
An FSM with

A.1 stack is more powerful than an FSM with no stack

B. 2 stacks is more powerful than a FSM with 1 stack

C.both (a) and (b)

D.none of these

Answer Report Discuss


Option: C

Explanation :

Click on Discuss to view users comments.

51:
If w ∈ (a, b)* satisfy abw = wab, then (w) is

A.even

B. odd

C.null
D.none of these

Answer Report Discuss


Option: A

Explanation :

Click on Discuss to view users comments.

52:
A PDM behaves like an FSM wnen the number of auxiliary memory it has, is

A.0

B. 1

C.2

D.none of these

Answer Report Discuss


Option: A

Explanation :

Click on Discuss to view users comments.

53:
A finite state machine with the following state table has a single input x and a single
output z

Present state Next state, z

If the initial state is unknown, then


x= shortest input sequence to reach the final state
x=0
1 C is
A.01
A D, 0 B, 0
B. 10
B B,1 C,1 C.10

D.110
C B, 0 D, 1
Answer Report Discuss
Option: B
D B, 1 C, 0
Explanation :

Click on Discuss to view users comments.


54:
FSM shown in the

figure

A.all strings

B. no string

C. ε- alone

D.none of these

Answer Report Discuss


Option: C

Explanation :

Click on Discuss to view users comments.

55:
If f : {a, b}* ---> {a , b } * be given by f(n) = ax for every value of n ∈ {a, b}, then f is

A.one to one not onto

B. one to one and onto

C.not one to one and not onto

D.not one to one and onto

Answer Report Discuss


Option: A

Explanation :

Click on Discuss to view users comments.

If two finite states machine M and N are isomorphic, then

A.M can be transformed to N, merely re-labelling its states

B. M can be transformed to N, merely re-labelling its edges

C.M can be transformed to N, merely re-labelling its edges


D.none of these

Answer Report Discuss


Option: A

Explanation :

Click on Discuss to view users comments.

57:
Regular expression corresponding to the state diagram given in the figure is

A.(0+1(1 + 01)* 00)*

B. (1 + 0 (0 + 10) 00)*

C.(0 + 1 (1 + 10) 00)*

D.(1 + 0(1 + 00) 11)*

Answer Report Discuss


Option: A

Explanation :

Click on Discuss to view users comments.

58:
Two finite state machines are said to be equivalent if they

A.have same number of states

B. have same number of edges

C.have same number of states and edges

D.recognize same set of tokens


Answer Report Discuss
Option: C

Explanation :

Click on Discuss to view users comments.

You might also like