Compiler Phases, Linking & Loading

Answer & solution
Official answer: C
1. Follow the compiler pipeline from source text. The lexical analyzer reads characters and groups them into tokens, so Q→iv. The syntax analyzer reads those tokens and recognizes grammatical structure, so S→ii.
2. Semantic analysis then uses the syntax tree to check matters such as declarations, types, and compatible operations; hence P→iii.
3. After front-end processing and intermediate-code construction, the code generator translates the intermediate representation into target code, giving R→i. In the requested P,Q,R,S order the mapping is (iii,iv,i,ii), option C. Do not confuse a phase's output with its input.