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 PYQ2016Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which one of the following grammars is free from left recursion?
Official PYQ2015Compiler DesignIntermediate Code GenerationNAT · 1 mark
The least number of temporary variables required to create a three-address code in static single assignment form for the expression q+r/3+s−t∗5+u∗v/wq + r / 3 + s - t * 5 + u * v/w is__________________.
Official PYQ2015Compiler DesignData Flow Analyses: Constant Propagation, Liveness, CSEMCQ · 1 mark
A variable xx is said to be live at a statement sis_{i} in a program if the following three conditions hold simultaneously: There exists a statement SjS_{j} that uses xx There is a path from SiS_{i} to SjS_{j} in the flow graph corresponding to the program The path has no intervening assignment to xx including at SiS_{i} and SjS_{j} The …
Official PYQ2015Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which one of the following is TRUE at any valid state in shift-reduce parsing?
Official PYQ2015Compiler DesignIntermediate Code GenerationMCQ · 1 mark
For computer based on three-address instruction formats, each address field can be used to specify which of the following: (S1) A memory operand (S2) A processor register (S3) An implied accumulator register
Official PYQ2015Compiler DesignIntermediate Code GenerationMCQ · 1 mark
Consider the intermediate code given below. (1) i=1 (2) j=1 (3) t1 = 5 * i (4) t2 = t1 + j (5) t3 = 4 * t2 (6) t4 = t3 (7) a[t4] = -1 (8) j = j + 1 (9) if j <= 5 goto (3) (10) i = i +1 (11) if i < 5 goto (2) The number of nodes and edges in control-flow-graph constructed for the above code, respectively, are
Official PYQ2015Compiler DesignLexical AnalysisMCQ · 1 mark
Match the following: …
Official PYQ2015Compiler DesignLocal OptimizationMCQ · 1 mark
In the context of abstract-syntax-tree (AST) and control-flow-graph (CFG), which one of the following is TRUE?
Official PYQ2015Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following grammar G S→F∣HS \rightarrow F \mid H F→p∣cF \rightarrow p \mid c H→d∣cH \rightarrow d \mid c Where SS, FF, and HH are non-terminal symbols, p,dp, d, and cc are terminal symbols. Which of the following statement(s) is/are correct? S1: LL(1) can parse all strings that are generated using grammar G S2: LR(1) can parse all …
Official PYQ2015Compiler DesignParsing (LL, LR)MCQ · 1 mark
Among simple LR (SLR), canonical LR, and look-ahead LR (LALR), which of the following pairs identify the method that is very easy to implement and the method that is the most powerful, in that order?
Official PYQ2014Compiler DesignParsing (LL, LR)MCQ · 1 mark
A canonical set of items is given below S→L.>RS \to L .> R Q→R.Q \to R. On input symbol << the set has
Official PYQ2014Compiler DesignLocal OptimizationMCQ · 1 mark
Which one of the following is FALSE?
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 PYQ2014Compiler DesignIntermediate Code GenerationMCQ · 1 mark
For a C program accessing X[i][j][k]\mathbf{X[i] [j] [k]}, the following intermediate code is generated by a compiler. Assume that the size of an integer is 3232 bits and the size of a character is 88 bits. t0 = i ∗ 1024 t1 = j ∗ 32 t2 = k ∗ 4 t3 = t1 + t0 t4 = t3 + t2 t5 = X[t4] Which one of the following statements about the source code for the C program is …
Official PYQ2014Compiler DesignRuntime EnvironmentsMCQ · 1 mark
Which one of the following is NOT performed during compilation?
Official PYQ2014Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the grammar defined by the following production rules, with two operators ∗∗ and ++ S → T∗PS\:\to\:T∗P T → U∣T∗UT\:\to\:U\mid T∗U P → Q+P∣QP\:\to\:Q+P\mid Q Q →IdQ\:\to Id U →IdU\:\to Id Which one of the following is TRUE?
Official PYQ2014Compiler DesignLocal OptimizationMCQ · 1 mark
Consider the basic block given below. a = b + c c = a + d d = b + c e = d - b a = e + b The minimum number of nodes and edges present in the DAG representation of the above basic block respectively are
Official PYQ2014Compiler DesignIntermediate Code GenerationMCQ · 1 mark
One of the purposes of using intermediate code in compilers is to
Official PYQ2014Compiler DesignRuntime EnvironmentsMCQ · 1 mark
Which of the following statements are CORRECT? Static allocation of all data areas by a compiler makes it impossible to implement recursion. Automatic garbage collection is essential to implement recursion. Dynamic allocation of activation records is essential to implement recursion. Both heap and stack are essential to implement recursion.
Official PYQ2014Compiler DesignLocal OptimizationNAT · 1 mark
The minimum number of arithmetic operations required to evaluate the polynomial P(X)=X5+4X3+6X+5P(X) = X^5+4X^3+6X+5 for a given value of XX, using only one temporary variable is ______.