hamburger menu
All Coursesall course arrow
adda247
reward-icon
adda247
    arrow
    arrow
    arrow
    Consider the grammar: S → SbS | a Consider the following statements: The string abababa has (A) two parse trees (B) two left-most deriv
    Question



    Consider the grammar:
    S → SbS | a
    Consider the following statements:
    The string abababa has
    (A) two parse trees
    (B) two left-most derivations
    (C) two right-most derivations
    Which of the following is correct?

    A.

    All (A), (B) and (C) are true

    B.

    Only (B) is true

    C.

    Only (C) is true

    D.

    Only (A) is true

    Correct option is D




    Information Booster
    1. Parse Tree:
    · A graphical representation of the syntactic structure of a string according to a grammar.
    · Different parse trees represent different derivations of the string.
    2. Leftmost and Rightmost Derivations:
    · Leftmost: Always expand the leftmost non-terminal first.
    · Rightmost: Always expand the rightmost non-terminal first.
    3. Ambiguity in Grammar:
    · A grammar is ambiguous if a string has more than one parse tree or derivation.
    · The given grammar is ambiguous for strings like ababab.
    Additional Knowledge
    · Unambiguous Grammar: A grammar where every valid string has a unique parse tree.
    · Chomsky Normal Form (CNF): Used to simplify grammar and remove ambiguity where possible.

    Free Tests

    Free
    Must Attempt

    Basics of Education: Pedagogy, Andragogy, and Hutagogy

    languageIcon English
    • pdpQsnIcon10 Questions
    • pdpsheetsIcon20 Marks
    • timerIcon12 Mins
    languageIcon English
    Free
    Must Attempt

    UGC NET Paper 1 Mock Test 1

    languageIcon English
    • pdpQsnIcon50 Questions
    • pdpsheetsIcon100 Marks
    • timerIcon60 Mins
    languageIcon English
    Free
    Must Attempt

    Basics of Education: Pedagogy, Andragogy, and Hutagogy

    languageIcon English
    • pdpQsnIcon10 Questions
    • pdpsheetsIcon20 Marks
    • timerIcon12 Mins
    languageIcon English

    Similar Questions

    test-prime-package

    Access ‘UGC NET Computer Science’ Mock Tests with

    • 60000+ Mocks and Previous Year Papers
    • Unlimited Re-Attempts
    • Personalised Report Card
    • 500% Refund on Final Selection
    • Largest Community
    students-icon
    354k+ students have already unlocked exclusive benefits with Test Prime!
    Our Plans
    Monthsup-arrow