ITPEC FE Morning October 2020 Question 17

Source exam: ITPEC FE Morning October 2020Topic: Software Development

ITPEC FE Morning October 2020 — Question 17 of 80

Compiler Phases — lexical analysis is the first phase of compilation.

Compiler phases execute in this order:

  • Lexical analysis — breaks source code into tokens (keywords, identifiers, operators)
  • Syntactic analysis (parsing) — builds a parse tree from tokens
  • Semantic analysis — checks types, scope, and meaning
  • Optimization — improves code for performance
  • Code generation — produces machine code

Why not others:
- (b) Optimization — occurs after semantic analysis

- (c) Semantic analysis — occurs after syntactic analysis

- (d) Syntactic analysis (parsing) — occurs after lexical analysis

Key rule: Lexical → Syntactic → Semantic → Optimization → Code Generation.

AI-generated — may contain errors

The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.