Question

Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?

Choose every correct option
Official answer and solution
Official answer
A and D
From
Official GATE 2025 answer key

Solution

Recall the standard rules for constructing First\text{First} and Follow\text{Follow} sets in LL(1) parsing.

By the rules for computing First\text{First} and Follow\text{Follow} sets:

  • (A) True: If A→ϵA \to \epsilon is a production, then ϵ∈First(A)\epsilon \in \text{First}(A).
  • (B) False: The input right end-marker ($) is never placed in First\text{First} sets.
  • (C) False: Follow\text{Follow} sets contain only terminals and the end-marker $; ϵ\epsilon is never in any Follow\text{Follow} set.
  • (D) True: The right end-marker $ is always added to Follow(S)\text{Follow}(S) for the start symbol SS.
Final answer

Options (A), (D)

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2025 Computer Science and Information Technology - Session 1 (CS1)
Question
46 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.