Skip to content

GATE CS Syntax-directed Translation questions

Practise Syntax-directed Translation questions for GATE CS. Explore official PYQs and original topic-wise quizzes, check answers and view available solutions. Free, no sign-in.

Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.

15 on this page
Official PYQ2026Compiler DesignSyntax-directed TranslationMSQ · 2 marks
Consider the following two syntax-directed definitions SDD1\text{SDD1} and SDD2\text{SDD2} for type declarations. …
Official PYQ2025Compiler DesignSyntax-directed TranslationMCQ · 1 mark
​​Given the following syntax directed translation rules: Rule 1: R→AB{B.i=R.i−1;A.i=B.i;R.i=A.i+1;}R \rightarrow A B\{B . i=R . i-1 ; A . i=B . i ; R . i=A . i+1 ;\} Rule 2: P→CD{P.i=C.i+D.i;D.i=C.i+2;}P \rightarrow C D\{P . i=C . i+D . i ; D . i=C . i+2 ;\} Rule 3: Q→EF{Q.i=E.i+F.i;}Q \rightarrow E F\{Q . i=E . i+F . i ;\} Which ONE is the CORRECT option among the following?
Official PYQ2024Compiler DesignSyntax-directed TranslationMCQ · 2 marks
​Consider the following syntax-directed definition (SDD)\text{(SDD)}. …
Official PYQ2024Compiler DesignSyntax-directed TranslationMSQ · 1 mark
​​​​​Which of the following statements is/are FALSE?
Official PYQ2023Compiler DesignSyntax-directed TranslationNAT · 2 marks
Consider the syntax directed translation given by the following grammar and semantic rules. Here N,I,FN, I, F and BB are non-terminals. NN is the starting non-terminal, and #,0\#, \mathbf{0} and 1\mathbf{1} are lexical tokens corresponding to input letters “#", “0" and “1",\text{“\#", “0" and “1"}, respectively. X.valX.val denotes the synthesized attribute (a …
Official PYQ2022Compiler DesignSyntax-directed TranslationNAT · 2 marks
Consider the following grammar along with translation rules. …
Official PYQ2021Compiler DesignSyntax-directed TranslationMCQ · 2 marks
​​​Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT)\text{(SDT)} actions, given as pseudo-code …
Official PYQ2020Compiler DesignSyntax-directed TranslationMCQ · 2 marks
Consider the productions A→PQA \rightarrow PQ and A→XYA \rightarrow XY. Each of the five non-terminals A,P,Q,X,A, P, Q, X, and YY has two attributes: ss is a synthesized attribute, and ii is an inherited attribute. Consider the following rules. Rule 1:P.i=A.i+2, Q.i=P.i+A.i,1: P . i = A.i + 2, \: Q.i = P. i + A.i, and A.s=P.s+Q.sA.s = P.s +Q. s Rule 2:X.i=A.i+Y.s2: X.i = A.i + Y.s and …
Official PYQ2019Compiler DesignSyntax-directed TranslationMCQ · 2 marks
Consider the following grammar and the semantic actions to support the inherited type declaration attributes. Let X1,X2,X3,X4,X5X_1, X_2, X_3, X_4, X_5, and X6X_6 be the placeholders for the non-terminals D,T,LD, T, L or L1L_1 in the following table: …
Official PYQ2016Compiler DesignSyntax-directed TranslationMCQ · 1 mark
Consider the following Syntax Directed Translation Scheme (SDTS)( SDTS ), with non-terminals {S,A}\{S,A \} and terminals {a,b}\{a,b \}. S→aA{print 1}S \to aA \quad \{\text{print }1\} S→a{print 2}S \to a \quad \{\text{print }2\} A→Sb{print 3}A \to Sb \quad \{\text{print }3\} Using the above SDTSSDTS , the output printed by a bottom-up parser, for the input aabaab is:
Official PYQ2014Compiler DesignSyntax-directed TranslationNAT · 1 mark
Consider the expression tree shown. Each leaf represents a numerical value, which can either be 00 or 11. Over all possible choices of the values at the leaves, the maximum possible value of the expression represented by the tree is ___.
Official PYQ2004Compiler DesignSyntax-directed TranslationMCQ · 1 mark
Consider the grammar with the following translation rules and EE as the start symbol …
Official PYQ2003Compiler DesignSyntax-directed TranslationMCQ · 1 mark
Consider the syntax directed definition shown below. …
Official PYQ2003Compiler DesignSyntax-directed TranslationMCQ · 1 mark
In a bottom-up evaluation of a syntax directed definition, inherited attributes can
Official PYQ1995Compiler DesignSyntax-directed TranslationMCQ · 1 mark
A shift reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of grammar S→xxW  print“1"S \rightarrow xxW \;\text{{print“1"}} S→y  print“2"S \rightarrow y \;\text{{print“2"}} W→Sz  print“3"W \rightarrow Sz\; \text{{print“3"}} What is the translation of xxxxyzzxxxxyzz using the syntax directed translation scheme described by the …