Assignment - 2 - Compiler Design
Assignment - 2 - Compiler Design
Institute of Technology Kharagpur
Compiler
DesignAssignment‐
Week 2
TYPE OF QUESTION:MCQ
Number ofquestions:13 Total mark: 13 X 1 = 13
1. A regular expression represents
a) Part of a language
3. For the Fortran language statement “DO 5 I = 1.25” returns token IDENTIFIER for DO 5
I after looking upto
a) I
b) =
c) .
d) 5
Ans: C)
5.
A regular expression for accepting strings with exactly one 1 more than 0’s is
a) 0*1
b) (0|1)*1(0|1)*
c) (0|1)*1(0|1)*|1(0|1)*
d) Not Possible
Ans: d)
6.
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.
Ans : C)Explanation: The regular expression has two 0′s surrounded by (0+1)* which means
accepted strings must have at least 2 0′s.
7.
Finite automata is an implementation of
a) Regular expression
b) Any grammar
c) Part of the regular expression
d) None of the other options
Ans: A)
8.
The automation which allows transformation to a new state without consuming any input
symbols:
a) NFA
b) DFA
c) Pushdown automata
d) All of the mentioned
Ans: A)
9.
The __________ of a set of states, P, of an NFA is defined as the set of states reachable from
any state in P following ε-transitions
a) ε-closure
b) ε-park
c) Q in the tuple
Ans: A) Explanation: The ε-closure of a set of states, P, of an NFAis defined as the set of states
reachable from any state in P following e-transitions.
10.
Between NFA and DFA which one is powerful
a) NFA
b) DFA
c) Equally powerful
d) Cannot be said definitely
Ans: c)
11.
Subset Construction method refers to
b) DFA minimization
d) ε-NFA to NFA
12.
Which of the following do we use to form an NFA from a regular expression
13.
A certain compiler corrects errors like “fi” to “if” automatically. This is an example of
recovery in
a) Panic mode
b) Delete character
c) Replace Character
d) Transpose character
Ans: D)
END of Assignment