Site navigation

A grammar G is LL(1) if and only if which of the following conditions hold for every pair of distinct…

A context-free grammar is LL(1) if and only if for every pair of distinct productions \(A \to \alpha \mid \beta\), all three conditions hold: (I) \(\alpha\) and \(\beta\) do…

Choose your answer

A grammar G is LL(1) if and only if which of the following conditions hold for every pair of distinct productions A → α | β?
I. a ∉ First(α) ∩ First(β) for any terminal symbol a of the grammar.
II. λ ∉ First(α) ∩ First(β).
III. First(α) ∩ Follow(A) = φ if λ ∈ First(β) (and First(β) ∩ Follow(A) = φ if λ ∈ First(α)).

Select one answer
Answer and explanation

Correct answer D

A context-free grammar is LL(1) if and only if for every pair of distinct productions A→α∣βA \to \alpha \mid \beta, all three conditions hold: (I) α\alpha and β\beta do not derive strings beginning with the same terminal symbol aa, (II) at most one of α\alpha and β\beta can derive the empty string λ\lambda, and (III) if one alternative derives λ\lambda, the First set of the other alternative is disjoint from Follow(A)\text{Follow}(A). Therefore, all of I, II and III are required.

Practice for these exams

  • RPSC Assistant Professor (College Education)

  • UGC NET Computer Science and Applications

Related question papers

Related exam syllabi

Related questions in this topic