Skip to content
GATEiit

GATE CSE 2017 Session 1 Q27: FOLLOW(Q) for P → xQRS, Q → yz | z, R → w | ε, S → y

Syllabus topic: Lexical analysis, parsing and syntax-directed translation

Question

Consider the following grammar:

What is FOLLOW(Q)?

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 1/3 mark in GATE.
Show answer and explanation

Answer: C (official GATE 2017 final answer key)

Concept used: FOLLOW of a nonterminal includes FIRST of what follows it, and passes through nullable symbols to the next ones.

Concept notes

Loading notes…

First step: In P→xQRS, take FIRST(R) without ε, and since R is nullable also add FIRST(S).

Full step-by-step solution

Loading…

Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.

More questions on Lexical analysis, parsing and syntax-directed translation

Every PYQ on this topic →

Share this question

WhatsAppDownload image

Source: official GATE 2017 Session 1 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key