Multiple choice

Which of the following is/are the phase(s) of compilation process?

  1. Lexical analysis

  2. Code generation

  3. Static analysis

  4. Both (1) and (2)

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The compilation process consists of multiple phases: Lexical analysis (breaking source code into tokens) and Code generation (producing machine code) are both valid phases. Other phases include syntax analysis, semantic analysis, and code optimization. Static analysis is typically part of semantic analysis phase.