Skip to main content
GATE CSE

Compiler Design PYQs (GATE CSE Compiler Design previous year questions)

Practise real GATE CSE Compiler Design previous year questions from 1987–2026. Attempt questions, check your answers and learn with the stored explanations.

  • 182GATE CSE PYQs in archive
  • 1987–202639 exam years
  • 5 chapters29 analysed topics
  • Allhave a verified solution

Practice Questions

Question 1 of 5
GATE CSE 2026Compiler DesignSyntax-Directed Translation & Intermediate Code2 marks

​​​​​​Consider the following two syntax-directed definitions SDD1\text{SDD1} and SDD2\text{SDD2} for type declarations.

 
SDD1
Grammar (G1)Semantic Rules
D→T VD \rightarrow T\ VD.type=T.typeD.type = T.type
V.type=T.typeV.type = T.type
T→intT \rightarrow \text{int}T.type=intT.type = \text{int}
T→floatT \rightarrow \text{float}T.type=floatT.type = \text{float}
V→V1 idV \rightarrow V_1\ \text{id}V1.type=V.typeV_1.type = V.type
put(id.entry, V.type)\text{put(id.entry, V.type)}
V→idV \rightarrow \text{id}put(id.entry, V.type)\text{put(id.entry, V.type)}
 
SDD2
Grammar (G2)Semantic Rules
D→D1 idD \rightarrow D_1\ \text{id}D.type=D1.typeD.type = D_1.type
put(id.entry, D_1.type)\text{put(id.entry, D\_1.type)}
D→T idD \rightarrow T\ \text{id}D.type=T.typeD.type = T.type
put(id.entry, T.type)\text{put(id.entry, T.type)}
T→intT \rightarrow \text{int}T.type=intT.type = \text{int}
T→floatT \rightarrow \text{float}T.type=floatT.type = \text{float}


DD is the start symbol, and int, float and id are the three terminals. The non-terminal V1V_{1} is the same as VV and the non-terminal D1D_{1} is the same as DD. Here, the subscript is used to differentiate the grammar symbols on the two sides of a production. The function put updates the symbol table with the type information for an identifier.

Let P\text{P} and Q\text{Q} be the languages specified by grammars G1\text{G1} and G2\text{G2}, respectively.
Which of the following statements is/are true?

Choose all correct options

Answer at least one question to submit.

Help us improve: tell us what to fix or add

Sign in to send feedback (it takes under a minute), or create a free account.

About Compiler Design

Compiler Design has 14 analysed topics in the GateIQ archive. The ones that have appeared most often in GATE CSE are Grammar, LR Parser, Compilation Phases.

11 of them are rated high or very high value by the same transparent frequency, recurrence, recentness and solvability weighting used across the archive.

The practice set draws on 182 GATE CSE questions from 39 papers between 1987–2026. 182 of them carry a verified worked solution, shown after you submit.

Topics (29)

Year-wise PYQs

Number of GATE CSE Compiler Design questions in each paper.

  • 20267
  • 20257
  • 202411
  • 20234
  • 20223
  • 202110
  • 20203
  • 20194
  • 20183
  • 20176
  • 20166
  • 20158
  • 201410
  • 20133
  • 20122
  • 20114
  • 20104
  • 20091
  • 20085
  • 20075
  • 20068
  • 20056
  • 20046
  • 20039
  • 20022
  • 20012
  • 20003
  • 19992
  • 19985
  • 19975
  • 19963
  • 19955
  • 19942
  • 19932
  • 19926
  • 19912
  • 19891
  • 19881
  • 19876