Match the following: (P) Lexical analysis (i) Leftmost derivation (Q) Top down…

2016

Match the following:

(P) Lexical analysis

(i) Leftmost derivation

(Q) Top down parsing

(ii) Type checking

(R)Semantic analysis

(iii) Regular expressions

(S) Runtime environments

(iv) Activation records

  1. A.

    P ↔ i, Q ↔ ii, R ↔ iv, S ↔ iii

  2. B.

    P ↔ iii, Q ↔ i, R ↔ ii, S ↔ iv

  3. C.

    P ↔ ii, Q ↔ iii, R ↔ i, S ↔ iv

  4. D.

    P ↔ iv, Q ↔ i, R ↔ ii, S ↔ iii

Attempted by 155 students.

Show answer & explanation

Correct answer: B

Key matching:

  • Lexical analysis → Regular expressions. Lexical analyzers use regular expressions (and finite automata) to recognize tokens.

  • Top-down parsing → Leftmost derivation. Top-down parsers expand the leftmost nonterminal first, producing a leftmost derivation of the input.

  • Semantic analysis → Type checking. Semantic analysis checks types, scopes, and other meaning-related properties.

  • Runtime environments → Activation records. Runtime environments use activation records (stack frames) to manage procedure calls, local variables, and return addresses.

So the correct matching is: P ↔ iii, Q ↔ i, R ↔ ii, S ↔ iv.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir