• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Context free languages and Push-down automata

Question 31

Consider a CFG with the following productions. S → AA | B A → 0A | A0 | 1 B → 0B00 | 1 S is the start symbol, A and B are non-terminals and 0 and 1 are the terminals. The language generated by this grammar is
  • {0n 102n | n ≥ 1}
  • {0i 10j 10k | i, j, k ≥ 0} ∪ {0n 102n | n ≥ l}
  • {0i 10j | i, j ≥ 0} ∪ {0n 102n | n ≥ l}
  • The set of all strings over {0, 1} containing at least two 0\'s
  • None of the above

Question 32

A CFG G is given with the following productions where S is the start symbol, A is a non-terminal and a and b are terminals.
S→aS∣A
A→aAb∣bAa∣ϵ
Which of the following strings is generated by the grammar above?
  • aabbaba
  • aabaaba
  • abababb
  • aabbaab

Question 33

A CFG G is given with the following productions where S is the start symbol, A is a non-terminal and a and b are terminals.
S→aS∣A
A→aAb∣bAa∣ϵ
For the correct answer in Q75, how many steps are required to derive the string and how many parse trees are there?
  • 6 and 1
  • 6 and 2
  • 7 and 2
  • 4 and 2

Question 34

Consider 2 scenarios:
C1: For DFA (ϕ, Ʃ, δ, qo, F),
         if F = ϕ, then L = Ʃ*
C2: For NFA (ϕ, Ʃ, δ, qo, F),
         if F = ϕ, then L = Ʃ*
Where F = Final states set
ϕ = Total states set

Choose the correct option ?
  • Both are true
  • Both are False
  • C1 is true, C2 is false
  • C1 is false, C2 is true

Question 35

Let G be the CFG, l be the number of left most derivations, r be the number of right most derivations and P be the number of parse trees. Assume l , r and P are computed for a particular string. For a given CFG ‘G’ and given string ‘w’, what is the relation between l , P , r ?
  • l ≤ P ≥ r
  • l = P = r
  • l ≥ P ≤ r
  • none of these

Question 36

Given the following two statements : A. L = {w|na(w) = nb(w)} is deterministic context free language, but not linear. B. L = {an bn} ∪ {an b2n} is linear, but not deterministic context free language. Which of the following options is correct ?
  • Both (A) and (B) are false.
  • Both (A) and (B) are true.
  • (A) is true, (B) is false.
  • (A) is false, (B) is true.

Question 37

If L1 is a context free language and L2 as a regular language, which of the following is/are False? a.  L1-L2 is not context free b.  L1 ∩ L2 is context free c.  ~L1 is context free d.  ~L2 is regular
  • Only b
  • Only c
  • Both a and c
  • Both b and c

Question 38

[5 Marks question] Show that the language L = { xcx | x∈ {0,1}* and c is a terminal symbol } is not context free, c is not 0 or 1.

    Question 39

    Regarding the power of recognition of languages, which of the following statement is false?
    • The non-deterministic finite state automata are equivalent to deterministic finite state automata.
    • Non-deterministic pushdown automata is equivalent to deterministic pushdown automata.
    • Non-deterministic Turing machines are equivalent to deterministic Turing machines.
    • Multi-tape Turing machines are equivalent to Single-tape Turing machines.

    Question 40

    Let M = ({q0, q1}, {0, 1}, {z0, x}, δ, q0, z0, ∅) be a pushdown automaton where δ is given by δ(q0, 1, z0) = {(q0, xz0)} δ(q0, ε, z0) = {(q0, ε)} δ(q0, 1, X) = {(q0, XX)} δ(q1, 1, X) = {(q1, ε)} δ(q0, 0, X) = {(q1, X)} δ(q0, 0, z0) = {(q0, z0)}
    1. What is the language accepted by this PDA by empty stack?
    2. Describe informally the working of the PDA

      There are 93 questions to complete.

      Last Updated :
      Take a part in the ongoing discussion