Parsing questions

Q46

GATE CS 2025 CS-1ParsingMSQ2 marks
Which of the following statement(s) is/are TRUE while computing First and Follow during top down parsing by a compiler?
More than one option can be correct.
Show answer without attempting

Answer: A, D

Q40

GATE CS 2025 CS-2ParsingMCQ2 marks−2/3 if wrong
Given a Context-Free Grammar GG as follows:

S→Aa∣bAc∣dc∣bdaS \rightarrow Aa \mid bAc \mid dc \mid bda
A→dA \rightarrow d

Which ONE of the following statements is TRUE?
Show answer without attempting

Answer: C

Q51

GATE CS 2025 CS-2ParsingMSQ2 marks
Consider two grammars G1G_1 and G2G_2 with the production rules given below:

G1:S→if E then S∣if E then S else S∣aG_1: S \rightarrow \text{if } E \text{ then } S \mid \text{if } E \text{ then } S \text{ else } S \mid a
E→bE \rightarrow b

G2:S→if E then S∣MG_2: S \rightarrow \text{if } E \text{ then } S \mid M
M→if E then M else S∣cM \rightarrow \text{if } E \text{ then } M \text{ else } S \mid c
E→bE \rightarrow b

where if,then,else,a,b,c\text{if}, \text{then}, \text{else}, a, b, c are the terminals.

Which of the following option(s) is/are CORRECT?
More than one option can be correct.
Show answer without attempting

Answer: C, D

0/30 correct0 marks

Related topics in Compiler Design