Self Studies

Theory of Computation Test 3

Result Self Studies

Theory of Computation Test 3
  • Score

    -

    out of -
  • Rank

    -

    out of -
TIME Taken - -
Self Studies

SHARING IS CARING

If our Website helped you a little, then kindly spread our voice using Social Networks. Spread our word to your readers, friends, teachers, students & all those close ones who deserve to know what you know now.

Self Studies Self Studies
Weekly Quiz Competition
  • Question 1
    1 / -0
    If L1 and L2 are context free language, then which of the following is not necessarily a context free language?
    Solution

    Operation under which context free language is closed: Union, Kleene Closure and Concatenation.

    L1* and L2* is a context free language

    → \({L_1} \cup \;{L_2}\) is a context free language

    \(L_1^* \cup \;L_2^*\) is a context free language

    → L1.L2 is context free ∴ (\({L_1}.{L_2}\))* is a context free language

    Operation under which context free language is not closed: Intersection, complementation, set difference

    \(\overline {{L_1} \cup {L_2}} \) is not a context free language.
  • Question 2
    1 / -0

    Consider the grammar G = {{S, X, Y}, {x, y}, S, P} with P given as

    S → SXSYS | SYSXS | ϵ

    X → x

    Y → y

    generates
    Solution

    The given grammar G generates the language having equal number of x’s and y’s

    Option 1:

    String: xxy

    L = {xnyn : n ≥ 0} cannot generate.

    Option 2:

    String: yx

    L = {xnym : n ≥ 0, m ≥ 0} cannot generate

    Option 4:

    String: xxyxyy

    L = {xnyn ∪ ymxm : n ≥ 0, m ≥ 0} cannot generate.
  • Question 3
    1 / -0
    The language {ambncm+n | m, n ≥ 1} is:
    Solution

    Data

    language {ambncm+n | m, n ≥ 1}

    Explanation

    It is not regular.

    It requires memory element for recording the occurrences of a and b to verify number of c. Regular languages cannot have such dependencies.

    It is context free

    It can be verified using stack within the following steps.

    1. Push a’s on to the stack
    2. Push b’s on to the stack
    3. Parsing through c’s, for every c encountered all the b’s first, and then all the a’s.
    4. If nothing is left in the stack after parsing through c’s is done, then the string accepted belongs to this language.
  • Question 4
    1 / -0

    Which of the following grammar is in Greibach Normal Form?

    A. S → AB, A → a, B → b

    B. S → aA | A → ϵ

    C. S → Aa, A → a

    Solution

    A context grammar is said to be in Greibech Normal Form if all the productions have the form

    S → xA

    where x ϵ T and x ϵ V*

    T is terminal and V is variable (non-terminal)

    Option A: Not in GNF. Since production S → AB is not in GNF

    Option B: Not in GNF. Since production A → ϵ is not in GNF

    Option C: Not in GNF. Since production S → Aa is not in GNF

  • Question 5
    1 / -0

    Which of the following statements is true?

    S1: If L is a context-free language and R is a regular language, L-R is not necessarily a context-free language.

    S2: The context-free languages are closed under positive closure.

    S3: The context-free languages are not closed under reversal.

    Solution

    If L is a context-free language and R is a regular language, L-R is also a context-free language. It is because if R is regular, then R' is also regular. L-R is equivalent to L\(∩\)R'. We know that if L is a CFL and R is a regular language then L\(∩\)R is a CFL. Therefore, L\(∩\)R' is also a CFL making L-R a CFL.

    Therefore, S1 is false

    Context-free languages are closed under positive closure or (Kleen plus)

    Therefore S2 is true

    Context-free languages are closed under reversal.

    Therefore S3 is false

  • Question 6
    1 / -0

    Which of the following language L is/are not a deterministic context free grammar?

    I. L = {wcwr : w ϵ {a, b}*}

    II. L = {anbmcp, n = m or m = p}

    III. L = {wwr : w ϵ {a, b}* }

    Solution

    L = { wcwr : w ϵ {a, b}*} is a deterministic context free language. Since center is known, that is, c.

    Before c push the terminal onto a stack and after c match and pop.

    L = {anbmcp, n = m or m = p} and L = {wcwr : w ϵ {a, b}* } are non-deterministic context free language.
  • Question 7
    1 / -0

    Consider the following grammars:

    G1 : S → aSb|bSa|aa

    G2 : S → aSb|bSa|SS|λ

    G3 : S → aSb|bSa|SS|a

    G4 : S → aSb|bSa|SS|SSS|λ

    Which of the following is correct w.r.t. the above grammars?
    Solution

    G1 : S → aSb|bSa|aa

    gives a language G1 = {number of a = number of b + 2}

    G2 : S → aSb|bSa|SS|λ

    gives a language G2 = {number of a = number of b}

    G3 : S → aSb|bSa|SS|a

    gives a language G3 = {number of a > = number of b + 1}

    G4: S → aSb|bSa|SS|SSS|λ

    gives a language G4 = {number of a = number of b}

    Hence, G2 and G4 are equivalent.

  • Question 8
    1 / -0

    What is the minimum number of productions present in the below given context free grammar to make it Chomsky Normal Form?

    S → XYx

    X → xxy

    Y → Xz

    Solution

    Concepts:

    A context-free grammar is in Chomsky Normal Form if all productions are of the form

    A → BC or A → a

    {A, B, C} ϵ V and a ϵ T

    V is variable(non-terminal) and a is terminal

    Calculation:

    S → XA

    A → YB

    B → x

    X → BC

    C → BD

    D → y

    Y → XE

    E → z

  • Question 9
    1 / -0

    Which of the following is/are false about the context free grammar if L1 is context free language and LR1 be its reversal also L2 is deterministic context free language (DCFL) and LR1 be its reversal language?

    I. LR1 is not a CFL

    II. LR2 is a DFCL

    III. LR1 ∪ LR2 is a CFL

    Solution

    Option 1 is false: CFL is closed under reversal. Therefore, LR1 is a CF:

    Option 2 is false: DCFL is not closed under reversal. Therefore, LR2 is not DCFL.

    If a language is DCFL then it is CFL but vice versa is not true.

    Option 3 is true: CFL is closed under union. LR1 ∪ LR2 is a CFL.
  • Question 10
    1 / -0

    Which of following problems are undecidable?

    I. Membership problem in context-free languages

    II. Whether a given context-free language is regular

    III. Whether a finite state automation halts on all inputs

    IV. Membership problem for type 0 languages
    Solution

    Concept

    A problem is said to be Decidable if we can always construct a corresponding algorithm that can answer the problem correctly. Based upon this property, problems are classified as

    1. Decidable
    2. Semi-decidable
    3. Undecidable

    Explanation:

    Statement i: Decidable

    Membership problem in CFL is decidable using CYK algorithm to check the membership.

    Statement ii: Undecidable

    To check whether a given CFL is regular or not in undecidable.

    Statement iii: Decidable

    To determine whether an FA halts on all inputs or not is decidable because we have final and non-final states in FAs that indicate whether the input string is accepted or not.

    Statement iv: Undecidable

    Membership problem for type 0 (Recursively Enumerable) grammars is undecidable.
Self Studies
User
Question Analysis
  • Correct -

  • Wrong -

  • Skipped -

My Perfomance
  • Score

    -

    out of -
  • Rank

    -

    out of -
Re-Attempt Weekly Quiz Competition
Selfstudy
Selfstudy
Self Studies Get latest Exam Updates
& Study Material Alerts!
No, Thanks
Self Studies
Click on Allow to receive notifications
Allow Notification
Self Studies
Self Studies Self Studies
To enable notifications follow this 2 steps:
  • First Click on Secure Icon Self Studies
  • Second click on the toggle icon
Allow Notification
Get latest Exam Updates & FREE Study Material Alerts!
Self Studies ×
Open Now