Compilers · Phases interview questions

42 real Compilers · Phases questions from the Computer Science Fundamentals bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is compiler?

Junior
  1. A.building the parse tree from the input tokens up to the start symbol by reductions, as in LR parsers
  2. B.a program that translates an entire source program into machine or intermediate code before execution
  3. C.a data structure storing identifiers with their types, scopes, and attributes for use across phases
  4. D.a parse tree mirrors every grammar rule, while an abstract syntax tree keeps only meaningful structure
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.compiler — building the parse tree from the input tokens up to the start symbol by reductions, as in LR parsers
  2. B.compiler — the first compiler phase that scans source characters and groups them into tokens
  3. C.compiler — a program that translates an entire source program into machine or intermediate code before execution
  4. D.compiler — LL scans left-to-right with leftmost derivation top-down, while LR uses rightmost derivation bottom-up
Reveal the answer + AI explanation — free account

4. What is interpreter?

Junior
  1. A.a machine-independent representation, such as three-address code, generated between front and back ends
  2. B.the first compiler phase that scans source characters and groups them into tokens
  3. C.a program that executes source code statement by statement without producing a separate binary
  4. D.building the parse tree from the start symbol toward the input, as in recursive-descent and LL parsers
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Junior
  1. A.interpreter — LL scans left-to-right with leftmost derivation top-down, while LR uses rightmost derivation bottom-up
  2. B.interpreter — a machine-independent representation, such as three-address code, generated between front and back ends
  3. C.interpreter — building the parse tree from the start symbol toward the input, as in recursive-descent and LL parsers
  4. D.interpreter — a program that executes source code statement by statement without producing a separate binary
Reveal the answer + AI explanation — free account

7. What is lexical analysis?

Junior
  1. A.a parse tree mirrors every grammar rule, while an abstract syntax tree keeps only meaningful structure
  2. B.the phase that transforms intermediate code to run faster or use fewer resources without changing meaning
  3. C.building the parse tree from the start symbol toward the input, as in recursive-descent and LL parsers
  4. D.the first compiler phase that scans source characters and groups them into tokens
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Junior
  1. A.lexical analysis — a program that translates an entire source program into machine or intermediate code before execution
  2. B.lexical analysis — building the parse tree from the start symbol toward the input, as in recursive-descent and LL parsers
  3. C.lexical analysis — the first compiler phase that scans source characters and groups them into tokens
  4. D.lexical analysis — a data structure storing identifiers with their types, scopes, and attributes for use across phases
Reveal the answer + AI explanation — free account

10. What is token?

Junior
  1. A.a program that executes source code statement by statement without producing a separate binary
  2. B.a data structure storing identifiers with their types, scopes, and attributes for use across phases
  3. C.a categorized lexical unit such as a keyword, identifier, operator, or literal
  4. D.building the parse tree from the start symbol toward the input, as in recursive-descent and LL parsers
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Junior
  1. A.token — the phase that transforms intermediate code to run faster or use fewer resources without changing meaning
  2. B.token — a categorized lexical unit such as a keyword, identifier, operator, or literal
  3. C.token — building the parse tree from the start symbol toward the input, as in recursive-descent and LL parsers
  4. D.token — a program that executes source code statement by statement without producing a separate binary
Reveal the answer + AI explanation — free account

13. What is syntax analysis?

Junior
  1. A.a machine-independent representation, such as three-address code, generated between front and back ends
  2. B.the parsing phase that builds a parse tree by checking tokens against the grammar
  3. C.the phase that checks meaning rules like type compatibility and declared-before-use using the symbol table
  4. D.a categorized lexical unit such as a keyword, identifier, operator, or literal
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Junior
  1. A.syntax analysis — LL scans left-to-right with leftmost derivation top-down, while LR uses rightmost derivation bottom-up
  2. B.syntax analysis — building the parse tree from the start symbol toward the input, as in recursive-descent and LL parsers
  3. C.syntax analysis — the phase that checks meaning rules like type compatibility and declared-before-use using the symbol table
  4. D.syntax analysis — the parsing phase that builds a parse tree by checking tokens against the grammar
Reveal the answer + AI explanation — free account

16. What is semantic analysis?

Mid
  1. A.the phase that transforms intermediate code to run faster or use fewer resources without changing meaning
  2. B.the phase that checks meaning rules like type compatibility and declared-before-use using the symbol table
  3. C.a program that executes source code statement by statement without producing a separate binary
  4. D.a program that translates an entire source program into machine or intermediate code before execution
Reveal the answer + AI explanation — free account

18. Which statement is correct?

Mid
  1. A.semantic analysis — the phase that checks meaning rules like type compatibility and declared-before-use using the symbol table
  2. B.semantic analysis — the first compiler phase that scans source characters and groups them into tokens
  3. C.semantic analysis — the parsing phase that builds a parse tree by checking tokens against the grammar
  4. D.semantic analysis — a program that translates an entire source program into machine or intermediate code before execution
Reveal the answer + AI explanation — free account

19. What is intermediate code?

Mid
  1. A.a categorized lexical unit such as a keyword, identifier, operator, or literal
  2. B.LL scans left-to-right with leftmost derivation top-down, while LR uses rightmost derivation bottom-up
  3. C.a machine-independent representation, such as three-address code, generated between front and back ends
  4. D.building the parse tree from the start symbol toward the input, as in recursive-descent and LL parsers
Reveal the answer + AI explanation — free account

21. Which statement is correct?

Mid
  1. A.intermediate code — a categorized lexical unit such as a keyword, identifier, operator, or literal
  2. B.intermediate code — a machine-independent representation, such as three-address code, generated between front and back ends
  3. C.intermediate code — LL scans left-to-right with leftmost derivation top-down, while LR uses rightmost derivation bottom-up
  4. D.intermediate code — the first compiler phase that scans source characters and groups them into tokens
Reveal the answer + AI explanation — free account

22. What is code optimization?

Mid
  1. A.the phase that checks meaning rules like type compatibility and declared-before-use using the symbol table
  2. B.LL scans left-to-right with leftmost derivation top-down, while LR uses rightmost derivation bottom-up
  3. C.the phase that transforms intermediate code to run faster or use fewer resources without changing meaning
  4. D.the parsing phase that builds a parse tree by checking tokens against the grammar
Reveal the answer + AI explanation — free account

24. Which statement is correct?

Mid
  1. A.code optimization — a program that executes source code statement by statement without producing a separate binary
  2. B.code optimization — the phase that checks meaning rules like type compatibility and declared-before-use using the symbol table
  3. C.code optimization — a program that translates an entire source program into machine or intermediate code before execution
  4. D.code optimization — the phase that transforms intermediate code to run faster or use fewer resources without changing meaning
Reveal the answer + AI explanation — free account

25. What is code generation?

Mid
  1. A.the parsing phase that builds a parse tree by checking tokens against the grammar
  2. B.the final phase that maps optimized intermediate code into target machine instructions
  3. C.building the parse tree from the start symbol toward the input, as in recursive-descent and LL parsers
  4. D.a categorized lexical unit such as a keyword, identifier, operator, or literal
Reveal the answer + AI explanation — free account

27. Which statement is correct?

Mid
  1. A.code generation — the first compiler phase that scans source characters and groups them into tokens
  2. B.code generation — the final phase that maps optimized intermediate code into target machine instructions
  3. C.code generation — the phase that checks meaning rules like type compatibility and declared-before-use using the symbol table
  4. D.code generation — a categorized lexical unit such as a keyword, identifier, operator, or literal
Reveal the answer + AI explanation — free account

28. What is symbol table?

Mid
  1. A.the final phase that maps optimized intermediate code into target machine instructions
  2. B.a data structure storing identifiers with their types, scopes, and attributes for use across phases
  3. C.a program that translates an entire source program into machine or intermediate code before execution
  4. D.the phase that transforms intermediate code to run faster or use fewer resources without changing meaning
Reveal the answer + AI explanation — free account

30. Which statement is correct?

Mid
  1. A.symbol table — a data structure storing identifiers with their types, scopes, and attributes for use across phases
  2. B.symbol table — building the parse tree from the start symbol toward the input, as in recursive-descent and LL parsers
  3. C.symbol table — the final phase that maps optimized intermediate code into target machine instructions
  4. D.symbol table — a parse tree mirrors every grammar rule, while an abstract syntax tree keeps only meaningful structure
Reveal the answer + AI explanation — free account

Showing 30 of 42 Compilers · Phases questions — the full set, with answers, explanations and an AI tutor on every question, is inside.

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Compilers · Phases free