∑GateAndNet
PlannerSign Up

Compiler Design — Solved PYQ & Mock Arena

Topic-wise Compiler Design previous-year GATE & UGC NET questions with step-by-step LaTeX solutions

Showing 12 questions in Compiler DesignClick A / B / C / D for instant verification
Q1GATE CS 2026–27 ExpectedCompiler DesignMCQMEDIUM
+2M • -0.67

In Static Single Assignment (SSA) intermediate representation, what is the exact role of a ϕ\phi-function such as x3=ϕ(x1,x2)x_3 = \phi(x_1, x_2) placed at the entry of a join basic block?

⚡ Click an option above to verify instantly
Q2GATE CS 2027 Expected NATCompiler DesignNATMEDIUM
+2M • 0 Neg

Consider the Three-Address Code fragment below: 1: i = 1 2: s = 0 3: if i > 10 goto 8 4: if i % 2 == 0 goto 6 5: s = s + i 6: i = i + 1 7: goto 3 8: return s How many Basic Blocks exist in its Control Flow Graph?

Q3GATE CS 2021 Set-2Compiler DesignNATMEDIUM
+2M • 0 Neg

Consider the Syntax-Directed Definition: E→E1 # T  {E.val=E1.val×T.val}∣TE \to E_1 \text{ \texttt{\#} } T \;\{E.val = E_1.val \times T.val\} \mid T, and T→T1 & F  {T.val=T1.val+F.val}∣FT \to T_1 \text{ \texttt{\&} } F \;\{T.val = T_1.val + F.val\} \mid F, with F→numF \to \mathbf{num}. Notice + (&) has higher precedence than * (#) and both are left-associative! Evaluate 2 # 3 & 5 # 4 & 1.

Q4GATE CS 2024 Set-1Compiler DesignMCQMEDIUM
+2M • -0.67

For the grammar S→aAb∣bBa,  A→ϵ,  B→ϵS \to aAb \mid bBa,\; A \to \epsilon,\; B \to \epsilon, is the grammar LL(1) and/or SLR(1)?

⚡ Click an option above to verify instantly
Q5GATE CS 2020Compiler DesignNATEASY
+1M • 0 Neg

How many lexical tokens are produced by a standard C lexical analyzer (using Maximal Munch) on the statement: printf("i = %d, &i = %x", i, &i);?

Q6GATE CS 2022Compiler DesignMCQMEDIUM
+2M • -0.67

Consider a grammar that is LR(1) (CLR) and therefore unambiguous. When we merge LR(1) states sharing identical LR(0) cores to construct the LALR(1) parser, which new conflict(s) can possibly be introduced?

⚡ Click an option above to verify instantly
Q7GATE CS CompilerCompiler DesignMCQMEDIUM
+2M • -0.67

In global register allocation via Chaitin’s algorithm, finding the minimum number of CPU registers needed for live variables without spilling reduces directly to:

⚡ Click an option above to verify instantly
Q8GATE CS CompilerCompiler DesignMCQEASY
+2M • -0.67

How many lexical tokens does a C lexical analyzer emit for the statement: printf("i = %d, &i = %x", i, &i);?

⚡ Click an option above to verify instantly
Q9GATE CS CompilerCompiler DesignMCQMEDIUM
+2M • -0.67

In an L-Attributed Syntax-Directed Definition for production A→X1X2X3A \to X_1 X_2 X_3, an inherited attribute of symbol X2X_2 may depend on:

⚡ Click an option above to verify instantly
Q10GATE CS CompilerCompiler DesignMCQMEDIUM
+2M • -0.67

If a Context-Free Grammar GG is ambiguous, which of the following statements is guaranteed to be TRUE?

⚡ Click an option above to verify instantly
Q11GATE CS CompilerCompiler DesignMCQEASY
+1M • -0.33

Which pair of bottom-up LR parsers always have the exact same number of states for any given context-free grammar?

⚡ Click an option above to verify instantly
Q12GATE CS Compiler PYQCompiler DesignMCQMEDIUM
+2M • -0.67

Which of the following statements about bottom-up LR parsers is FALSE?

⚡ Click an option above to verify instantly