Context Free Languages questions

Q38

GATE CS 2024 CS-1Context Free LanguagesMCQ2 marks−2/3 if wrong
Consider the following grammar GG, with SS as the start symbol. The grammar GG has three incomplete productions denoted by (1), (2), and (3).
S→daT∣(1)S \to daT \mid (1)
T→aS∣bT∣(2)T \to aS \mid bT \mid (2)
R→(3)∣ϵR \to (3) \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?
Show answer without attempting

Answer: A

Q59

GATE CS 2024 CS-1Context Free LanguagesNAT2 marks
Let G=(V,Σ,S,P)G = (V, \Sigma, S, P) be a context-free grammar in Chomsky Normal Form with Σ={a,b,c}\Sigma = \{a, b, c\} and VV containing 10 variable symbols including the start symbol SS. The string w=a30b30c30w = a^{30}b^{30}c^{30} is derivable from SS. The number of steps (application of rules) in the derivation S→∗wS \to^* w is _________
Show answer without attempting

Answer: 179

Q52

GATE CS 2024 CS-2Context Free LanguagesMSQ2 marks
Consider a context-free grammar GG with the following 3 rules.
S→aSS \to aS, S→aSbSS \to aSbS, S→cS \to c

Let w∈L(G)w \in L(G). Let na(w),nb(w),nc(w)n_a(w), n_b(w), n_c(w) denote the number of times a,b,ca, b, c occur in ww, respectively. Which of the following statements is/are TRUE?
More than one option can be correct.
Show answer without attempting

Answer: B, C

0/30 correct0 marks

Related topics in Theory of Computation