Mock Test on Compiler Design Questions and Answers-1
1.LR stands for
Select one:
a. Left to right
b. Left to right and RMD in reverse
c. Right to left
d. Left to right reducing
Feedback
The correct answer is: Left to right and RMD in reverse
2.If S is the Start symbol, then end marker $ should be placed in FOLLOW of S.
Select one:
True
False
Feedback
The correct answer is 'True'.
3.If X is a terminal then FIRST(X) = X
3.If X is a terminal then FIRST(X) = X
Select one:
True
False
Feedback
The correct answer is 'True'.
4.FOLLOW set can be computed for both terminal and variable/non terminal.
Select one:
True
False
Feedback
The correct answer is 'False'.
5.A given grammar is said to be ambiguous if
True
False
Feedback
The correct answer is 'False'.
5.A given grammar is said to be ambiguous if
Select one:
a. There is a sentence with more than one derivation tree corresponding to it
b. A derivation tree has more than one associated sentence
c. Parentheses are not present in the grammar
d. Two or more production has the same non-terminal on the LHS
Feedback
The correct answer is: There is a sentence with more than one derivation tree corresponding to it
6.What are the stages in the compilation process?
6.What are the stages in the compilation process?
Select one:
A. Feasibility study system design and testing
B. Implementation and documentation
C. Lexical analysis, syntax analysis and code generation
D. All of the above
Feedback
The correct answer is: Lexical analysis, syntax analysis and code generation
7.YACC is a:
Select one:
A. Lexical analyzer generator
B. Parser generator
C. Semantic analyzer
D. None of the above
Feedback
The correct answer is: Parser generator
8.What is a compiler?
Select one:
A. Compiler does a conversion line by line as the program is run
B. Compiler converts the whole of a high level program code into machine code in one step
C. Compiler is a general purpose language providing very efficient execution
D. All of the above
Feedback
The correct answer is: Compiler converts the whole of a high level program code into machine code in one step
9.Given grammar
S --> (L) | a
L --> L, S | S
Which of the input recognised by the grammar
Select one:
A. ((a, a), a)
B. (a,a)
C. ((a, a,a),a)
D. All of the above
Feedback
The correct answer is: All of the above
10.The regular expression (a | b)* abb denotes
Select one:
A. All possible combination of a’s and b’s
B. All possible combination of a’s and b’s
C. Set of all string starting with a and ending abb
D. None of the above
Feedback
The correct answer is: All possible combination of a’s and b’s
11.Finite automata can be used to count the number of symbols read.
Select one:
True
False
Feedback
The correct answer is 'False'.
12.In regular expression notation * represents one or more occurrence of the preceding symbol.
Select one:
True
False
Feedback
The correct answer is 'False'.
13.NDFA can be converted to DFA using subset construction method
Select one:
True
False
Feedback
The correct answer is 'True'.
14.Shift reduce parsing is a type of Top down design.
Select one:
True
False
Feedback
The correct answer is 'False'.
15.The grammar E --> E+E | E*E | a
Select one:
A. Ambiguous
B. Unambiguous
C. Depends on the given sentence
D. None of the above
Feedback
The correct answer is: Ambiguous
16.Lexical Analyzer is the only phase which reads the complete source program.
Select one:
True
False
Feedback
The correct answer is 'True'.
17.Regular expression(0+1)* recognises set of all strings over {0,1}
Select one:
True
False
Feedback
The correct answer is 'True'.
18.LEX is a:
Select one:
A. Token generator
B. A parser generator
C. Code generator
D. None of the above
Feedback
The correct answer is:
Token generator
19.Two finite state machines are said to be equivalent if they
Select one:
a. Have same number of states
b. Have the same number of states and edges
c. Recognize the same language
d. Have same number of edges
Feedback
The correct answer is: Recognize the same language
20.A bottom up parser generates
Select one:
a. Right most derivation
b. Right most derivation in reverse
c. Left most derivation in reverse
d. Left most derivation
Feedback
The correct answer is: Right most derivation in reverse
21.An ideal Compiler should
Select one:
A. Be smaller in size
B. Takes less time for compilation
C. Be written in a high level language
D. All of the above
Feedback
The correct answer is: All of the above
22.For which of the following reason, a compiler is preferred to a interpreter
Select one:
a. It can generate stand-alone programs and often takes less time for execution
b. Debugging can be faster and easier
Feedback
The correct answer is: It can generate stand-alone programs and often takes less time for execution
23.For which of the following reason, a compiler is preferred to a interpreter
Select one:
a. It can generate stand-alone programs and often takes less time for execution
b. Debugging can be faster and easier
Feedback
The correct answer is: It can generate stand-alone programs and often takes less time for execution
24.To design LL parser the grammar should be free from left recursion
Select one:
True
False
Feedback
The correct answer is 'True'.
25.In a compiler, grouping of characters into tokens is done by the
Select one:
a. Code optimizer
b. Parser
c. Code generator
d. Scanner
Feedback
The correct answer is: Scanner
26.In a context free grammar
Select one:
A. ε can not be the right hand side of any production
B. Terminal symbols can not be present in the left hand side of any production
C. The number of grammar symbols in the LHS is not greater than the number of grammar symbols in the RHS
D. All of the above
Feedback
The correct answer is: Terminal symbols can not be present in the left hand side of any production
27.The main difference between DFA and NDFA
Select one:
a. In DFA from any given state there cannot be any alphabet leading to two different states
b. In NDFA empty transition may be present
c. In NDFA from any given state there cannot be any alphabet leading to two different states
d. In DFA empty transition may be present
Feedback
The correct answer is:
In DFA from any given state there cannot be any alphabet leading to two different states
28.A syntax tree
Select one:
a. generates tokens
b. Another name of the parse tree
c. Should not have keywords as leaves
d. Is a condensed form of grammar
Feedback
The correct answer is: Another name of the parse tree
29.Regular expression letter ( letter | digit)* can be used to recognise set of valid identifiers.
Select one:
True
False
Feedback
The correct answer is 'True'.
30.Construction of DFA is easy and implementation of DFA is difficult
Select one:
True
False
Feedback
The correct answer is 'True'.
No comments:
Post a Comment