Tuesday, 1 November 2016

Compiler Design : MCQ



                             

                     Compiler Design (MCQ)




Question 1:
 
A syntax tree
Should not have keywords as leaves
generates tokens
Is a condensed form of grammar
Another name of the parse tree
The correct answer is: Another name of the parse tree

Question 2:

Construction of DFA is easy and implementation of DFA is difficult
True
False
The correct answer is 'True'.

Question 3:

Top down parsing is also known as
LALR parser
LL parser
LR parser
None of the above

Your answer is correct.
The correct answer is: LL parser

Question 4:

A bottom up parser generates
Right most derivation
Left  most derivation in reverse
Right most derivation in reverse
Left most derivation

The correct answer is: Right most derivation in reverse

Question 5:

YACC is a:

Lexical analyzer generator
Semantic analyzer
Parser generator
None of the above

The correct answer is: Parser generator

Question 6:

Finite automata can be used to count the number of symbols read.
Select one:
True
False

The correct answer is 'False'.

Question 7:

To design LL parser the grammar should be free from left recursion
True
False

The correct answer is 'True'.

Question 8:

LR stands for

Left to right
Left to right reducing
Left to right and RMD in reverse
Right to left

The correct answer is: Left to right and RMD in reverse

Question 9:

In regular expression notation * represents one or more occurrence of the preceding symbol. 
Select one:
True
False

The correct answer is 'False'.

Question 10:

Top down parsing is also known as
LL parser
None of the above
LALR parser
LR parser

The correct answer is: LL parser

Question 11:

In a context free grammar

The number of grammar symbols in the LHS is not greater than the number of grammar symbols in the RHS
All of the above
Terminal symbols can not be present in the left hand side of any production
ε can not be the right hand side of any production
The correct answer is: Terminal symbols can not be present in the left hand side of any production

Question 12:

FOLLOW set can be computed for both terminal and variable/non terminal.
True
False

The correct answer is 'False'.

Question 13:

The symbol table is a data structure containing a record for each variable name, with fields for the attributes of the name.
True
False

The correct answer is 'True'.

Question 14:

The main difference between DFA and NDFA
Select one:
In DFA empty transition may be present
In NDFA empty transition may be present
In NDFA from any given state there cannot be any alphabet leading to two different states

In DFA from any given state there cannot be any alphabet leading to two different states

The correct answer is:
In DFA from any given state there cannot be any alphabet leading to two different states

Question 15

The grammar E -->  E+E | E*E | a

Ambiguous
Unambiguous
None of the above
Depends on the given sentence

The correct answer is: Ambiguous

Question 16

The language recognised by DFA is known as
Context Free Language
Non CFL
Non Regular Language
Regular language

The correct answer is: Regular language

Question 17

Given grammar 
S --> (L) | a
L --> L, S | S
Which of the input recognised by the grammar

((a, a,a),a)
(a,a)
((a, a), a)
All of the above

The correct answer is: All of the above


Question 18

For which of the following reason, a compiler is preferred to a interpreter
Debugging can be faster and easier
It can generate stand-alone programs and often takes less time for execution

The correct answer is: It can generate stand-alone programs and often takes less time for execution

Question 19

The derivation of any string/sentence should always begin from Start symbol S.
Select one:
True
False

The correct answer is 'True'.

Question 20

LEX is a:

Select one:

A parser generator

Token generator

Code generator

None of the above
 
The correct answer is:
Token generator

No comments:

Post a Comment