NPTEL Online Certification Courses Indian
Institute of Technology Kharagpur
Compiler Design
Assignment- Week 5
TYPE OF QUESTION:MCQ
Number ofquestions:12 Total mark: 12 X 1 = 12
1. In shift-reduce parsing, handle is at
a) Top of the stack
b) bottom of the stack
c) Anywhere in the stack
d) Nowhere in the stack
Ans: a)
2. Which of the following conflicts is not possible in shift-reduce parsing
a) Reduce-reduce conflict
b) Shift-reduce conflict
c) Shift-shift conflict
d) None of the other options
Ans: c)
3. Which one of the following is true at any valid state in shift-reduce parsing
a) At the bottom we find the prefixes
b) None of the mentioned
c) Stack contains only viable prefixes
d) Stack consists of viable prefixes
Ans: c)
4. For the grammar
S → AB | C
A → bA | a
B → abbS | bS | ε
C → bC | ε
Follow(A) is
a) a, $
b) a , b , $
c) a, b
d) b , $
Answer: b)
5. Shift reduce parsers are
a) Top down Parser
b) Bottom up Parser
c) May be top down or bottom up
d) None of the mentioned
Answer: b)
6. In shift-reduce parsing, handle is at
a) Top of the stack
b) Bottom of the stack
c) Anywhere in the stack
d) Nowhere in the stack
Answer: a)
7. In Operator Precedence parsing handle is
a) Before <·
b) After ·>
c) Between <· and ·>
d) None of the other options
Answer: c)
8. By considering the rule B → abbS, which of the precedence relations between a and b
can be inferred?
(A) a ≐ b only
(B) a ≐ b and b≐ b
(C) b≐ a and a ≐ b
(D) b≐ a and b≐ b
Ans: b)
9. An operator-precedence parser is a
a) Shift-reduce parser
b) Bottom-up parser
c) Parser constructing derivation in the reverse
d) All the other options
Ans: d)
10. For the grammar rule B → abbS | bS, Firstop(B) equals
a) {a}
b) {a, b }
c) {a , b , S}
d) { S }
Ans: c)
11. For the grammar
A → BCx | y
B → yA | ε
C → Ay | x
In Predictive Parsing table the cell having multiple entries is
(A) M[A, x]
(B) M[C, y]
(C) M[B, y]
(D) M[B, x]
Ans: C
12. Bottom up parsing involves
a) Shift reduce
b) Handle pruning
c) None of the mentioned
d) Both shift reduce and handle pruning
Ans: d)
END of Assignment