GATE / CS ARCHIVE

GATE CSE 2016 SET 2 / QUESTION 19

GATE CSE 2016 Set 2 Q19

Compiler Design · Compiler Phases, Linking & Loading · Full GATE CSE 2016 Set 2 paper

GATE 2016 Set 2, Q19 1 mark · MCQ
Report issue

Compiler Phases, Linking & Loading

Question 19, GATE 2016: Match P lexical analysis, Q top-down parsing, R semantic analysis, S runtime environments with i leftmost derivation, ii type checking, iii regular expressions, iv activation records. A P-i,Q-ii,R-iv,S-iii; B P-iii,Q-i,R-ii,S-iv; C P-ii,Q-iii,R-i,S-iv; D P-iv,Q-i,R-ii,S-iii.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Lexical analysis uses regular expressions; top-down parsing constructs a leftmost derivation; semantic analysis checks types; runtime environments organize activation records. Hence P-iii, Q-i, R-ii, S-iv, B.

A lexer recognizes tokens such as identifiers and numbers from character patterns. A top-down parser expands the leftmost pending nonterminal toward the input. Semantic analysis rejects type-incompatible expressions even when their syntax parses. Activation records store each call’s parameters, locals and return information at runtime; this separates all four roles.

Original paper, page 30 · Answer key