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 PYQ2007Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the CFG with {S,A,B}\left\{S, A, B\right\} as the non-terminal alphabet, {a,b}\{a, b\} as the terminal alphabet, SS as the start symbol and the following set of production rules: S→aBS \rightarrow aB S→bAS \rightarrow bA B→bB \rightarrow b A→aA \rightarrow a B→bSB \rightarrow bS A→aSA \rightarrow aS B→aBBB \rightarrow aBB A→bAAA \rightarrow bAA For …
Official PYQ2007Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the CFG with {S,A,B}\left\{S, A, B\right\} as the non-terminal alphabet, {a,b}\{a, b\} as the terminal alphabet, SS as the start symbol and the following set of production rules: S→aBS \rightarrow aB S→bAS \rightarrow bA B→bB \rightarrow b A→aA \rightarrow a B→bSB \rightarrow bS A→aSA \rightarrow aS B→aBBB \rightarrow aBB A→bAAA \rightarrow bAA Which …
Official PYQ2007Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following two statements: P: Every regular grammar is LL(1) Q: Every regular set has a LR(1) grammar Which of the following is TRUE?
Official PYQ2007Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the grammar with non-terminals N={S,C,S1}N=\left\{S,C,S_1\right\}, terminals T={a,b,i,t,e}T=\left\{a, b, i, t, e\right\}, with SS as the start symbol, and the following set of rules: S→iCtSS1∣aS \rightarrow iCtSS_1 \mid a S1→eS∣ϵS_1 \rightarrow eS \mid \epsilon C→bC \rightarrow b The grammar is NOT LL(1) because:
Official PYQ2007Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which one of the following is a top-down parser?
Official PYQ2006Compiler DesignParsing (LL, LR)MCQ · 1 mark
The grammar S→AC∣CBS\rightarrow AC\mid CB C→aCb∣ϵC\rightarrow aCb\mid \epsilon A→aA∣aA\rightarrow aA\mid a B→Bb∣bB\rightarrow Bb\mid b generates the language L={aibj∣i≠j}L=\left \{ a^{i}b^{j}\mid i\neq j \right \}. In this grammar what is the length of the derivation (number of steps starting from SS) to generate the string albma^{l}b^{m} with l≠ml\neq m
Official PYQ2006Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which one of the following grammars generates the language L={aibj∣i≠j}L=\left \{ a^{i}b^{j}\mid i\neq j \right \}?
Official PYQ2006Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following translation scheme. S→ERS\rightarrow ER R→∗E{print(‘∗’);}R∣εR\rightarrow *E\left \{ \text{print}(\text{‘}*\text{’}); \right \} R\mid \varepsilon E→F+E{print(‘+’);}∣FE\rightarrow F+E\left \{ \text{print}(\text{‘}+\text{’}); \right \}\mid F F→(S)∣id{print(id.value);}F\rightarrow (S)\mid id \left \{ \text{print}(id.value); \right \} Here idid is a token that represents an integer and …
Official PYQ2006Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following statements about the context free grammar G={S→SS,S→ab,S→ba,S→ϵ}G = \left \{ S \rightarrow SS, S \rightarrow ab, S \rightarrow ba, S \rightarrow \epsilon \right \} GG is ambiguous GG produces all strings with equal number of aa’s and bb’s GG can be accepted by a deterministic PDA. Which combination below expresses all the true statements …
Official PYQ2006Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following grammar S→S∗ES \rightarrow S * E S→ES \rightarrow E E→F+EE \rightarrow F + E E→FE \rightarrow F F→idF \rightarrow id Consider the following LR(0) items corresponding to the grammar above S→S∗.ES \rightarrow S *.E E→F.+EE \rightarrow F. + E E→F+.EE \rightarrow F + .E Given the items above, which two of them will appear in the same set in the …
Official PYQ2005Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following expression grammar. The semantic rules for expression evaluation are stated next to each grammar production. …
Official PYQ2005Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider line number 33 of the following C-program. int main() { /*Line 1 */ int I, N; /*Line 2 */ fro (I=0, I<N, I++); /*Line 3 */ } Identify the compiler’s response about this line while creating the object-module:
Official PYQ2005Compiler DesignParsing (LL, LR)MCQ · 1 mark
Statement for Linked Answer Questions 83a & 83b: Consider the following expression grammar. The semantic rules for expression evaluation are stated next to each grammar production. …
Official PYQ2005Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the grammar: S→(S)∣aS \rightarrow (S) \mid a Let the number of states in SLR (1), LR(1) and LALR(1) parsers for the grammar be n1,n2n_1, n_2 and n3n_3 respectively. The following relationship holds good:
Official PYQ2005Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the grammar: E→E+n∣E×n∣nE \rightarrow E + n \mid E \times n \mid n For a sentence n+n×nn + n \times n, the handles in the right-sentential form of the reduction are:
Official PYQ2005Compiler DesignParsing (LL, LR)MCQ · 1 mark
The grammar A→AA∣(A)∣ϵA \rightarrow AA \mid (A) \mid \epsilon is not suitable for predictive-parsing because the grammar is:
Official PYQ2004Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the following grammar G: S→bS∣aA∣bS \rightarrow bS \mid aA \mid b A→bA∣aBA \rightarrow bA \mid aB B→bB∣aS∣aB \rightarrow bB \mid aS \mid a Let Na(w)N_a(w) and Nb(w)N_b(w) denote the number of a’s and b’s in a string ω\omega respectively. The language L(G)L(G) over {a,b}+\left\{a, b\right\}^+ generated by GG is
Official PYQ2004Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider a program PP that consists of two source modules M1M_1 and M2M_2 contained in two different files. If M1M_1 contains a reference to a function defined in M2M_2 the reference will be resolved at
Official PYQ2004Compiler DesignParsing (LL, LR)MCQ · 1 mark
Which of the following grammar rules violate the requirements of an operator grammar? P,Q,RP, Q, R are nonterminals, and r,s,tr, s, t are terminals. P→QRP \rightarrow Q R P→QsRP \rightarrow Q s R P→ εP \rightarrow \: \varepsilon P→QtRrP \rightarrow Q t R r
Official PYQ2003Compiler DesignParsing (LL, LR)MCQ · 1 mark
Consider the translation scheme shown below. S→T  RS \rightarrow T\;R R→+T{print(‘+’);}R∣εR \rightarrow + T \{\text{print}(‘+’);\} R\mid \varepsilon T→T \rightarrow num {print\{\text{print}(num.val);};\} Here num is a token that represents an integer and num.val represents the corresponding integer value. For an input string ‘9+5+29 + 5 + 2’, this translation scheme will …