Compilers · Phases interview questions

42 Compilers · Phases questions from the Computer Science Fundamentals bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.

Sign up free to see every answer with its explanation and ask the AI tutor.

Practice Compilers · Phases free

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

Answer + AI explanation with a free account

2. Which term means: "a program that translates an entire source program into machine or intermediate code before execution"?

Junior
  1. A.compiler
  2. B.lexical analysis
  3. C.syntax analysis
  4. D.parse tree vs AST

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

5. Which term means: "a program that executes source code statement by statement without producing a separate binary"?

Junior
  1. A.token
  2. B.parse tree vs AST
  3. C.interpreter
  4. D.bottom-up parsing

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

8. Which term means: "the first compiler phase that scans source characters and groups them into tokens"?

Junior
  1. A.intermediate code
  2. B.top-down parsing
  3. C.lexical analysis
  4. D.code optimization

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

11. Which term means: "a categorized lexical unit such as a keyword, identifier, operator, or literal"?

Junior
  1. A.token
  2. B.symbol table
  3. C.syntax analysis
  4. D.code optimization

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

14. Which term means: "the parsing phase that builds a parse tree by checking tokens against the grammar"?

Junior
  1. A.syntax analysis
  2. B.code optimization
  3. C.lexical analysis
  4. D.parse tree vs AST

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

17. Which term means: "the phase that checks meaning rules like type compatibility and declared-before-use using the symbol table"?

Mid
  1. A.code generation
  2. B.semantic analysis
  3. C.bottom-up parsing
  4. D.interpreter

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

20. Which term means: "a machine-independent representation, such as three-address code, generated between front and back ends"?

Mid
  1. A.code optimization
  2. B.syntax analysis
  3. C.intermediate code
  4. D.token

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

23. Which term means: "the phase that transforms intermediate code to run faster or use fewer resources without changing meaning"?

Mid
  1. A.code optimization
  2. B.syntax analysis
  3. C.intermediate code
  4. D.interpreter

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

26. Which term means: "the final phase that maps optimized intermediate code into target machine instructions"?

Mid
  1. A.interpreter
  2. B.token
  3. C.LL vs LR parsing
  4. D.code generation

Answer + AI explanation with a 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

Answer + AI explanation with a 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

Answer + AI explanation with a free account

29. Which term means: "a data structure storing identifiers with their types, scopes, and attributes for use across phases"?

Mid
  1. A.symbol table
  2. B.bottom-up parsing
  3. C.token
  4. D.intermediate code

Answer + AI explanation with a 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

Answer + AI explanation with a 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 free readiness check

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take the free 2-minute readiness check for a scored result. One full AI mock interview, scored like a real panel, is free when you sign up.

Practice Compilers · Phases free
24,000+ questions & coding problemsSoftware & IT16,274 questionsGovernment jobs26 examsAptitudenew questions every timeAI practice interviewwith feedback65 topics to practiseMechanical1,149 questionsGATE ME9 papersEngineering Mathematics381 questions2-minute checkfreeDSA Problems1,422Civil1,005 questionsGATE CE9 papersCS Fundamentals1,209 questionsYour scores6 skillsSystem Design25Electrical / EEE1,047 questionsGATE EE9 papersRun your codeC++ · Java · PythonLow-Level Design144Electronics & Comm.975 questionsGATE EC9 papersAI help on every questionFull-Stack6,282Chemical1,005 questionsGATE CH9 papersAI whiteboardsystem designWork abroadEurope · remote · transfersESE ME1 paperGATE practice papers2019–2026ESE CE1 paperDate alertsbefore the last dateESE EE1 paperBehavioural courseHR round practiceESE ET1 paperResume optimizerProSSC JE ME1 paperApplication trackerSSC JE CE1 paperCompany-wise prepSSC JE EE1 paperRole roadmapsRRB JE1 subjectPriced in ₹UPI · cardsISRO SC1 paperGATE CS9 papersIBPS SO IT1 paperUGC NET CS1 paperSSC CGL26 papersIBPS PO26 papersRRB NTPC26 papersSSC CHSL26 papersIBPS Clerk26 papersSBI Clerk26 papersRRB Group D26 papersSSC CPO26 papersSSC GD26 papers