Compiler Construction
Compiler Construction
Compiler Construction
a) Φ
b) ε
c) a
d) {a, ε}
77. The 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
78. S –>aSa| bSb| a| b; the language generated by the above grammar is the set of
____________
a) All palindromes
b) All odd length palindromes
c) Strings beginning and ending with the same symbol
d) All even length palindromes
79. Which of the following CFG’s can’t be simulated by an FSM?
a) S->Sa/b
b) S->aSb/ab
c) S->abX, X->cY, Y->d/aX
d) None of the mentioned
80. The transitions which does not take an input symbol are called ___________
a) ε-transitions
b) λ-transitions
c) ε-transitions & λ-transitions
d) none of the mentioned
81. Which of the following is a correct statement?
a) { If an bn | n = 0,1, 2, 3 ..} is regular language
b) Strings with equal number of a’s and b’s denies a regular language
c) L (A* B*)∩ B gives the set A
d) None of the mentioned
82. Which of the following strings is NOT in the Kleene star of the language {011, 10,
110}?
a) 01
b) 10
c) 110
d) 10011101
83. Which grammar is not regular?
a) 0^n
b) 0^n 1^n n
c) 0^m 0^n n
d) 0^n 0^n n
84. If is a language, and is a symbol, then, the quotient of and, is the set of strings
such that is in: is in. Suppose is regular, which of the following statements is
true?
a) L/a is always a regular language
b) L/a is not a regular language
c) All of the mentioned
d) None of the mentioned
85. Here is a context-free grammar G: S → AB A → 0A1 | 2 B → 1B | 3A which of the
following strings are in L (G)?
a) 021300211
b) 022111300211
c) None of the mentioned
d) 021300211 & 022111300211
86. The grammar G: S → SS | a | b is ambiguous. Check all and only the strings that
have exactly two leftmost derivations in G.
a) bbb
b) ab
c) All of the mentioned
d) None of the mentioned
87. For the following grammar: S → A | B | 2 A → C0 | D B → C1 | E C → D | E | 3 D
→ E0 | S E → D1 | S Identify all the unit pairs.
a) D,C
b) A,B
c) B,C
d) A,C
88. _________an IR-to-IR transformer that tries to improve the IR program in some
way.
a) Optimizer
b) Parser
c) All of the mentioned
d) None of the mentioned
89. _________ a phase of a compiler that maps the IR program into the instruction set
and the finite resources of the target machine.
a) Optimizer
b) Parser
c) Optimizer & Parser
d) None of the mentioned
90. Consider the languages L1 = and L2 = {a}. Which one of the following represents
L1 L2* U L1*?
a) €
b) a*
c) All of the mentioned
d) None of the mentioned
91. W hat is the complement of the language accepted by the NFA shown below?
a) A,B
b) B
c) C
d) D,C
92. Let w be any string of length n is {0,1}*. Let L be the set of all substring of w.
State the minimum number of states in a NDFA that accepts L?
a) n – 1
b) n
c) n + 1
d) 2n – 1
93. Which one of the following is FALSE?
a) Every NFA can be converted to DFA
b) Every subset of a recursively enumerable set is recursive
c) All of the mentioned
d) None of the mentioned
94. Which one of the following is TRUE?
a) The language L={a^nb^n |n>0 } is regular
b) The language L={a^n |n is prime } is regular
c) The language L={w|w has 3k+1 b’s for some k } is regular
d) None of the mentioned
95. Let L1 = {w ∈ {0,1}∗ | w has at least as many occurrences of (110)’s as (011)’s}.
Let L2 = { ∈ {0,1}∗ | w has at least as many occurrences of (000)’s as (111)’s}.
Which one of the following is TRUE?
a) L1 is regular but not L2
b) L2 is regular
c) L1 and L2 are regular
d) Neither of them are regular
96. The length of the shortest string NOT in the language (over Σ = {a, b}) of the
following regular expression is _____________
a*b*(ba)*a*
a) 2
b) 3
c) 4
d) 5
97. Consider the following deterministic finite state automaton M.
S denotes the set of seven bit in which the 1st ,4th and last bits are 1. The
number of strings that are accepted by M is
a) 1
b) 5
c) 7
d) 8
98. L1 is accepted by the NFA, obtained by changing the accepting state of M to a
non-accepting state and vice versa. Which of the following statements is true?
a) L1 = {0, 1}* – L
b) L1 = {0, 1}* – L
c) L1 ⊆ L
d) L1=L
99. Given an arbitrary non-deterministic finite automaton (NFA) with N states, the
maximum number of states in an equivalent minimized DFA is at least?
a) N2
b) 2N
c) 2N
d) N!
100. What can be said about a regular language L over {a} whose minimal
finite state automaton has two states?
a) L must be {an| n is odd}
b) L must be {an| n is even}
c) L must be {an| n is even}
d) Either L must be {an | n is odd}, or L must be {an | n is even}
101. How many minimum states are required to find whether a string has odd
number of 0’s or not?
a) 1
b) 2
c) 3
d) 4
102. The number of states in DFA that accepts the language L(M) ∩ L(N) is
_________
a) 0
b) 1
c) 2
d) 3
103. Which of the following is not regular?
a) String whose length is perfect square and consists of 0s
b) Palindromes consisting of 0’s and 1’s
c) String whose length is perfect square and consists of 0s & Palindromes
consisting of 0’s and 1’s
d) None of the mentioned
104. Which of the following pairs of regular expression are equivalent?
a) 1(01)* and (10)*1
b) X(xx)* and (xx)*x
c) 1(01)* and (10)*1 & X(xx)* and (xx)*x
d) None of the mentioned