Compiler Phases, Linking & Loading

Answer & solution
Official answer: B
Approach: Follow the conventional progression from source characters to structure to intermediate form to optimization.
1. Derivation. Lexical analysis produces tokens(P–2). Syntax analysis constructs a parse tree(Q–3). An abstract syntax tree is a common intermediate representation associated with intermediate-code generation(R–1). Constant folding is a code optimization(S–4). This gives B. Practical compilers can construct ASTs during parsing too; these are the conventional matches among the listed choices, not exclusive ownership of representations.
2. Explanation and checks. A lexer recognizes lexemes such as identifiers and produces tokens; a parser groups tokens according to grammar productions and yields a parse tree. An AST removes grammar-only detail to represent the essential operators and operands, so among these choices it is the intermediate representation. Constant folding replaces an expression such as 3×4 with 12. Real implementations may combine phase boundaries, but B is the intended one-to-one conceptual match.