Skip to content

GATE CS Compiler Design questions

Practise Compiler Design questions for GATE CS. Explore official PYQs and original subject-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.

20 on this page
Official PYQ2004Compiler DesignSyntax-directed TranslationMCQ · 1 mark
Consider the grammar with the following translation rules and EE as the start symbol …
Official PYQ2004Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider a program PP that consists of two source modules M1M_1 and M2M_2 contained in two different files. If M1M_1 contains a reference to a function defined in M2M_2 the reference will be resolved at
Official PYQ2004Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which of the following grammar rules violate the requirements of an operator grammar? P,Q,RP, Q, R are nonterminals, and r,s,tr, s, t are terminals. P→QRP \rightarrow Q R P→QsRP \rightarrow Q s R P→ εP \rightarrow \: \varepsilon P→QtRrP \rightarrow Q t R r
Official PYQ2004Compiler DesignRuntime EnvironmentsMCQ · 1 mark
Consider the following function void swap(int a, int b) { int temp; temp = a; a = b; b = temp; } In order to exchange the values of two variables xx and yy.
Official PYQ2003Compiler DesignRuntime EnvironmentsMCQ · 1 mark
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions. global int i=100, j=5; void P(x) { int i=10; print(x+10); i=200; j=20; print (x); } main() {P(i+j);} If the programming language uses dynamic scoping and call by name parameter passing mechanism, the values …
Official PYQ2003Compiler DesignRuntime EnvironmentsMCQ · 1 mark
Which of the following is NOT an advantage of using shared, dynamically linked libraries as opposed to using statistically linked libraries?
Official PYQ2003Compiler DesignSyntax-directed TranslationMCQ · 1 mark
Consider the syntax directed definition shown below. …
Official PYQ2003Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the translation scheme shown below. S→T  RS \rightarrow T\;R R→+T{print(‘+’);}R∣εR \rightarrow + T \{\text{print}(‘+’);\} R\mid \varepsilon T→T \rightarrow num {print\{\text{print}(num.val);};\} Here num is a token that represents an integer and num.val represents the corresponding integer value. For an input string ‘9+5+29 + 5 + 2’, this translation scheme will …
Official PYQ2003Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the grammar shown below. S→C CS \rightarrow C \ C C→c C∣dC \rightarrow c \ C \mid d This grammar is
Official PYQ2003Compiler DesignParsing (LL, LR)MCQ · 1 mark
Assume that the SLR parser for a grammar G has n1n_1 states and the LALR parser for G has n2n_2 states. The relationship between n1n_1 and n2n_2 is
Official PYQ2003Compiler DesignSyntax-directed TranslationMCQ · 1 mark
In a bottom-up evaluation of a syntax directed definition, inherited attributes can
Official PYQ2003Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar?
Official PYQ2002Compiler DesignRuntime EnvironmentsMCQ · 1 mark
Dynamic linking can cause security concerns because
Official PYQ2002Compiler DesignParsing (LL, LR)MCQ · 1 mark
To evaluate an expression without any embedded function calls
Official PYQ2001Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which of the following statements is false?
Official PYQ2001Compiler DesignRuntime EnvironmentsMCQ · 1 mark
The process of assigning load addresses to the various parts of the program and adjusting the code and the data in the program to reflect the assigned addresses is called
Official PYQ2000Compiler DesignParsing (LL, LR)MCQ · 1 mark
Given the following expression grammar: E→E∗F∣F+E∣FF→F−F∣id\begin{align} E &\to E * F \mid F + E \mid F \\[1em] F &\to F - F \mid id \end{align} Which of the following is true?
Official PYQ2000Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which of the following derivations does a top-down parser use while parsing an input string? The input is scanned from left to right.
Official PYQ2000Compiler DesignLexical AnalysisMCQ · 1 mark
The number of tokens in the following C statement is printf("i=%d, &i=%x", i, &i);
Official PYQ1999Compiler DesignParsing (LL, LR)MCQ · 1 mark
A grammar that is both left and right recursive for a non-terminal, is