Parsing: GATE CS Previous Year Questions

Parsing · Compiler Design

58 questions · asked in 25 of 27 years (2000–2026)

MCQ 46 · MSQ 5 · NAT 71-mark 39 · 2-mark 19

2000Questions per year2026

Questions 31–35 of 58

Q31GATE 20092 marksMCQ−0.67 if wrong
Which of the following statements are TRUE?

I There exist parsing algorithms for some programming languages whose complexities are less than θ(n3)\theta (n^{3}).
II A programming language which allows recursion can be implemented with static storage allocation.
III No L-attributed definition can be evaluated in the framework of bottom-up parsing.
IV Code improving transformations can be performed at both source language and intermediate code level.

Q32GATE 20082 marksMCQ−0.67 if wrong
An LALR(1) parser for a grammar G can have shift-reduce (S-R) conflicts if and only if

Q33GATE 20082 marksMCQ−0.67 if wrong
Match the following:
E. Checkingthatidentifiersare declared before their use F. Numberofformalparametersin thedeclarationofafunction agreeswiththenumberofactual parameters in use of that function G. Arithmeticexpressionswith matched pairs of parentheses H. Palindromes P. Q. R. S. L ={ anbmcndm n ≥ 1, m ≥ 1 } X → XbXXcXdXfg L ={wcww(ab) *} X → bXbcXcε

Q34GATE 20081 markMCQ−0.33 if wrong
Which of the following describes a handle (as applicable to LR-parsing) appropriately?

Q35GATE 20071 markMCQ−0.33 if wrong
Consider the following grammars. Names representing terminals have been specified in capital letters.
G1 :stmnt→WHILE (expr) stmntstmnt→OTHERexpr→ID G2 :stmnt→WHILE (expr) stmntstmnt→OTHERexpr→expr + exprexpr→expr ∗ exprexpr→ID\begin{array}{llll}\hline \text{$G1$ :} & \text{stmnt} & \text{$\rightarrow$} & \text{WHILE (expr) stmnt} \\ \text{} & \text{stmnt} & \text{$\rightarrow$} & \text{OTHER} \\ \text{} & \text{expr} & \text{$\rightarrow$} & \text{ID} \\\hline \text{ $G2$ :} & \text{stmnt} & \text{$\rightarrow$} & \text{WHILE (expr) stmnt} \\ \text{} & \text{stmnt} & \text{$\rightarrow$} & \text{OTHER} \\ \text{} & \text{expr} & \text{$\rightarrow$} & \text{expr $+$ expr} \\ \text{} & \text{expr} & \text{$\rightarrow$} & \text{expr $*$ expr} \\ \text{} & \text{expr} & \text{$\rightarrow$} & \text{ID} \\\hline \end{array}
Which one of the following statements is true?

Keep practising

Topics in Compiler Design

All CS topics ›