Self Studies

Theory of Computation Test 1

Result Self Studies

Theory of Computation Test 1
  • 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
    2 / -0.33
    Recursive language is not closed under
    Solution

    Recursive language is not closed under: Homomorphism, substitution

    Recursive language is closed under: Union, concatenation, set difference, complementation, intersection etc.
  • Question 2
    2 / -0.33

    Which of the following definitions generates the same languages as L, where L = { xnyn, n ≥ 1 }

    i. E → xEy | xy

    ii. xy | x+xyy+

    iii. x+y+
    Solution

    L = { xnyn, n ≥ 1 }

    This language generates the string equal number of x and y and x is followed by y

    \({\rm{L}} = \left\{ {{\rm{xy}},{\rm{\;xxyy}},{\rm{\;xxxyyy}} \ldots } \right\}\)

    Statement i: E → xEy | xy

    E → xy

    E → xEy → xxyy

    E → xEy → xxEyy → xxxyyy

    Equal number of x and y and x is followed by y

    Statement ii: xy | x+xyy+

    L1 = {xy, xxyy, xxxyy}

    xxxyy cannot be generated by language L.

    Statement ii: x+y+

    L2 = {xy, xxy}

    xxy cannot be generated by language L.

    Therefore E → xEy | xy definition generates the same languages as L.
  • Question 3
    2 / -0.33
    Let L be a language and L' be its complement. Which one of the following is true?
    Solution
    • Recursive languages are closed under complementation. Therefore, if L is recursive then L’ is also recursive. Every recursive language is recursively enumerable. Hence statement 4 is correct.
    • Recursively Enumerable language are not closed complementation. Therefore, if L is recursively enumerable then L’ may or may not recursively enumerable. If L’ is not recursively enumerable then it cannot be recursive. 
  • Question 4
    2 / -0.33
    Let the number of states in non-deterministic finite automaton be 'N' and the number of states in the corresponding deterministic finite automaton be 'D'. N, K, and D are positive integers. What is the correct relation between NK and D? 
    Solution

    Concept:

    If 'k' is the number of states of the NFA, it has 2k subsets of states. Each subset corresponds to one of the possibilities that the DFA must remember, so the DFA simulating the NFA will have 2states.

    Explanation:

    k ≤ 2K

    NFA = NK

    and DFA = D, also they are ≥ 1

    1 ≤ Nk ≤ D

  • Question 5
    2 / -0.33

    The grammar G = ({S, X, Y}, {p, q}, S, P) with productions

    S → X, X → qY | ϵ, Y → Xp is a _____.

    Solution

    Right-Linear Grammar:

    A grammar G = (V, T, S, P) is said to be right-linear grammar if all the productions are of the form

    A → xB

    A → x

    Where A, B ϵ V, and x ϵ T*

    Left-Linear Grammar:

    A grammar G = (V, T, S, P) is said to be left-linear grammar if all the productions are of the form

    A → Bx

    A → x

    Where A, B ϵ V, and x ϵ T*

    Regular Grammar:

    In a regular grammar, at most one variable appears on the right side of any production. Furthermost, that variable must be consistently be either the rightmost or leftmost symbol of the right side of any production.

    Given Grammar:

    G = ({S, X, Y}, {p, q}, S, P)

    S → X, X → qY | ϵ, Y → Xp

    Although every production is either in right-linear or left-linear form, the grammar itself is neither right-linear nor left-linear, and therefore it is not a regular.

    The give grammar is an example of linear grammar.

  • Question 6
    2 / -0.33

    The Halting problem of Turing machines is

    Solution
    • The halting problem is undecidable over Turing machines.
    • The halting problem is recursively enumerable but not recursive. we can run the Turing Machine and accept if the machine halts, hence it is recursively enumerable.  

    Important Point:

    • A recursively enumerable language is a language for which there exists a total Turing machine that accepts it. It may or may not halt for input strings w. if it accepts a string it will halt (enter into the final state) and if it does not accept a string it may or may not enter reject state(will loop infinitely ).
    • It is also known as a semi-decidable or partially decidable or Turing recognizable or Turing acceptable language.
  • Question 7
    2 / -0.33

    Let L1 be a recursive language. Let L2 and L3 be languages that are recursively enumerable but not recursive. Which of the following statements is necessarily true?

    I L2 – L1 is recursively enumerable.

    II L1 – L3 is recursively enumerable

    III L2 ∩ L1 is recursively enumerable
    Solution
    • \(L2 - L1 = L2 \cap \;\overline {L1} \)

    → Recursive languages are closed under complementation, hence \(\overline {L1}\) is recursive. Since every recursive language is recursively enumerable. Therefore \(L2 - L1\) is recursively enumerable.

    • \(L1 - L3 = L1 \cap \;\overline {L3}\)

    → Recursively enumerable languages are not closed under complementation, hence \(\overline {L3}\) may or may not be recursively enumerable language and so \(L1 - L3\) is always recursively enumerable.

    • \(L2 \cap L1\)

    → Recursively enumerable language is closed under intersection.  Hence \(L2 \cap L1\) is recursively enumerable.

  • Question 8
    2 / -0.33

    Which of the following languages is context free but not regular?

    1) {aibjck | i>j>k}

    2) {aibjck | j = i+k}

    3) {w | w Є {a,b}*, |w| <= 100}

    4) {anb2n | n>=1}

    Solution

    The correct answer is option 2 i.e. only 2 and 4.

    The language {aibjck | i>j>k} is neither regular nor context-free. Both (2) and (4) are only context-free languages.

    The language given by {w | w Є {a,b}*, |w| <= 100} is both regular and context-free.

  • Question 9
    2 / -0.33

    Which of the following are undecidable?

    P1: The language generated by some CFG contains any words of length less than some given number n.

    P2: Let L1 be CFL and L2 be regular, to determine whether L1 and L2 have common elements

    P3: Any given CFG is ambiguous or not.

    P4: For any given CFG G, to determine whether epsilon belongs to L(G
    Solution

    Concept:

    Decidable problems: If there is an algorithm to solve a problem than that problem is known as decidable.

    Undecidable problem: These problems does not have any algorithm that gives correct output in finite.

    Explanation:

    1) The language generated by some CFG contains any words of length less than some given number n.

    This is a decidable problem. Language contains words of length less than some number n. It means strings are of finite length. Finiteness is a decidable problem.

    2) Let L1 be CFL and L2 be regular, to determine whether L1 and L2 have common elements.

    One language is CFL and other is regular. Regular language is also CFL. Equality of Context free languages is undecidable.

    3) Any given CFG is ambiguous or not.

    Ambiguity problem for any language is undecidable. For ambiguous problems, there does not exits any finite time algorithm that can solve it.

    4) For any given CFG G, to determine whether epsilon belongs to L(G)

    It means context free language is empty. Emptiness property of context free languages in undecidable.
  • Question 10
    2 / -0.33

    What is the language generated by the below given grammar?

    S → aabbcc/aaAbbcc

    Abb → bbA

    Acc → Bbbcccc

    bbB → Bbb

    aaB → aaaa/aaaaA

    (let n be natural number in options)
    Solution

    Smallest string that can be derived from the above given grammar is

    S → aabbcc

    ∴ option 1 and option 3 has been eliminated

    Second smallest string that can be derived from the given grammar is

    S → aaAbbcc

    S → aabbAcc

    S → aabbBbbcccc

    S → aaBbbbbcccc

    S → aaaabbbbcccc

    Option 2 is eliminated because aaabbbccc string cannot be generated from the given grammar.
  • Question 11
    2 / -0.33

    Consider the following language.

    L = {w ϵ {0, 1}*| number of 0’s in w is not divisible by 5 but divisible by 7}

    What is the minimum number of states in a DFA that accepts L?
    Solution

    Number of 0’s in w: divisible by 5 = {0, 5, 10, 15, 20, 25, 30, 35, 40…}

    Number of 0's in w: divisible by 7= {0, 7, 14, 21, 28, 35, 42…}

    Now the number of 0’s in w: not divisible by 5 and divisible by 7 will include elements like {7, 14, 21, 28, 42,…6 3, 77...}

    Since we can see that 0, 35, 70, 105 ... is not present. The pattern repeats after 35 states (0 to 34), (35 to 69), and so on... 

    Number of states =  35

    Tips and Tricks:

    Number of states = 5 × 7 = 35

  • Question 12
    2 / -0.33

    Consider the following problems L(G) denoted the language generated by a grammar G. L(M) denotes the language accepted by a machine M.

    Which of the following statements is/are correct?

    I. For a context sensitive grammar G, L(G) = ϕ.

    II. For a context free grammar G1 and G2, L(G1) ⊆ L(G2)

    III. For a recursive language L(G) and a string x, whether x ϵ L(M).
    Solution
    • Emptiness problem for a context sensitive language is undecidable
    • Subset problem for a context free language is undecidable.
    • Membership problem for a recursive language is decidable.
    • I and II are undecidable while III is decidable.
  • Question 13
    2 / -0.33

    Consider the following languages:

    L= pq5m r10n | n ≥ 1 and m ≥ 1

    L2 = p2m qa r2n sb | m = n and a = 2b where m, n, a, b ≥ 0

    L3 = pa qb rc  sx | a = b = c where a, b, c, x ≥ 0

    Which of the following is/are incorrect?

    I. L1 can be accepted by deterministic pushdown automaton.

    II. L2 can be accepted by the non-deterministic pushdown automaton

    III. L3 is a context-free language

    Solution
    • If L = pq5m rkn  where k is constant, then it is a deterministic context-free language ∴ L= pq5m r10n can be accepted by deterministic pushdown automaton.
    • L2 = p2m qa r2n sb | m = n and a = 2b then L2 = p2m q2b r2sb it not is a context free language ∴ L2 = p2m qa r2n sb cannot be accepted by non-deterministic pushdown automaton.
    • L3 = pa qb rc  sx | a = b = c then L3 = pa qa ra  sx   it is not a context free grammar.
  • Question 14
    2 / -0.33

    In the Given language L = {ab, aa, baaa}, _______ number of strings are in L*.

    (1) baaaba

    (2) aabaaaa

    (3) baaabaaaabaa

    (4) baaabaaa

    Solution

    Concept:

    Only those strings are accepted which derives from the language.

    Explanation:

    language: L = {ab, aa, baaa}

    String 1: baaaba

    Partitions are : baaa, ba

    In this, partitions are not possible with strings of the given language. ba remains which is not in the language

    String 2: aabaaaa

    Partitions are: aa, baaa, a

    a is not in the given language. So, it is not in L*.

    String 3: baaabaaaabaa

    Partitions are: baaa, baaa, ab, aa.

    All are possible with the given language. So, it is in L*

    String 4: baaabaaa

    Partitions are: baaa, baaa.

    All are possible with the given language. It is in the language.

    So, total 2 strings are in L*.
  • Question 15
    2 / -0.33

    Let L1 be recursive language and L̅1 be its complement. Also, L2 be the rsively enumerable language which is not recursive and L̅2 be its complement. Let A and B be two languages such that L̅2 reduces to A and B reduces to L̅1 and the reduction is many to one. Which of the following is/are true?

    I. B is recursive language

    II. B may or may not be recursive language

    III. A can be recursively enumerable language

    IV. A is not recursively enumerable language

    Solution
    • If L1 is recursive language (REC) then L̅1 is also REC and recursive language is decidable. B reduces to L̅1 Since L̅1 is decidable then B is also decidable and decidable languages are recursive.
    • L2 is recursively enumerable language (REL) but not REC and hence L̅2 is also not REL. Since L̅2 reduces to A then A is also not REL.
  • Question 16
    2 / -0.33

    Which of the following is not a deterministic context free language?

    I. L1 = ambm+ncn

    II. L2 = aar | a ϵ (x, y)* where ar is a reversal of string a

    III. L3 = ambncndm

    \({\rm{IV}}.{\rm{\;}}{{\rm{L}}_4} = {\rm{\;}}{{\rm{a}}^{\rm{n}}}{{\rm{b}}^{{n^2}}}\)

    Solution

    Statement I:

    L1 = ambm+ncn = ambm bncn, it is accepted by deterministic pushdown automaton and hence it is a deterministic context-free language

    Push a onto the stack, if b comes and a is on top of stack pop a, if b comes and stack is empty then push b onto stack. Now if c comes, pop b until stack is empty.

    Statement II:

    L2 = aar | a ϵ (x, y)* where ar is a reversal of string a

    L2 is not accepted by deterministic pushdown automaton and hence it is not a deterministic context-free language

    Statement III:

    L2 = ambncndm, it is accepted by deterministic pushdown automaton and hence it is a deterministic context-free language

    Push a onto the stack, if b comes and a is on top of stack push b, if c comes and b is on top of stack pop b until b gets exhausted from stack and if d comes and a is on top of stack pop a until stack is empty.

    Statement IV:

    \({\rm{\;}}{{\rm{L}}_4} = {\rm{\;}}{{\rm{a}}^{\rm{n}}}{{\rm{b}}^{{n^2}}}\) it is not accepted by deterministic pushdown automaton and hence it is a deterministic context-free language. L4 is context sensitive language.

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