adplus-dvertising

Welcome to the Syntax Directed Definition and Translations MCQs Page

Dive deep into the fascinating world of Syntax Directed Definition and Translations with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Syntax Directed Definition and Translations, a crucial aspect of Compiler Design. In this section, you will encounter a diverse range of MCQs that cover various aspects of Syntax Directed Definition and Translations, 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 Compiler Design.

frame-decoration

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

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

Syntax Directed Definition and Translations MCQs | Page 3 of 12

Q21.
Which grammar violate rules of an operator grammar?
(i) P-> QR

(ii) P -> Q s R

(iii) P -> ε

(iv) P ->Q t
Discuss
Answer: (b).(i) and (iii) only
Q22.
Consider the grammar rule
E -> E1 − E2 for arithmetic expressions.

If E1 and E2 do not have any common sub expression, in order to get the shortest possible code
Discuss
Answer: (b).E2 should be evaluated first
Q23.
The grammar
A ->AA |( A)| ε
is not suitable for predictive-parsing because the grammar is
Discuss
Answer: (a).Ambiguous
Q24.
Consider the grammar
E ->E + n | E # n | n

For a sentence n + n, form of the reduction are
Discuss
Answer: (d).n , E + n and E # n
Q25.
S -> (S)| a
Let the number of states in SLR(1), LR(1) and LALR(1) parsers for the grammar n1 n2 and n3 respectively.
Discuss
Answer: (b).n1 = n3 < n2
Q26.
Consider line 3:

Int main()

{ int 1,N;

Fro (I,1 N,1);

}

Identify the compiler’s response about this line while creating the object-module
Discuss
Answer: (c).Only syntactic errors
Discuss
Answer: (c).It detects shift-reduce conflict, and resolves the conflict in favor of a shift over a reduce action
Discuss
Answer: (b).Equal precedence and right associativity, expression is evaluated to 9
Q29.
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: (c).(i) and (iii)
Q30.
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 ” ε}
Page 3 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!