MauryaHub PYQ Practice

Compiler Design · End Term · May 2026 · FN

Compiler Design · End Term · May 2026 FN

← Course papers · Start practice / exam

Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.

0 / 21 published solutions

Question 2 MCQ · 2.0 marks

A programmer writes an expression with mismatched grouping:
Source diagram or notation
. Which compiler phase detects the missing closing parenthesis?
6406537461773.
Lexical Analyzer
6406537461774.
Syntax Analyzer (Parser)
6406537461775.
Semantic Analyzer
6406537461776.
Code Optimizer

A published solution is not available for this question yet.

Report a correction for Q2

Question 3 MCQ · 2.0 marks

Why does the Static Single Assignment (SSA) form simplify compiler optimization and dataflow analysis?
6406537461777.
It gives each definition a unique SSA name so that every SSA name has exactly one static definition, simplifying def-use chains.
6406537461778.
It converts non-deterministic context-free grammars into deterministic parsing tables.
6406537461779.
It directly maps high-level syntax into binary machine code without an assembler.
6406537461780.
It automatically executes hot code blocks dynamically at runtime.

A published solution is not available for this question yet.

Report a correction for Q3

Question 4 MCQ · 2.0 marks

Why do bottom-up LR parser generators (like Bison) handle left-recursive grammar rules efficiently, whereas predictive top-down LL(1) parsers cannot parse them directly?
6406537461793.
LR parsers shift input symbols and reduce recognized handles rather than recursively expanding the leftmost nonterminal, so left recursion does not cause infinite recursive expansion.
6406537461794.
LR parsers convert left recursion to right recursion at compile time.
6406537461795.
Top-down parsers use state-splitting algorithms that eliminate shift actions.
6406537461796.
LR parsers construct leftmost derivations.

A published solution is not available for this question yet.

Report a correction for Q4

Question 5 MCQ · 2.0 marks

Consider the semantic rules associated with production
Source diagram or notation
: •
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
Which classification accurately describes this Syntax-Directed Definition (SDD)?
6406537461797.
It is an S-attributed definition because
Source diagram or notation
is synthesized.
6406537461798.
It is an L-attributed definition because inherited attributes depend only on parent attributes and left-sibling attributes.
6406537461799.
It is not L-attributed because
Source diagram or notation
depends on multiple preceding siblings.
6406537461800.
It contains a cyclic dependency preventing evaluation.

A published solution is not available for this question yet.

Report a correction for Q5

Question 6 MCQ · 2.0 marks

A compiler permits implicit widening (
Source diagram or notation
) but reports semantic errors for implicit narrowing conversions (
Source diagram or notation
or
Source diagram or notation
). Given functions
Source diagram or notation
and variables
Source diagram or notation
, which function call compiles without semantic errors?
6406537461801.Source diagram or notation
6406537461802.Source diagram or notation
6406537461803.Source diagram or notation
6406537461804.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q6

Question 7 MCQ · 2.0 marks

If a compiler designer removes the marker production
Source diagram or notation
from
Source diagram or notation
and parses
Source diagram or notation
while attempting to create the symbol table upon reduction of
Source diagram or notation
, what semantic- action/symbol-table problem occurs during parsing?
6406537461810.
The parser cannot perform any shift actions.
6406537461811.
The lexer stops emitting token codes.
6406537461812.
Identifiers encountered inside
Source diagram or notation
attempt to enter their scope records into a symbol table that has not yet been initialized.
6406537461813.
All variable data sizes default to 0 bytes.

A published solution is not available for this question yet.

Report a correction for Q7

Question 8 MCQ · 2.0 marks

In a
Source diagram or notation
loop containing a
Source diagram or notation
statement, what is the precise control-flow target address to which the
Source diagram or notation
jump must be backpatched?
6406537461814.
The first instruction of the loop body
Source diagram or notation
.
6406537461815.
The instruction marking the beginning of the condition evaluation
Source diagram or notation
.
6406537461816.
The instruction immediately following the
Source diagram or notation
condition (the loop exit).
6406537461817.
The start of the surrounding function activation block.

A published solution is not available for this question yet.

Report a correction for Q8

Question 9 MCQ · 2.0 marks

During compilation of a function body, the compiler encounters a local variable declaration
Source diagram or notation
inside an inner block, while a parameter named
Source diagram or notation
exists at the function level. Which statement correctly describes how the symbol table handles this declaration?
6406537461823.
It emits a fatal redeclaration error because identifier
Source diagram or notation
already exists in an enclosing table.
6406537461824.
It accepts the declaration into the current inner block table because redeclaration checks examine only the current local scope (
Source diagram or notation
).
6406537461825.
It overwrites the parameter
Source diagram or notation
in the function-level table.
6406537461826.
It automatically renames the variable to avoid shadowing.

A published solution is not available for this question yet.

Report a correction for Q9

Question 10 MCQ · 2.0 marks

What is the defining structural invariant of Static Single Assignment (SSA) form?
6406537461835.
Every source variable can only be modified at runtime once during execution.
6406537461836.
Every SSA variable name has exactly one static definition in the intermediate representation.
6406537461837.
No conditional jumps or loop structures are permitted in the control flow graph.
6406537461838.
All variables are allocated exclusively to hardware registers.

A published solution is not available for this question yet.

Report a correction for Q10

Question 11 MCQ · 2.0 marks

In Local Value Numbering (LVN), what value number is assigned to a copy statement
Source diagram or notation
?
6406537461839.Source diagram or notation
is assigned the existing value number of
Source diagram or notation
(
Source diagram or notation
).
6406537461840.
A brand new, unique value number is generated for
Source diagram or notation
.
6406537461841.Source diagram or notation
receives a value number only after an arithmetic operation is performed.
6406537461842.
The value number of
Source diagram or notation
is reset to null.

A published solution is not available for this question yet.

Report a correction for Q11

Question 12 NAT · 3.0 marks

A lexical analyzer uses standard Lex rules to tokenize an input stream. Code snippet
Source diagram or notation
Input:
Source diagram or notation
How many total tokens are produced by the lexical analyzer for this input?

A published solution is not available for this question yet.

Report a correction for Q12

Question 13 NAT · 3.0 marks

Consider the following expression grammar:
Source diagram or notation
Source diagram or notation
Source diagram or notation
How many derivation steps are required in the **rightmost derivation** of the string
Source diagram or notation
from the start symbol E?

A published solution is not available for this question yet.

Report a correction for Q13

Question 14 NAT · 3.0 marks

Consider the augmented grammar:
Source diagram or notation
Source diagram or notation
Source diagram or notation
Source diagram or notation
How many total
Source diagram or notation
items are present in state
Source diagram or notation
?

A published solution is not available for this question yet.

Report a correction for Q14

Question 15 NAT · 3.0 marks

Consider the Boolean expression:
Source diagram or notation
Using the standard syntax-directed translation with backpatching for Boolean expressions, assume that: • Each relational expression
Source diagram or notation
generates two consecutive TAC instructions: 1. A conditional jump:
Source diagram or notation
2. An unconditional jump:
Source diagram or notation
• The
Source diagram or notation
counter gives the address of the next generated instruction. • Initially,
Source diagram or notation
. • The logical NOT operator
Source diagram or notation
only swaps the
Source diagram or notation
and
Source diagram or notation
and does not generate additional instructions. At which instruction number is the conditional jump for the comparison
Source diagram or notation
generated?

A published solution is not available for this question yet.

Report a correction for Q15

Question 16 MSQ · 3.0 marks

Consider the Deterministic Finite Automaton (DFA)
Source diagram or notation
where: •
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
•
Source diagram or notation
The transition function δ is defined as:
Source diagram or notation
Which of the following strings will be **accepted** by this DFA? (Select all that apply)
6406537461782.Source diagram or notation
6406537461783.Source diagram or notation
6406537461784.Source diagram or notation
6406537461785.Source diagram or notation
6406537461786.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q16

Question 17 MCQ · 3.0 marks

Consider the following standard expression grammar:
Source diagram or notation
Source diagram or notation
Source diagram or notation
Source diagram or notation
Source diagram or notation
What is
Source diagram or notation
?
6406537461788.
{ +, ), $ }
6406537461789.
{ *, +, $ }
6406537461790.
{ +, * }
6406537461791.
{ ), $ }

A published solution is not available for this question yet.

Report a correction for Q17

Question 18 MCQ · 3.0 marks

Given pointer
Source diagram or notation
of type
Source diagram or notation
and integer
Source diagram or notation
, where
Source diagram or notation
. When translating the pointer arithmetic expression
Source diagram or notation
, which TAC sequence correctly computes the resulting address?
6406537461806.
t1 = ptr * 8 t2 = t1 + k
6406537461807.
t1 = k * 8 t2 = ptr + t1
6406537461808.
t1 = ptr + k
6406537461809.
t1 = k + 8 t2 = ptr + t1

A published solution is not available for this question yet.

Report a correction for Q18

Question 19 MCQ · 3.0 marks

Consider the Three-Address Code block:
Source diagram or notation
Which of the following is the correct set of instruction leaders for basic block partitioning?
6406537461827.Source diagram or notation
6406537461828.Source diagram or notation
6406537461829.Source diagram or notation
6406537461830.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q19

Question 20 NAT · 2.0 marks

A compiler translates the expression
Source diagram or notation
without optimization or common subexpression elimination. Each binary operation generates exactly one binary arithmetic TAC instruction. How many binary arithmetic TAC instructions are emitted?

A published solution is not available for this question yet.

Report a correction for Q20

Question 21 MSQ · 2.0 marks

Consider the following program with nested declarations:
Source diagram or notation
Which statements are TRUE regarding the variable bindings?
6406537461818.
Inside the first nested block,
Source diagram or notation
shadows the parameter
Source diagram or notation
.
6406537461819.
In the second nested block,
Source diagram or notation
is assigned the value of the parameter
Source diagram or notation
.
6406537461820.
In the second nested block,
Source diagram or notation
is assigned the value of the global
Source diagram or notation
.
6406537461821.
The two nested blocks share identical symbol table instances.

A published solution is not available for this question yet.

Report a correction for Q21

Question 22 MSQ · 2.0 marks

Consider the TAC basic blocks:
Source diagram or notation
Which of the following statements are correct at the **entry of basic block B2**?
6406537461831.Source diagram or notation
is live at the entry of
Source diagram or notation
.
6406537461832.Source diagram or notation
is live at the entry of
Source diagram or notation
.
6406537461833.Source diagram or notation
is live at the entry of
Source diagram or notation
.
6406537461834.
A variable is defined as live at a program point if its current value may be used along at least one future execution path before being redefined.

A published solution is not available for this question yet.

Report a correction for Q22