# Compiler Design | NPTEL 2022 | Week 5 Assignment Solutions

This set of MCQ(multiple choice questions) focuses on the Compiler Design NPTEL 2022 Week 5 Assignment Solutions.

### Course layout

NOTE: You can check your answer immediately by clicking show answer button. This set of “Compiler Design NPTEL 2022 Week 5 Assignment Solution” contains 10 questions.

Now, start attempting the quiz.

### Compiler Design NPTEL 2022 Week 5 Assignment Solutions

Q1. Consider the grammar {E -> E + E | E * E |id}. For the string “id1 + id2 * id3”, in a shift-reduce parsing, the rule applied for the fourth reduction is

a) E -> E + E
b) E -> E * E
c) E -> id
d) None of the other options

Q2. For the grammar
S -> AB | C
A -> bA | a
B -> abbS | bS |E
C -> bC | E
Follow(A) is

a) a, b, \$
b) a, \$
c) a, b
d) b, \$

Q3. In shift-reduce parsing, handle is at

a) Anywhere in the stack
b) Bottom of the stack
c) Top of the stack
d) Nowhere in the stack

Q4. A bottom-up parser generates

a) Left-most derivation in reverse
b) Right-most derivation in reverse
c) Left-most derivation
d) Right-most derivation

Q5. In shift-reduce parsing, an accepted input string reduces to

a) Start symbol
b) \$
c) Null
d) None of the other options

Compiler Design NPTEL week 5 Assignment Solutions

Q6. In Operator Precedence parsing handle is

a) Between < and >
b) After >
c) Before <
d) None of the other options

Q7. An operator-precedence parser is a

a) Shift-reduce parser
b) Bottom-up parser
c) Parser constructing derivation in the reverse
d) All of the other options

Compiler Design NPTEL week 5 Assignment Solutions

Q8. An optimizer Compiler ______________

a) Is optimized to occupy less space
b) Is optimized to occupy less space & Optimize the code
c) Optimize the code
d) None of the mentioned

Compiler Design NPTEL week 5 Assignment Solutions

Q9. For the grammar rule T -> xyyS | yS, Firstop(T) equals

a) {x}
b) {x, y, S}
c) {x, y}
d) {S}

Q10. By considering the rule B -> tqqS, which of the precedence relations between t and q can be inferred?

a) t = q and q = q
b) t = q only
c) q = t and t = q
d) q = t and q = q

Compiler Design NPTEL week 5 Assignment Solutions

<< Prev- Compiler Design Week 4 Assignment Solutions

>> Next- Compiler Design Week 6 Assignment Solutions

`DISCLAIMER: Use these answers only for the reference purpose. Quizermania doesn't claim these answers to be 100% correct. So, make sure you submit your assignments on the basis of your knowledge.`

NPTEL answers: Problem solving through programming in C

Programming in Java NPTEL week 1 quiz answers

Nptel – Deep Learning assignment solutions

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.