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

Answers COMING SOON! Kindly Wait!

Week 1: Assignment answers
Week 2: Assignment answers
Week 3: Assignment answers
Week 4: Assignment answers
Week 5: Assignment answers
Week 6: Assignment answers
Week 7: Assignment answers
Week 8: Assignment answers
Week 9: Assignment answers
Week 10: Assignment answers
Week 11: Assignment answers
Week 12: Assignment answers

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

Answer: b)

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, $

Answer: a)

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

Answer: c)

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

Answer: b)

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

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

Answer: a)

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

Answer: a)

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

Answer: d)

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

Answer: d)

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}

Answer: b)

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

Answer: a)

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 – Python for Data Science assignment solutions

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.

Leave a Comment

Your email address will not be published. Required fields are marked *