Question
Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?
Official answer and solution
- Official answer
- A and D
- From
- Official GATE 2025 answer key
Solution
Recall the standard rules for constructing and sets in LL(1) parsing.
By the rules for computing and sets:
- (A) True: If is a production, then .
- (B) False: The input right end-marker (
$) is never placed in sets. - (C) False: sets contain only terminals and the end-marker
$; is never in any set. - (D) True: The right end-marker
$is always added to for the start symbol .
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.