Compiler Design | Questions and Answers

Compiler Design | Mock Test

Question 1
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
[bg_collapse view=”button-green” color=”#FFF” icon=”arrow” expand_text=”Show Answer” collapse_text=”Hide Answer” ] Feedback
The correct answer is: All of the above
[/bg_collapse]
Question 2
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
[bg_collapse view=”button-green” color=”#FFF” icon=”arrow” expand_text=”Show Answer” collapse_text=”Hide Answer” ] Feedback
The correct answer is: It can generate stand-alone programs and often takes less time for execution
[/bg_collapse]
Question 3
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
[bg_collapse view=”button-green” color=”#FFF” icon=”arrow” expand_text=”Show Answer” collapse_text=”Hide Answer” ] Feedback
The correct answer is: It can generate stand-alone programs and often takes less time for execution
[/bg_collapse]
Question 4
To design LL parser the grammar should be free from left recursion
Select one:
a. True
b. False
[bg_collapse view=”button-green” color=”#FFF” icon=”arrow” expand_text=”Show Answer” collapse_text=”Hide Answer” ] Feedback
The correct answer is ‘True’.
[/bg_collapse]
Question 5
In a compiler, grouping of characters into tokens is done by the
Select one:
a. Code optimizer
b. Parser
c. Code generator
d. Scanner
[bg_collapse view=”button-green” color=”#FFF” icon=”arrow” expand_text=”Show Answer” collapse_text=”Hide Answer” ] Feedback
The correct answer is: Scanner
[/bg_collapse]
Question 6
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
[bg_collapse view=”button-green” color=”#FFF” icon=”arrow” expand_text=”Show Answer” collapse_text=”Hide Answer” ] Feedback
The correct answer is: Terminal symbols can not be present in the left hand side of any production
[/bg_collapse]
Question 7
Remove flag
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
[bg_collapse view=”button-green” color=”#FFF” icon=”arrow” expand_text=”Show Answer” collapse_text=”Hide Answer” ] Feedback
The correct answer is:
In DFA from any given state there cannot be any alphabet leading to two different states
[/bg_collapse]
Question 8
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
[bg_collapse view=”button-green” color=”#FFF” icon=”arrow” expand_text=”Show Answer” collapse_text=”Hide Answer” ] Feedback
The correct answer is: Another name of the parse tree
[/bg_collapse]
Question 9
Regular expression letter ( letter | digit)* can be used to recognise set of valid identifiers.
Select one:
a. True
b. False
[bg_collapse view=”button-green” color=”#FFF” icon=”arrow” expand_text=”Show Answer” collapse_text=”Hide Answer” ] Feedback
The correct answer is ‘True’.
[/bg_collapse]
Question 10
Construction of DFA is easy and implementation of DFA is difficult
Select one:
a. True
b. False
[bg_collapse view=”button-green” color=”#FFF” icon=”arrow” expand_text=”Show Answer” collapse_text=”Hide Answer” ] Feedback
The correct answer is ‘True’.
[/bg_collapse]