Compiler Design Unit 2
Compiler Design Unit 2
1) A grammar that produces more than one parse tree for some sentence is called___________
a) Ambiguous
b) Non-Ambiguous
c) Regular
d) None of the mentioned
2) Syntax Analyser is also known as ___________
a) Hierarchical Analysis
b) Hierarchical Parsing
c) None of the mentioned
d) Hierarchical Analysis & Parsing
3) Syntax Analyser takes Groups Tokens of source Program into Grammatical Production.
a) True
b) False
4) Which of these features of assembler are Machine-Dependent?
a) Instruction formats
b) Addressing modes
c) Program relocation
d) All of the mentioned
5) The fourth Generation computer was made up of ______________
a) Transistor
b) Vacuum tubes
c) Chips
d) Microprocessor chips
6) Which of the following derivations does a top-down parser use while parsing an input string. The input
is assumed to be scanned in left to right order.
a) Leftmost derivation
b) Rightmost derivation
c) Leftmost derivation traced out in reverse
d) Rightmost derivation traced out in reverse
7) The process of assigning load addresses to the various parts of the program and adjusting the code and data
in the program to reflect the assigned addresses is called___________
a) Assembly
b) Parsing
c) Relocation
d) Symbol Resolution
8) _________is the following statements is false.
a) An unambiguous grammar has the same leftmost and rightmost Derivation
b) An LL(1) parser is a top-down parser
c) LALR is more powerful than SLR
d) An ambiguous grammar can never be LR(k) for any K.
9) __________ is not a LR(0) item.
a) A->. Xyz
b) A->x.yz
c) A->xyz
d) None
10) In LL(1) first L stands for ____
a) Left most derivation
b) Scanning from left to right
c) Both A & B
d) None
Long Answers
E→E+T | T
T→T*F | F
F→F*| a| b
S→ (L) | a L→ L, S | S
a) Give a rightmost derivation for (a,(a, a)) and show the handle of each right-sentential form.
b) Show the steps of a shift reduce parser