• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech

Context free languages and Push-down automata

Question 1

Consider the following languages. 

 

 Which one of the following statements is FALSE?

  • L2 is context-free.

  • L1 intersection L2 is context-free.

  • Complement of L2 is recursive.

  • Complement of L1 is context-free but not regular.

Question 2

Which of the following pairs have DIFFERENT expressive power?
  • Deterministic finite automata(DFA) and Non-deterministic finite automata(NFA)
  • Deterministic push down automata(DPDA)and Non-deterministic push down automata(NPDA)
  • Deterministic single-tape Turing machine and Non-deterministic single-tape Turing machine
  • Single-tape Turing machine and multi-tape Turing machine

Question 3

Let P be a regular language and Q be context-free language such that Q P. (For example, let P be the language represented by the regular expression p*q* and Q be {pn qn  | n N}). Then which of the following is ALWAYS regular? 

(A) P 

(B) P - Q 

(C) * - P 

(D) * - Q

  • A

  • B

  • C

  • D

Question 4

Consider the language L1,L2,L3 as given below. L1={

[Tex]0^{p}1^{q}[/Tex]

| p,q

[Tex]\\in[/Tex]

N} L2={

[Tex]0^{p}1^{q}[/Tex]

| p,q

[Tex]\\in[/Tex]

N and p=q} L3={

[Tex]0^{p}1^{q}0^{r}[/Tex]

| p,q,r

[Tex]\\in[/Tex]

N and p=q=r} Which of the following statements is

NOT TRUE

?

  • Push Down Automata (PDA) can be used to recognize L1 and L2

  • L1 is a regular language

  • All the three languages are context free

  • Turing machine can be used to recognize all the three languages

Question 5

Consider the languages - 
L1 = {0i1j | i != j}. 
L2 = {0i1j | i = j}. 
L3 = {0i1j | i = 2j+1}. 
L4 = {0i1j | i != 2j}.

  • Only L2 is context free

  • Only L2 and L3 are context free

  • Only L1 and L2 are context free

  • All are context free

Question 6

S -> aSa|bSb|a|b; The language generated by the above grammar over the alphabet {a,b} is the set of

  • All palindromes

  • All odd length palindromes.

  • Strings that begin and end with the same symbol

  • All even length palindromes

Question 7

Let L = L1∩L2, where L1 and L2 are languages as defined below:

L1 = {am bm can bn | m, n >= 0}

L2 = {ai bj ck | i, j, k >= 0}

Then L is

  • Not recursive

  • Regular

  • Context free but not regular

  • Recursively enumerable but not context free.

Question 8

The language L= {0i21i | i≥0 } over the alphabet {0,1, 2} is:

  • not recursive

  • is recursive and is a deterministic CFL.

  • is a regular language.

  • is not a deterministic CFL but a CFL.

Question 9

Consider the CFG with {S,A,B) as the non-terminal alphabet, {a,b) as the terminal alphabet, S as the start symbol and the following set of production rules
S --> aB        S --> bA
B --> b         A --> a
B --> bS        A --> aS
B --> aBB       A --> bAA
Which of the following strings is generated by the grammar?
  • aaaabb
  • aabbbb
  • aabbab
  • abbbba

Question 10

For the correct answer strings to below grammar, how many derivation trees are there?

 
  • 1

  • 2

  • 3

  • 4

There are 93 questions to complete.

Last Updated :
Take a part in the ongoing discussion