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
Consider the following augmented grammar with as the set of terminals. Let …
Consider the following statements. Symbol table is accessed only during lexical analysis and syntax analysis. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment. Errors violating the condition ‘any variable must be declared before its use’ are detected during syntax …
Consider the following grammar. The number of reduction steps taken by a bottom-up parser while accepting the string is ___________.
Consider the productions and . Each of the five non-terminals and has two attributes: is a synthesized attribute, and is an inherited attribute. Consider the following rules. Rule and Rule and …
Which one of the following kinds of derivation is used by LR parsers?
Consider the following grammar and the semantic actions to support the inherited type declaration attributes. Let , and be the placeholders for the non-terminals or in the following table: …
Consider the augmented grammar given below: Let The number of items in the set is______
A lexical analyzer uses the following patterns to recognize three tokens , and over the alphabet . Note that ‘’ means or occurrence of the symbol Note also that the analyzer outputs the token that matches the …
Which one of the following statements is FALSE?
Consider the expression . Let be the minimum number of registers required by an optimal code generation (without any register spill) algorithm for a load/store architecture, in which only load and store instructions can have memory operands and arithmetic instructions can have only register or immediate operands. The …
Consider the following grammar: stmt if expr then expr else expr; stmt | expr term relop term | term term id | number id a | b | c number where relop is a relational operator e.g., refers to the empty statement, and if, then, else …
Consider the following intermediate program in three address code p = a - b q = p * c p = u * v q = p + q Which one of the following corresponds to a static single assignment form of the above code?
Match the following according to input (from the left column) to the compiler phase (in the right column) that processes it: …
Consider the following expression grammar : Which of the following grammars is not left recursive, but is equivalent to ?
Which of the following statements about parser is/are CORRECT? is more powerful than is more powerful than is more powerful than
What will be the output of the following pseudo-code when parameters are passed by reference and dynamic scoping is assumed? a = 3; void n(x) { x = x * a; print (x); } void m(y) { a = 1 ; a = y - a; n(a); print (a); } void main () { m(a); }
Consider the following Syntax Directed Translation Scheme , with non-terminals and terminals . Using the above , the output printed by a bottom-up parser, for the input is:
The attribute of three arithmetic operators in some programming language are given below. …
Consider the following code segment. x = u - t; y = x * v; x = y + w; y = t - z; y = x * y; The minimum number of total variables required to convert the above code segment to static single assignment form is __________.
A student wrote two context-free grammars G1 and G2 for generating a single C-like array declaration. The dimension of the array is at least one. For example, int a[10] [3]; The grammars use D as the start symbol, and use six terminal symbols int ; id [ ] num. …
