Compiler Design | Questions and Answers

Compiler Design | Mock Test

Question 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

Question 2
If S is the Start symbol, then end marker $ should be placed in FOLLOW of S.
Select one:
a. True
b. False
Feedback
The correct answer is ‘True’.

Question 3
If X is a terminal then FIRST(X) = X
Select one:
a. True
b. False
Feedback
The correct answer is ‘True’.

Question 4
FOLLOW set can be computed for both terminal and variable/non terminal.
Select one:
a. True
b. False
Feedback
The correct answer is ‘False’.

Question 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

Question 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

Question 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

Question 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

Question 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

Question 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