Computer Science And Engineering

Computer Science And EngineeringTheory of Computation / FLATMultiple Choice (MCQ)1 Mark
Q7.

Consider the following grammar GG, with SS as the start symbol. The grammar GG has three incomplete productions denoted by (1), (2), and (3).

SdaT(1)S \rightarrow daT \mid \underline{\quad (1) \quad} TaSbT(2)T \rightarrow aS \mid bT \mid \underline{\quad (2) \quad} R(3)ϵR \rightarrow \underline{\quad (3) \quad} \mid \epsilon

The set of terminals is {a,b,c,d,f}\{a, b, c, d, f\}. The FIRST and FOLLOW sets of the different non-terminals are as follows.

FIRST(S)={c,d,f},FIRST(T)={a,b,ϵ},FIRST(R)={c,ϵ}\text{FIRST}(S) = \{c, d, f\}, \text{FIRST}(T) = \{a, b, \epsilon\}, \text{FIRST}(R) = \{c, \epsilon\} FOLLOW(S)=FOLLOW(T)={c,f,$},FOLLOW(R)={f}\text{FOLLOW}(S) = \text{FOLLOW}(T) = \{c, f, \$\}, \text{FOLLOW}(R) = \{f\}

Which one of the following options CORRECTLY fills in the incomplete productions?

A
(1) SRfS \rightarrow Rf    (2) TϵT \rightarrow \epsilon    (3) RcTRR \rightarrow cTR
B
(1) SfRS \rightarrow fR    (2) TϵT \rightarrow \epsilon    (3) RcTRR \rightarrow cTR
C
(1) SfRS \rightarrow fR    (2) TcTT \rightarrow cT    (3) RcRR \rightarrow cR
D
(1) SRfS \rightarrow Rf    (2) TcTT \rightarrow cT    (3) RcRR \rightarrow cR