adplus-dvertising

Welcome to the Compiler Design MCQs Page

Dive deep into the fascinating world of Compiler Design with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Compiler Design, a crucial aspect of GATE CSE Exam. In this section, you will encounter a diverse range of MCQs that cover various aspects of Compiler Design, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within GATE CSE Exam.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Compiler Design. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of GATE CSE Exam.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Compiler Design. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Compiler Design MCQs | Page 2 of 12

Q11.
Which one of the following is a top-down parser?
Discuss
Answer: (a).Recursive descent parser
Q12.
Consider the grammar with non-terminals N = {S,C,S1 },terminals T={a,b,i,t,e}, with S as the start symbol, and the following set of rules:

S --> iCtSS1|a
S1 --> eS|ϵ
C --> b

The grammar is NOT LL(1) because:
Discuss
Answer: (c).it is ambiguous
Q13.
Consider the following two statements:

P: Every regular grammar is LL(1)
Q: Every regular set has a LR(1) grammar

Which of the following is TRUE?
Discuss
Answer: (c).P is false and Q is true
Q14.
Consider the following grammar.

S -> S * E
S -> E
E -> F + E
E -> F
F -> id

Consider the following LR(0) items corresponding to the grammar above.

(i) S -> S * .E
(ii) E -> F. + E
(iii) E -> F + .E

Given the items above, which two of them will appear in the same set in the canonical sets-of-items for the grammar?
Discuss
Answer: (d).None of the above
Discuss
Answer: (d).neither a shift-reduce nor a reduce-reduce conflict
Q16.
Consider the grammar defined by the following production rules, with two operators ∗ and +

S --> T * P
T --> U | T * U
P --> Q + P | Q
Q --> Id
U --> Id

Which one of the following is TRUE?
Discuss
Answer: (b).+ is right associative, while ∗ is left associative
Q17.
Consider the following grammar:

S → FR
R → S | ε
F → id

In the predictive parser table, M, of the grammar the entries M[S, id] and M[R, $] respectively
Discuss
Answer: (a).{S → FR} and {R → ε }
Q18.
Consider the following translation scheme. S → ER R → *E{print("*");}R | ε E → F + E {print("+");} | F F → (S) | id {print(id.value);} Here id is a token that represents an integer and id.value represents the corresponding integer value. For an input '2 * 3 + 4', this translation scheme prints
Discuss
Answer: (d).2 3 4+*
Q19.
The grammar A → AA | (A) | ε is not suitable for predictive-parsing because the grammar is
Discuss
Answer: (b).left-recursive
Q20.
Consider the grammar

E → E + n | E × n | n

For a sentence n + n × n, the handles in the right-sentential form of the reduction are
Discuss
Answer: (d).n, E + n and E × n
Page 2 of 12

Suggested Topics

Are you eager to expand your knowledge beyond Compiler Design? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!