Quiz Space

May 2026 term · Compiler Design · BSCS4032

Compiler Design End Term: 13 September 2026 (May 2026 term)

The IIT Madras BS Compiler Design (Compiler Design) End Term paper sat on 13 Sept 2026, in the May 2026 term: 21 questions for 50 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
21
Marks
50
Duration
180 min
MCQ
13
Numerical
5
MSQ
3

Updated

Official paper: Compiler Design 13 Sep 26 · No negative marking.

Question 1

+2 marksOne correct option
  1. A

    Lexical Analyzer

  2. B

    Syntax Analyzer (Parser)

  3. C

    Semantic Analyzer

  4. D

    Code Optimizer

Show answer

Correct answer

  • B

    Syntax Analyzer (Parser)

Question 2

+2 marksOne correct option

Why does the Static Single Assignment (SSA) form simplify compiler optimization and dataflow analysis?

  1. A

    It gives each definition a unique SSA name so that every SSA name has exactly one static definition, simplifying def-use chains.

  2. B

    It converts non-deterministic context-free grammars into deterministic parsing tables.

  3. C

    It directly maps high-level syntax into binary machine code without an assembler.

  4. D

    It automatically executes hot code blocks dynamically at runtime.

Show answer

Correct answer

  • A

    It gives each definition a unique SSA name so that every SSA name has exactly one static definition, simplifying def-use chains.

Question 3

+2 marksOne correct option

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?

  1. A

    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.

  2. B

    LR parsers convert left recursion to right recursion at compile time.

  3. C

    Top-down parsers use state-splitting algorithms that eliminate shift actions.

  4. D

    LR parsers construct leftmost derivations.

Show answer

Correct answer

  • A

    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.

Question 4

+2 marksOne correct option
  1. A
  2. B

    It is an L-attributed definition because inherited attributes depend only on parent attributes and left-sibling attributes.

  3. C
  4. D

    It contains a cyclic dependency preventing evaluation.

Show answer

Correct answer

  • B

    It is an L-attributed definition because inherited attributes depend only on parent attributes and left-sibling attributes.

Question 5

+2 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 6

+2 marksOne correct option
  1. A

    The parser cannot perform any shift actions.

  2. B

    The lexer stops emitting token codes.

  3. C
  4. D

    All variable data sizes default to 0 bytes.

Show answer

Correct answer

  • C

Question 7

+2 marksOne correct option
  1. A
  2. B
  3. C
  4. D

    The start of the surrounding function activation block.

Show answer

Correct answer

  • B

Question 8

+2 marksOne correct option
  1. A
  2. B
  3. C
  4. D

    It automatically renames the variable to avoid shadowing.

Show answer

Correct answer

  • B

Question 9

+2 marksOne correct option

What is the defining structural invariant of Static Single Assignment (SSA) form?

  1. A

    Every source variable can only be modified at runtime once during execution.

  2. B

    Every SSA variable name has exactly one static definition in the intermediate representation.

  3. C

    No conditional jumps or loop structures are permitted in the control flow graph.

  4. D

    All variables are allocated exclusively to hardware registers.

Show answer

Correct answer

  • B

    Every SSA variable name has exactly one static definition in the intermediate representation.

Question 10

+2 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 11

+3 marksNumerical answer

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?

Show answer

Correct answer: 6

Question 12

+3 marksNumerical answer
Show answer

Correct answer: 8

Question 13

+3 marksNumerical answer

?

Show answer

Correct answer: 4

Question 14

+3 marksNumerical answer

Consider the Boolean expression:

Show answer

Correct answer: 104

Question 15

+3 marksOne or more correct options

Which of the following strings will be accepted by this DFA? (Select all that apply)

Select all that apply.

  1. A
  2. B
  3. C
  4. D
  5. E
Show answer

Correct answers

  • A
  • B
  • D

Question 16

+3 marksOne correct option
  1. A

    { +, ), $ }

  2. B

    { *, +, $ }

  3. C

    { +, * }

  4. D

    { ), $ }

Show answer

Correct answer

  • A

    { +, ), $ }

Question 17

+3 marksOne correct option
  1. A

    t1 = ptr * 8 t2 = t1 + k

  2. B

    t1 = k * 8 t2 = ptr + t1

  3. C

    t1 = ptr + k

  4. D

    t1 = k + 8 t2 = ptr + t1

Show answer

Correct answer

  • B

    t1 = k * 8 t2 = ptr + t1

Question 18

+3 marksOne correct option

Consider the Three-Address Code block:

Which of the following is the correct set of instruction leaders for basic block partitioning?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 19

+2 marksNumerical answer
Show answer

Correct answer: 5

Question 20

+2 marksOne or more correct options

Consider the following program with nested declarations:

Which statements are TRUE regarding the variable bindings?

Select all that apply.

  1. A
  2. B
  3. C
  4. D

    The two nested blocks share identical symbol table instances.

Show answer

Correct answers

  • A
  • B

Question 21

+2 marksOne or more correct options

Consider the TAC basic blocks:

Which of the following statements are correct at the entry of basic block B2?

Select all that apply.

  1. A
  2. B
  3. C
  4. D

    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.

Show answer

Correct answers

  • A
  • B
  • D

    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.