Live online classes · Mon–Sat · India-wide

Compiler Design (BCS602) Important Questions

AKTU B.Tech · 3rd Year · Exam 2026-27. Worked out from 9 real papers, 2018-19 to 2025-26.

  • 9AKTU papers analysed
  • 20must-do topics
  • 21repeated 2-mark questions
Share on WhatsApp

The PDF has every topic with the years it came, a unit-wise plan and the sources. Free. Share it with your class.

Most likely question in each unit

UnitMost likelyBackup topics
1Phases & passes, bootstrapping, RE / finite automata for lexical analysis, LEX, YACC, CFG, BNF, derivations, ambiguityAmbiguous grammar E → E+E | E*E | id and its unambiguous version (7/9; in both BCS602 papers)RE → NFA → minimised DFA (8/9) · Phases with output of each phase for an assignment (7/9) · LEX / lexical-analyser design · CFG, derivations, BNF
2Shift-reduce, operator precedence, top-down & predictive (LL(1)) parsing, LR(0), SLR, CLR, LALR tablesCLR / LALR table for S → CC, C → cC | d (6/9) or SLR table with conflict check (6/9)Shift-reduce parsing of (a,(a,a)) (8/9) · LL(1) table with FIRST / FOLLOW (5/9) · Operator precedence · Compare SLR, CLR, LALR
3Syntax-directed translation, intermediate code, postfix, syntax trees, three-address code, quadruples & triples, Boolean & control flow, arrays, procedure callsQuadruples, triples and indirect triples for an expression (9/9)TAC for while / if-else or Boolean expression with SDD / backpatching (8/9) · SDD with annotated parse tree for 4*7+3*9 · Postfix + TAC
4Symbol tables & scope, run-time administration (stack allocation, activation records), lexical / syntactic / semantic error recoverySymbol table organisation and data structures (8/9)Activation record (8/9) · Static vs dynamic scope (7/9) · Static, stack and heap allocation (6/9) · Lexical / syntactic / semantic error recovery (8/9)
5Code generation design issues, target machine, basic blocks & flow graphs, DAG, machine-independent & loop optimisation, global data-flow analysisDAG for an expression or basic block and the optimised code (8/9)Code-generation design issues and target machine (6/9) · Principal sources: CSE, dead code, constant folding (7/9) · Loop optimisation · Peephole / register allocation

Must-do topics

These came in most of the 9 papers. Prepare them first.

  • Syntax-directed definitions, annotated parse tree, synthesized vs inherited attributes

    came in 9 of 9 papers

    Unit 3 · 2018-19 to 2025-26 · HOT: in all 9 papers

    How to answer: SDD = grammar + semantic rules; S-attributed (only synthesized) vs L-attributed. Desk-calculator SDD (E → E+T {E.val = E1.val + T.val} ... F → num {F.val = num.lexval}) and the annotated parse tree for 4*7+3*9. SDD for the assignment grammar S → id = E generating three-address code (E.place, gen). Translation scheme with actions inside productions.

    Last asked (2025-26, Section B): Describe translation schemes for assignment statements and arithmetic expressions.

  • Three-address code: quadruples, triples & indirect triples

    came in 9 of 9 papers

    Unit 3 · 2018-19 to 2025-26 · HOT: in all 9 papers

    How to answer: Write the three-address code first (t1 = ...), then the three tables: quadruple (op, arg1, arg2, result), triple (op, arg1, arg2 with references to statement numbers), indirect triple (extra pointer list). Why quadruples suit optimising compilers (statements can be moved). Practise a = b*-c + b*-c, (x+y)*(y+z)+(x+y+z), x = a + (b*-c) + (d*-e), (a/b)*(a+b)-(a*b)/d.

    Last asked (2025-26, Section C): Explain three-address code representation and discuss quadruples, triples and indirect triples.

  • Regular expressions, NFA & DFA construction and DFA minimisation

    came in 8 of 9 papers

    Unit 1 · 2018-19 to 2025-26 · HOT: in 8 of 9 papers

    How to answer: Practise RE → NFA (Thompson) → DFA (subset construction) → minimised DFA (partition method). Standard REs: (a+b)*abb, (0+1)*(00+11)(0+1)*, a(b|c)*. Also write an RE / FSM for 'odd a and odd b' type languages. Always show the transition table and mark start and final states.

    Last asked (2025-26, Section A): Construct DFA for the given regular expression over {a, b} (ending in ab).

  • Shift-reduce parsing (handle, viable prefix, conflicts)

    came in 8 of 9 papers

    Unit 2 · 2018-19 to 2025-26 · HOT: in 8 of 9 papers

    How to answer: Stack / input / action table with shift, reduce, accept, error. Define handle, handle pruning and viable prefix; shift-reduce and reduce-reduce conflicts. Practise S → (L) | a, L → L,S | S on (a,(a,a)) and E → E+T | T ... on id*(id+id).

    Last asked (2025-26, Section B): Describe bottom-up parsing techniques in detail. Explain shift-reduce parsing with example.

  • Three-address code for Boolean expressions & flow of control (while/if, switch, backpatching)

    came in 8 of 9 papers

    Unit 3 · 2018-19 to 2025-26 · HOT: in 8 of 9 papers

    How to answer: Learn the SDD for Boolean expressions (B.true / B.false, short-circuit) and for while / if-else; then write the labelled three-address code for while a d and e < f. Switch / case translation with a jump table or test sequence.

    Last asked (2025-26, Section A): Define Boolean expression translation.

  • Symbol table: entries, organisation & data structures (hashing)

    came in 8 of 9 papers

    Unit 4 · 2020-21 to 2025-26 · HOT: in 8 of 9 papers

    How to answer: Entries: name, type, size, scope, address, line numbers. Data structures with pros/cons: linear list (unordered/ordered), binary search tree, hash table (with chaining diagram), self-organising list. Show how each phase uses the table (lexer inserts, parser/semantic phase look up types, code generator uses addresses).

    Last asked (2025-26, Section C): Explain symbol table organization and discuss different data structures used for symbol tables.

  • Activation record (fields, recursive calls, parameter passing)

    came in 8 of 9 papers

    Unit 4 · 2018-19 to 2025-26 · HOT: in 8 of 9 papers

    How to answer: Draw the activation record: return value, actual parameters, control link, access link, saved machine status, local data, temporaries; explain each field. Show the control stack / activation tree for nested or recursive calls (main → P → Q, factorial). Parameter passing: call by value, reference, copy-restore, name.

    Last asked (2025-26 (carry-over), Section C): Show the stack contents during execution of nested procedure calls main → P → Q.

  • Error detection & recovery (lexical, syntactic, semantic errors)

    came in 8 of 9 papers

    Unit 4 · 2018-19 to 2025-26 · HOT: in 8 of 9 papers, twice in 2024-25

    How to answer: Classify errors: lexical (illegal character, misspelt token), syntactic (missing semicolon, unbalanced brackets), semantic (type mismatch, undeclared variable), logical. Recovery strategies: panic mode, phrase level, error productions, global correction; lexical recovery by deleting/inserting/replacing/transposing characters. Give one example per class.

    Last asked (2025-26, Section C): Discuss various error recovery techniques used in compiler design.

  • DAG representation of basic blocks (construction & use in CSE)

    came in 8 of 9 papers

    Unit 5 · 2018-19 to 2025-26 · HOT: in 8 of 9 papers

    How to answer: Build the DAG node by node (leaves = initial values, interior = operators, attach identifiers), reuse a node when the same operator and children exist, then regenerate optimised code. Advantages: common sub-expressions, dead code, which names are used outside the block. Practise a := b*-c + b*-c, p+p*(q-r)+(q-r)*s, a+a*(b-c)+(b-c)*d.

    Last asked (2025-26, Section C): Construct DAG for the given expression a = b·c + b·c + d and optimise the code.

  • Phases of a compiler (compilation of a statement, grouping, phase vs pass)

    came in 7 of 9 papers

    Unit 1 · 2018-19 to 2025-26 · HOT: in 7 of 9 papers

    How to answer: Draw the six phases (lexical, syntax, semantic, intermediate code, optimisation, code generation) with symbol table and error handler on the side. Show the output of every phase for a statement like a = b + c * 70 (tokens, parse tree, annotated tree, three-address code, optimised code, assembly). Add analysis/synthesis (front end/back end) grouping, why phases are grouped into passes, and phase vs pass.

    Last asked (2025-26 (carry-over), Section A): List the phases of a compiler.

  • Ambiguous grammar & converting it to unambiguous (dangling else)

    came in 7 of 9 papers

    Unit 1 · 2018-19 to 2025-26 · HOT: in both BCS602 papers

    How to answer: Show two leftmost derivations / two parse trees for id + id * id with E → E+E | E*E | id. Remove ambiguity using precedence and associativity: E → E+T | T, T → T*F | F, F → id. Also know S → aSbS | bSaS | ε (two trees for abab) and the dangling-else problem.

    Last asked (2025-26, Section B): Check whether E → E+E | E*E | id is ambiguous; if ambiguous convert it into unambiguous grammar.

  • Context-free grammars, derivations, parse trees, BNF (parse tree vs syntax tree)

    came in 7 of 9 papers

    Unit 1 · 2020-21 to 2025-26

    How to answer: Define CFG (V, T, P, S), leftmost / rightmost derivation and parse tree on one example; write BNF for an expression grammar. Capabilities of CFG (nested structures, balanced brackets) vs what it cannot do (declare-before-use). Parse tree shows every grammar symbol; syntax tree (AST) keeps only operators and operands: draw both for a+b*c. Practise writing a CFG for a given language.

    Last asked (2025-26, Section C): Explain context-free grammars and their applications in syntax analysis. Discuss derivation and parse trees.

  • Scope information: static vs dynamic scope, access to non-local names

    came in 7 of 9 papers

    Unit 4 · 2018-19 to 2025-26

    How to answer: Static (lexical) scope is fixed by program text; dynamic scope by the call sequence: show one program giving different outputs. Representing scope in the symbol table: a stack of tables / scope numbers, 'scope by number' and 'scope by location'. Non-local access in static scope with access links or displays.

    Last asked (2025-26 (carry-over), Section B): Compare static scope and dynamic scope.

  • Machine-independent optimisation: principal sources (CSE, constant folding, copy propagation, dead code, algebraic identities)

    came in 7 of 9 papers

    Unit 5 · 2020-21 to 2025-26 · HOT: in both BCS602 papers

    How to answer: Function-preserving transformations with a before/after example each: common sub-expression elimination, copy propagation, dead-code elimination, constant folding, algebraic identities (x+0, x*1, x*2 → x+x). Optimisation of basic blocks using DAG. Work small blocks by hand (x = a+b; y = x*c; z = y-d, or x = 10; y = 20; x = 30; print(y)).

    Last asked (2025-26, Section A): What is common subexpression elimination?

  • LR(0) items & SLR parsing table (conflict check)

    came in 6 of 9 papers

    Unit 2 · 2018-19 to 2024-25

    How to answer: Augment the grammar, build the canonical LR(0) item sets with CLOSURE and GOTO, draw the DFA, fill ACTION/GOTO (SLR reduces on FOLLOW). Say whether a shift-reduce or reduce-reduce conflict occurs. Practise S → cB | ccA..., S → PQy..., S → Aa | bAc | Bc | bBa, A → d, B → d (not SLR) and E → E+E | E*E | id.

    Last asked (2024-25, Section B): For S → Aa | bAc | Bc | bBa, A → d, B → d construct the SLR table and determine whether any conflicts occur.

  • CLR & LALR parsing tables

    came in 6 of 9 papers

    Unit 2 · 2020-21 to 2025-26 · STEADY: 6 of 9 papers

    How to answer: Build LR(1) items with lookaheads, fill the CLR table, then merge states with the same core to get LALR and check for new reduce-reduce conflicts. S → CC, C → cC | d (asked twice) and S → AA, A → aA | b are the classic grammars; also S → aAd | bBd | aBe | bAe, A → f, B → f (LR(1) but not LALR).

    Last asked (2025-26, Section C): Construct CLR parsing table for S → CC, C → cC | d.

  • Run-time storage allocation: static, stack & heap (simple stack allocation scheme)

    came in 6 of 9 papers

    Unit 4 · 2021-22 to 2025-26

    How to answer: Memory layout (code, static data, stack, heap). Static allocation (no recursion), stack allocation (activation records pushed/popped with calls, call and return sequences), heap allocation (any order, garbage). Comparison table stack vs heap. Storage allocation in block-structured languages.

    Last asked (2025-26, Section B): Discuss run-time storage administration and explain static, stack and heap allocation schemes.

  • Code generation: design issues & target machine / target language

    came in 6 of 9 papers

    Unit 5 · 2020-21 to 2025-26

    How to answer: Issues: input to code generator, target program (absolute / relocatable / assembly), memory management, instruction selection, register allocation and assignment, evaluation order. Target machine: instruction forms (op source, destination), addressing modes and their cost. Simple code generator using register and address descriptors (getreg).

    Last asked (2025-26, Section B): Explain the issues involved in code generation and discuss characteristics of target machine.

  • FIRST & FOLLOW and LL(1) / predictive parsing table

    came in 5 of 9 papers

    Unit 2 · 2018-19 to 2024-25

    How to answer: Remove left recursion first, then compute FIRST and FOLLOW for every non-terminal, fill the table M[A, a], and say the grammar is LL(1) only if no cell has two entries. Show the stack moves for one input string. Practise E → E+T | T, T → T*F | F, F → (E) | id and the 2024-25 grammars.

    Last asked (2024-25, Section C): Construct LL(1) parsing table for S → aB | aC | Sd | Se, B → bBc | f, C → g.

  • Comparisons: top-down vs bottom-up, LL vs LR, SLR vs CLR vs LALR

    came in 5 of 9 papers

    Unit 2 · 2022-23 to 2025-26 · HOT: last 4 papers

    How to answer: Keep a ready table: top-down (LL, leftmost derivation, no left recursion) vs bottom-up (LR, reverse rightmost, handles more grammars). SLR (LR(0) items + FOLLOW, smallest, weakest) vs CLR (LR(1) items, most powerful, many states) vs LALR (merged LR(1) cores, same size as SLR, used by YACC).

    Last asked (2025-26, Section C): Discuss LR parsing in detail. Explain LR(0), SLR, CLR and LALR parsers with comparison.

High-chance topics

  • Bootstrapping, cross compiler & types of translatorsUnit 1 · came in 5 of 9 papers
  • Lexical analyser, LEX & YACC (role of FSM/RE in lexical analysis)Unit 1 · came in 5 of 9 papers
  • Intermediate code forms & types of three-address statements (arrays, procedure calls)Unit 3 · came in 5 of 9 papers
  • Loop optimisation (code motion, induction variables, strength reduction, unrolling, jamming)Unit 5 · came in 5 of 9 papers
  • Top-down parsing problems: left recursion & left factoringUnit 2 · came in 4 of 9 papers
  • Operator precedence parsing (relations, precedence functions, error recovery)Unit 2 · came in 4 of 9 papers
  • Postfix notation, postfix translation & syntax treesUnit 3 · came in 4 of 9 papers
  • Peephole & machine-dependent optimisation (register allocation)Unit 5 · came in 4 of 9 papers
  • Global data-flow analysisUnit 5 · came in 4 of 9 papers
  • Basic blocks & flow graphs (leaders, next-use information)Unit 5 · came in 3 of 9 papers

Repeated 2-mark questions (Section A)

  1. Phases of a compiler / grouping of phases / phase vs passasked 4 times
  2. Synthesized vs inherited attributes (two types of attributes)asked 4 times
  3. Shift-reduce parsing / shift-reduce and reduce-reduce conflictsasked 4 times
  4. Differentiate top-down and bottom-up parsingasked 3 times
  5. Differentiate parse tree and syntax tree (AST)asked 3 times
  6. Activation record / fields in an activation recordasked 3 times
  7. Design issues of code generatorasked 3 times
  8. Hashing / role of hash table in a symbol tableasked 3 times
  9. Types / properties of intermediate codeasked 3 times
  10. Construct a DFA / FSM for a small regular expressionasked 3 times
  11. Machine-independent optimisation: constant folding / CSEasked 3 times
  12. Define viable prefixasked 2 times
  13. Define peephole optimisationasked 2 times
  14. Bootstrappingasked 2 times
  15. What is YACC?asked 2 times
  16. Error recovery strategies for lexical analysisasked 2 times
  17. Ambiguous grammar / dangling elseasked 2 times
  18. Information stored in / entries of a symbol tableasked 2 times
  19. Define syntax-directed translation (scheme)asked 2 times
  20. Define quadruple / why quadruples are preferred over triplesasked 2 times
  21. Global data-flow analysisasked 2 times

The 10 problem types to practise by hand

  1. RE → NFA → DFA → minimised DFA: (a+b)*abb, (0+1)*(00+11)(0+1)*, (0+1)*(01*0+10*1)(0+1)*
  2. Prove E → E+E | E*E | id (and S → aSbS | bSaS | ε) ambiguous and write the unambiguous grammar
  3. Remove left recursion / left factor, find FIRST & FOLLOW, build the LL(1) table (S → aB | aC | Sd | Se ...)
  4. Shift-reduce parse of (a,(a,a)) with S → (L) | a, L → L,S | S and of id*(id+id); operator precedence table for the same grammar
  5. LR(0) / SLR table with conflict check: S → Aa | bAc | Bc | bBa, A → d, B → d and S → PQy, P → Sy | x, Q → yS
  6. CLR and LALR tables: S → CC, C → cC | d; S → AA, A → aA | b; S → aAd | bBd | aBe | bAe, A → f, B → f
  7. SDD and annotated parse tree for 4*7+3*9; SDD for S → id = E generating three-address code
  8. Quadruples, triples, indirect triples for a = b*-c + b*-c, (x+y)*(y+z)+(x+y+z), x = a+(b*-c)+(d*-e)
  9. Three-address code for while ad and e<f
  10. Basic blocks + flow graph for factorial / array-sum loop, then DAG for a+a*(b-c)+(b-c)*d with optimised code

Get the Compiler Design PDF

Share on WhatsApp

Not official AKTU material. The important questions are based on 9 previous year papers (2018-19 to 2025-26). The real paper can differ. Syllabus cross-checked with the official AKTU B.Tech CSE 3rd-year scheme 2024-25 (BCS602 units I-V, Sem VI). Research date: 20 Nov 2026.

More subjects: all B.Tech papers. Practise coding for free on Kinetic CodeGuide.

Every course is taught live online.We do not operate any offline centre — join from anywhere in India.Live online only · no offline centreFormerly Easy Coders