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
The following code segment is executed on a processor which allows only register operands in its instructions. Each instruction can have atmost two source operands and one destination operand. Assume that all variables are dead after this code segment. c = a + b; d = c * a; e = c + a; x = c * c; if (x > a) { y = a * a; } else { d = d * d; e = e * e; } …
The following code segment is executed on a processor which allows only register operands in its instructions. Each instruction can have atmost two source operands and one destination operand. Assume that all variables are dead after this code segment. c = a + b; d = c * a; e = c + a; x = c * c; if (x > a) { y = a * a; } else { d = d * d; e = e * e; } …
Consider the following two sets of items of an grammar.Which of the following statements related to merging of the two sets in the corresponding …
What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon and unit-production (i.e., of type and ) to parse a string with tokens?
For the grammar below, a partial parsing table is also presented along with the grammar. Entries that need to be filled are indicated as and . is the empty string, \$ indicates end of input, and, separates alternate right hand sides of productions. …
Consider evaluating the following expression tree on a machine with load-store architecture in which memory can be accessed only through load and store instructions. The variables and are initially stored in memory. The binary operators used in this expression tree can be evaluated by the machine only when operands are in registers. The …
Consider two binary operators and with the precedence of operator being lower than that of the operator . Operator is right associative while operator is left associative. Which one of the following represents the parse tree for expression …
The lexical analysis for a modern computer language such as Java needs the power of which one of the following machine models in a necessary and sufficient sense?
In a compiler, keywords of a language are recognized during
The grammar is
The program below uses six temporary variables . a = 1 b = 10 c = 20 d = a + b e = c + d f = c + e b = c + e e = b + f d = 5 + e return d + f Assuming that all operations take their operands from registers, what is the minimum number of registers needed to execute this program without spilling?
Which languages necessarily need heap allocation in the runtime environment?
Which data structure in a compiler is used for managing information about variables and their attributes?
Which of the following statements are TRUE? There exist parsing algorithms for some programming languages whose complexities are less than A programming language which allows recursion can be implemented with static storage allocation. No L-attributed definition can be evaluated in the framework of bottom-up parsing. Code improving …
Match all items in Group 1 with the correct options from those given in Group 2. …
An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only if
Which of the following are true? A programming language which does not permit global variables of any kind and has no nesting of procedures/functions, but permits recursion can be implemented with static storage allocation Multi-level access link (or display) arrangement is needed to arrange activation records only if the programming language being …
Some code optimizations are carried out on the intermediate code because
Which of the following describes a handle (as applicable to LR-parsing) appropriately?
Which of the following statements are true? Every left-recursive grammar can be converted to a right-recursive grammar and vice-versa All -productions can be removed from any context-free grammar by suitable transformations The language generated by a context-free grammar all of whose productions are of the form or …
