Consider the following two statements: P: Every regular grammar is LL(1) Q:…

2007

Consider the following two statements:

P: Every regular grammar is LL(1)
Q: Every regular set has a LR(1) grammar

Which of the following is TRUE?

  1. A.

    Both P and Q are true

  2. B.

    P is true and Q is false

  3. C.

    P is false and Q is true

  4. D.

    Both P and Q are false

Attempted by 10 students.

Show answer & explanation

Correct answer: C

Statement P is false because not every regular grammar is LL(1); for example, left-recursive or ambiguous regular grammars cannot be LL(1). Statement Q is true because every regular language has a deterministic context-free grammar, and all regular languages are accepted by LR(1) parsers. Therefore, P is false and Q is true, making option C correct.

Explore the full course: Gate Guidance By Sanchit Sir