Home / Study library / Compiler Design / End Term · May 2026 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
Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18 Q19 Q20 Q21 Q22
Question 2 MCQ · 2.0 marks A programmer writes an expression with mismatched grouping:
.
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
:
•
•
•
•
Which classification accurately describes this Syntax-Directed Definition (SDD)?
6406537461797. It is an S-attributed definition because
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
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 (
) but reports semantic errors for
implicit narrowing conversions (
or
).
Given functions
and variables
,
which function call compiles without semantic errors?
6406537461801. 6406537461802. 6406537461803. 6406537461804. 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
from
and parses
while attempting to create the symbol table upon reduction of
, 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
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
loop containing a
statement, what is the precise control-flow
target address to which the
jump must be backpatched?
6406537461814. The first instruction of the loop body
.
6406537461815. The instruction marking the beginning of the condition evaluation
.
6406537461816. The instruction immediately following the
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
inside an inner block, while a parameter named
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
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 (
).
6406537461825. It overwrites the parameter
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
?
6406537461839. is assigned the existing value number of
(
).
6406537461840. A brand new, unique value number is generated for
.
6406537461841. receives a value number only after an arithmetic operation is performed.
6406537461842. The value number of
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
Input:
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:
How many derivation steps are required in the **rightmost derivation** of the string
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:
How many total
items are present in state
?
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:
Using the standard syntax-directed translation with backpatching for Boolean expressions,
assume that:
• Each relational expression
generates two consecutive TAC instructions:
1. A conditional jump:
2. An unconditional jump:
• The
counter gives the address of the next generated instruction.
• Initially,
.
• The logical NOT operator
only swaps the
and
and does not generate
additional instructions.
At which instruction number is the conditional jump for the comparison
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)
where:
•
•
•
•
The transition function δ is defined as:
Which of the following strings will be **accepted** by this DFA? (Select all that apply)
6406537461782. 6406537461783. 6406537461784. 6406537461785. 6406537461786. 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:
What is
?
6406537461788. { +, ), $ }
6406537461789. { *, +, $ }
A published solution is not available for this question yet.
Report a correction for Q17
Question 18 MCQ · 3.0 marks Given pointer
of type
and integer
, where
. When
translating the pointer arithmetic expression
, 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:
Which of the following is the correct set of instruction leaders for basic block partitioning?
6406537461827. 6406537461828. 6406537461829. 6406537461830. 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
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:
Which statements are TRUE regarding the variable bindings?
6406537461818. Inside the first nested block,
shadows the parameter
.
6406537461819. In the second nested block,
is assigned the value of the parameter
.
6406537461820. In the second nested block,
is assigned the value of the global
.
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:
Which of the following statements are correct at the **entry of basic block B2**?
6406537461831. is live at the entry of
.
6406537461832. is live at the entry of
.
6406537461833. is live at the entry of
.
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