Skip to content

GATE CS Parsing (LL, LR) questions

Practise Parsing (LL, LR) questions for GATE CS. Explore official PYQs and original topic-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 PYQ2017Compiler DesignParsing (LL, LR)NAT · 1 mark
Consider the following grammar: stmt →\rightarrow if expr then expr else expr; stmt | OˋÒ expr →\rightarrow term relop term | term term →\rightarrow id | number id →\rightarrow a | b | c number →[0−9]\rightarrow [0-9] where relop is a relational operator ((e.g., <,>,…),< , >,\ldots), OˋÒ refers to the empty statement, and if, then, else …
Official PYQ2017Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following expression grammar GG: E→E−T∣TE \rightarrow E-T \mid T T→T+F∣FT \rightarrow T + F \mid F F→(E)∣idF \rightarrow (E) \mid id Which of the following grammars is not left recursive, but is equivalent to GG?
Official PYQ2017Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which of the following statements about parser is/are CORRECT? Canonical LR\text{Canonical LR} is more powerful than SLR\text{SLR} SLR\text{SLR} is more powerful than LALR\text{LALR} SLR\text{SLR} is more powerful than Canonical LR\text{Canonical LR}
Official PYQ2016Compiler DesignParsing (LL, LR)NAT · 1 mark
The attribute of three arithmetic operators in some programming language are given below. …
Official PYQ2016Compiler DesignParsing (LL, LR)MCQ · 1 mark
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. …
Official PYQ2016Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which one of the following grammars is free from left recursion?
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 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 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 PYQ2013Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following two sets of LR(1)\textsf{LR(1)} items of an LR(1)\textsf{LR(1)} grammar.X→c.X,c∕dX→c.X,$X→.cX,c∕dX→.cX,$X→.d,c∕dX→.d,$\begin{array}{l|l} X \rightarrow c.X, c∕d &X → c.X, \$\\ X \rightarrow .cX, c∕ d& X → .cX, \$\\ X \rightarrow .d, c∕ d & X → .d, \$ \end{array}Which of the following statements related to merging of the two sets in the corresponding LALR\textsf{LALR} …
Official PYQ2013Compiler DesignParsing (LL, LR)MCQ · 1 mark
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 A→ϵA \rightarrow \epsilon and A→aA \rightarrow a) to parse a string with nn tokens?
Official PYQ2012Compiler DesignParsing (LL, LR)MCQ · 1 mark
For the grammar below, a partial LL(1)LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1,E2,E1, E2, and E3E3. ε\varepsilon is the empty string, \$ indicates end of input, and, ∣\mid separates alternate right hand sides of productions. S→aAbB∣bAaB∣εS \rightarrow a A b B \mid b A a B \mid \varepsilon …
Official PYQ2011Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider two binary operators ‘↑’\text{‘} \uparrow \text{’} and ‘↓’\text{‘} \downarrow \text{’} with the precedence of operator ↓\downarrow being lower than that of the operator ↑\uparrow. Operator ↑\uparrow is right associative while operator ↓\downarrow is left associative. Which one of the following represents the parse tree for expression …
Official PYQ2010Compiler DesignParsing (LL, LR)MCQ · 1 mark
The grammar S→aSa∣bS∣cS \to aSa \mid bS \mid c is
Official PYQ2009Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which of the following statements are TRUE? There exist parsing algorithms for some programming languages whose complexities are less than Θ(n3)\Theta(n^3) 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 …
Official PYQ2008Compiler DesignParsing (LL, LR)MCQ · 1 mark
An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only if
Official PYQ2008Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which of the following describes a handle (as applicable to LR-parsing) appropriately?
Official PYQ2008Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which of the following statements are true? Every left-recursive grammar can be converted to a right-recursive grammar and vice-versa All ϵ\epsilon-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 X→wX \rightarrow w or …