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
Let be a context-free grammar in Chomsky Normal Form with and containing variable symbols including the start symbol . The string is derivable from . The number of steps (application of rules) in the derivation is __________.
Consider the following two sets: …
Which of the following statements is/are FALSE?
Consider a context-free grammar with the following rules. Let . Let denote the number of times occur in , respectively. Which of the following statements is/are TRUE?
Consider the following augmented grammar, which is to be parsed with a parser. The set of terminals is Let …
Consider the following statements regarding the front-end and back-end of a compiler. S1: The front-end includes phases that are independent of the target hardware. S2: The back-end includes phases that are specific to the target hardware. S3: The back-end includes phases that are specific to the programming language used in the source code. Identify the …
Consider the following program: int main() { f1 (); f2(2); f3(); return (0); } int f1 () { return(1); } int f2 (int X) { f3(); if (X==1); return f1 (); else return (X * f2 (X - 1)); } int f3 () { return (5); } Which one of the following options represents the activation tree corresponding to the main function?
Consider the control flow graph shown. Which one of the following choices correctly lists the set of live variables at the exit point of each basic block?
Consider the syntax directed translation given by the following grammar and semantic rules. Here and are non-terminals. is the starting non-terminal, and and are lexical tokens corresponding to input letters respectively. denotes the synthesized attribute (a …
Which one of the following statements is
Consider the augmented grammar with as the set of terminals. If is the set of two items , then …
Consider the following grammar along with translation rules. …
Consider the following statements. The sequence of procedure calls corresponds to a preorder traversal of the activation tree. The sequence of procedure returns corresponds to a postorder traversal of the activation tree. Which one of the following options is correct?
Consider the following statements. Every grammar is unambiguous but there are certain unambiguous grammars that are not . For any context-free grammar, there is a parser that takes at most time to parse a string of length . Which one of the following options is correct?
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation actions, given as pseudo-code …
Consider the following context-free grammar where the set of terminals is . …
Consider the following code segment: a = b + c; e = a + 1; d = b + c; f = d + 1; g = e + f; In a compiler, this code segment is represented internally as a directed acyclic graph . The number of nodes in the is _____________
Consider the following program: int main () { Integer x; return 0; } Which one of the following phases in a seven-phase compiler will throw an error?
In the context of compilers, which of the following is/are an intermediate representation of the source program?
Consider the following code segment: z=x + 3 + y->f1 + y->f2; for (i = 0; i < 200; i = i + 2) { if (z > i) { p = p + x + 3; q = q + y->f1; } else { p = p + y->f2; q = q + x + 3; } } Assume that the variable points to a (allocated on the heap) containing two fields and …
