Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
234 views
in General by (96.6k points)
closed by

Consider the following grammar G

S → F | H

F → p | c

H → d | c

Where S, F, and H are non-terminal symbols, p, d, and c are terminal symbols. Which of the following statement(s) is/are correct?

S1. LL(1) can parse all strings that are generated using grammar G

S2. LR(1) can parse all string that are generated using grammar G
1. Only S1
2. Only S2
3. Both S1 and S2
4. Neither S1 nor S2

1 Answer

0 votes
by (85.8k points)
selected by
 
Best answer
Correct Answer - Option 4 : Neither S1 nor S2

Concept:

First, check the grammar is ambiguous or not. If a grammar is ambiguous then it cannot be LL(1) and LR(1).

Explanation:

Given grammar is: S → F | H

F → p | c

H → d | c

First derivation for “c”:

S → F → c

Second derivation for “c”:

S → H → c

Two parse tree exists for single string and hence given grammar is ambiguous. It is neither LL(1) nor LR(1).

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...