Nikhil
Nikhil
(2) It delays the transmission of signal along the wire by one step (clock pulse).
(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
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
Transition Graph of L
Regular expression of L
Complement of L
Finite Automata of L
(15) If L1 and L2 are regular languages, then these can be expressed by the corresponding FAs.
True
False
(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.
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
(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
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
(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
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
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
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
Productions
Terminals
Non-terminals
None of given
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
FA
TG
CFG
TGT
(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 __________
(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
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
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
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)
“One language can be expressed by more than one FA”. This statement is ______
► True
► False
► Some times true & sometimes false
► None of these
A regular language:
► Must be finite
► Must be infinite
► Can be finite or infinite
► Must be finite and cannot be infinite
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
This statement is
► True
► False
► Depends on language
► None of these
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
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
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
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
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)
(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”
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]+.
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) 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.
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.
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
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
gkseries.com/automata-theory/multiple-choice-questions-and-answers-on-automata-theory
Questions
B may be different
C must be different
View Answer
Answer: Option [A]
The recognizing capability of NDFSM and DFSM both are same. Because it is possible to
View Answer
C even if the mid-point is known, an FSM can’t find whether the second half of the string
View Answer
nnn
1/3
C only [A]
View Answer
A DFSM
B NDFSM
C regular expression
D all of the above
View Answer
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?
D Turing machine
View Answer
A complementation
B union
C concatenation
D kleene star
View Answer
2/3
8 A PDM behaves like an FSM when the number of auxiliary memory it has is
A0
B1
C2
View Answer
A0
B1
C 2 or more
C A DFSM with 2 stacks and an NDFSM with 2 stacks have the same power.
View Answer
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
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
2:
An FSM with
Explanation :
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 :
4:
Power of
Explanation :
5:
Which of the folowing pairs of regular expressions are equivalent ?
D.All of these
Explanation :
Option (a) and option (b) are similar deriving expressions using rule :- (pq)*p = p(qp)*
(x+x*+) will be
--->(xx*)(x*x**)
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
Explanation :
7:
An FSM can be used to add how many given integers ?
A.1
B. 3
C.4
D.2
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
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 :
9:
For which of the following applications regular expressions can be used ?
A.Designing compilers
D.All of these
Explanation :
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 :
Explanation :
12:
If f : {a, b}* —> (a, b}* be given by f (n) = ax for every value of n ∈ (a, b}, then f is
Explanation :
13:
The word 'formal' in formal languages means
Explanation :
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)
Explanation :
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 :
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.
17:
The main difference between a DFSA and an NDFSA is
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
Explanation :
18:
If w ∈ (a, b)* satisfy abw = wab, then (w) is
A.even
B. odd
C.null
D.none of these
Explanation :
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 :
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.
A. output of the former depends on the present state and present input
D.all of these
Explanation :
22:
Any given transition graph has an equivalent
A. regular expression
B. DFSM
C.NDFSM
D.all of these
Explanation :
23:
For which of the following application, regular expressions cannot be used ?
A.Designing computers
B. Designing compilers
D.Developing computers
24:
If S be an infinite set and be sets such that S1 ∪ S2 ∪ .....∪ SN = S, then
Explanation :
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
Explanation :
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*)
Explanation :
27:
An FSM (Finite State Machine) can be considered to be a TM (Turing Machine) of finite
tape length
Explanation :
28:
Palindromes can't be recognized by any FSM because
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
Explanation :
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
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'
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
Explanation :
A.NO
B. YES
C.SOMETIMES
D.Depends on NFA
Explanation :
C.For a regular expression r, there does not exist NFA with L(r) any transit that
accept
D.None of these
Explanation :
33:
Regular expression a / b denotes the set
A. {a}
B. { ∈ , a, b }
C.{a, b}
D.{ ab }
Explanation :
34:
Regular expression (a | b ) (a | b) denotes the set
A.{ a, b, ab, aa }
B. { a, b, ba, bb }
C.{ a, b }
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
Explanation :
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 ) *
Explanation :
37:
The regular expression (a | b)* denotes the set of all strings
Explanation :
38:
The string (a) | ((b) * (c)) is equivalent to
C.b* c l a
Explanation :
39:
An automation is a __________ device and a grammar is a __________ device.
A.generative, cognitive
B. generative, acceptor
C.acceptor, cognitive
D.cognitive, generative
Explanation :
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
Explanation :
A.union
B. concatenation
C.Kleene's closure
D. all of these
Explanation :
42:
Dynamic errors can be detected at
A.compile time
B. Run time
C.both (a) and (b)
D.none of these
Explanation :
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
Explanation :
44:
Finite state machines _________ recognize palindromes
A.can
B. can't
C.may
D.may not
Explanation :
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= φ
Explanation :
A.n states
B. n + 1 states
C. n + 2 states
D. none of these
Explanation :
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
D. A=B
Explanation :
48:
Which of the following can be recognized by a Deterministic Finite-state Automaton ?
B.
Explanation :
49:
Which of the following are not regular ?
D.All of these
Explanation :
50:
An FSM with
D.none of these
Explanation :
51:
If w ∈ (a, b)* satisfy abw = wab, then (w) is
A.even
B. odd
C.null
D.none of these
Explanation :
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
Explanation :
53:
A finite state machine with the following state table has a single input x and a single
output z
D.110
C B, 0 D, 1
Answer Report Discuss
Option: B
D B, 1 C, 0
Explanation :
figure
A.all strings
B. no string
C. ε- alone
D.none of these
Explanation :
55:
If f : {a, b}* ---> {a , b } * be given by f(n) = ax for every value of n ∈ {a, b}, then f is
Explanation :
Explanation :
57:
Regular expression corresponding to the state diagram given in the figure is
B. (1 + 0 (0 + 10) 00)*
Explanation :
58:
Two finite state machines are said to be equivalent if they
Explanation :