June 10, 2018

Compiler Design - MCQS


Question
In XYZ. the . at the end represents reduce operation

a. True 
b. False

The correct answer is: True

Question 
Classes of languages accepted by NFA and its equivalent DFA are different

a. False 
b. True

The correct answer is: False

Question
LL parser is an example for Bottom - up parser design

a. True
b. False 

The correct answer is: False

Question
predictive parser can be

a. Constructive
b. Non Recursive
c. Recursive 
d. Recursive and constructive

The correct answer is: Recursive

Question
The run time environment represents recursive call as Activation Record

a. True 
b. False

The correct answer is: True

Question
the statement followed by a conditional jump is a leader

a. True 
b. False

The correct answer is: True

Question
Which of the following software tool  is  a parser generator ?

a. YACC 
b. Lex
c. Lex & YACC
d. None of these

The correct answer is: YACC

Question
Push - Down Automata is used for parser designs

a. True 
b. False

The correct answer is: True

Question
In DAG form of the Abstract Syntax Tree the common sub-expressions are

eliminated
a. False
b. True 

The correct answer is: True

Question
Parsing is also Known as:

a. Syntax Analysis 
b. Lexical Analysis
c. Code generation
d. Semantic  Analysis

The correct answer is: Syntax Analysis

Question
In a two pass assembler the object code generation is done during the ?

a. None of these
b. First pass
c. Zeroed  Pass
d. Second pass 

The correct answer is: Second pass

Question
The intermediate code representation for JAVA is

a. Java byte code 
b. Java source
c. MSIL
d. Java CIL

The correct answer is: Java byte code

Question
Yet Another Compiler's Compiler  is a tool for

a. code optimization
b. Syntax analysis
c. Lexical analysis 
d. Intermediate code generation

The correct answer is: Syntax analysis

Question
The first and last statements in a Basic block can be leaders

a. False 
b. True

The correct answer is: False

Question
The linux command grep stands

a. none of the above
b. gedit row edit print
c. global regular execute pattern
d. globally search a regular expression and print 

The correct answer is: globally search a regular expression and print

Question
copy statement x = y is not in three address code format

a. False 
b. True

The correct answer is: False

Question
x = y + z is an example for three - address code

a. False
b. True 

The correct answer is: True

Question
In X.YZ the . in between  represents shift operation

a. True
b. False 

The correct answer is: True

Question
LR parser is an example for Top - down design for parser

a. False 
b. True

The correct answer is: False

Question
The statement followed by an unconditional jump is a leader

a. True 
b. False


The correct answer is: False

Question
Top down parsing is also known as 

A. LR parser
B. LL parser 
C. LALR parser
D. None of the above

The correct answer is: LL parser

Question
In a context free grammar

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 

The correct answer is: Terminal symbols can not be present in the left hand side of any production

Question
A given grammar is said to be ambiguous if

a. A derivation tree has more than one associated sentence
b. Parentheses are not present in the grammar
c. Two or more production has the same non-terminal on the LHS
d. There is a sentence with more than one derivation tree corresponding to it 

The correct answer is: There is a sentence with more than one derivation tree corresponding to it

Question
Lexical analyzer can not eliminate white spaces

True
False 

The correct answer is 'False'.

Question
Lexical Analyzer is the only phase which reads the complete source program.

True 
False

The correct answer is 'True'.

Question
The Grammar S --> Aa | b    S --> Ac | Sd is not left recursive.

True
False 

The correct answer is 'False'.

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

True
False 

The correct answer is 'False'.

Question
Regular expressions are an important notation for specifying tokens

True
False 

The correct answer is 'True'.

Question
YACC is a:

A. Lexical analyzer generator
B. Parser generator 
C. Semantic analyzer
D. None of the above

The correct answer is: Parser generator

Question
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
The most preferred data structure to implement Symbol table is Hash table.

True 
False

The correct answer is 'True'.

Question
The grammar S --> a S b | b S a can be used to generate palindromes over {a, b}

True 
False

The correct answer is 'True'.

Question
An ideal Compiler should

A. Be smaller in size
B. Takes less time for compilation
C. Be written in a high level language
D. All of the above 

The correct answer is: All of the above

Question
In regular expression notation * represents one or more occurrence of the preceding symbol. 

True
False 

The correct answer is 'False'.

Question
Finite automata can be used to count the number of symbols read.

True 
False

The correct answer is 'False'.

Question
What are the stages in the compilation process?

A. Feasibility study system design and testing
B. Implementation and documentation
C. Lexical analysis, syntax analysis and code generation 
D. All of the above

The correct answer is: Lexical analysis, syntax analysis and code generation

Question
Shift reduce parsing is a type of Top down design.

True
False 

The correct answer is 'False'.

Question
The language recognised by DFA is known as

a. Non CFL
b. Non Regular Language
c. Regular language 
d. Context Free Language

The correct answer is: Regular language

Question
A top down parser generates 

a. Right most derivation in reverse
b. Right most derivation
c. Left most derivation 
d. Left  most derivation in reverse

The correct answer is: Left most derivation

Question
A bottom up parser generates

a. Right most derivation in reverse 
b. Right most derivation
c. Left most derivation
d. Left  most derivation in reverse

The correct answer is: Right most derivation in reverse

Question
If X is a terminal then FIRST(X) = X

True 
False

The correct answer is 'True'.

Question
The main difference between DFA and NDFA
a. In NDFA from any given state there cannot be any alphabet leading to two different states
b. In NDFA empty transition may be present
c. 
In DFA from any given state there cannot be any alphabet leading to two different states 
d. In DFA empty transition may be present

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

Question
Top down parsing is also known as 

A. LR parser
B. LL parser 
C. LALR parser
D. None of the above

The correct answer is: LL parser

Question
In a compiler, grouping of characters into tokens is done by the

a. Scanner 
b. Code optimizer
c. Code generator
d. Parser

The correct answer is: Scanner

Question
Given grammar 

S --> (L) | a

L --> L, S | S

Which of the input recognised by the grammar

A. ((a, a), a)
B. (a,a) 
C. ((a, a,a),a)
D. All of the above

The correct answer is: All of the above

Question
Regular expression   letter ( letter | digit)*  can be used to recognise set of valid identifiers.

True 
False

The correct answer is 'True'.

Question
In Left most derivation left most terminal should be replaced by a terminal or non terminal.

True
False 

The correct answer is 'False'.

Question
If S is the Start symbol, then end marker $ should be placed in FOLLOW of S.

True 
False

The correct answer is 'True'.

Question
Construction of DFA is easy and implementation of DFA is difficult

True 
False

The correct answer is 'True'.

Question
In LL parser, LL stands for

a. Left to right and LMD  
b. Right to left
c. Left to right
d. Left to right reducing


The correct answer is: Left to right and LMD

Question.
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

Answer: It can generate stand-alone programs and often takes less time for execution

Question.
To design LL parser the grammar should be free from left recursion
Select one:
a. True
b. False

Answer: True

Question.
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

Answer: Another name of the parse tree

Question.
Regular expression letter ( letter | digit)* can be used to recognise set of valid identifiers.
Select one:
a. True
b. False

Answer: True



Question.
In X.YZ the . in between represents shift operation
Select one:
a. False
b. True

Answer: True

Question.
FIRST of a terminal is always a terminal
Select one:
a. False
b. True

Answer: True

Question.
LL parser is an example for Bottom – up parser design
Select one:
a. True
b. False

Answer: False

Question.
Yet Another Compiler’s Compiler is a tool for
Select one:
a. code optimization
b. Intermediate code generation
c. Lexical analysis
d. Syntax analysis

Answer: Syntax analysis

Question.
Push – Down Automata is used for parser designs
Select one:
a. False
b. True

Answer: True

Question.
x = y + z is an example for three – address code
Select one:
a. True
b. False

Answer: True



Question.
LR parser is an example for Top – down design for parser
Select one:
a. False
b. True

Answer: False

Question.
FOLLOW set is computed for only non-terminals/variables
Select one:
a. False
b. True

Answer: True

Question.
Control Flow Graph uses stack based address format
Select one:
a. True
b. False

Answer: False