arrow
arrow
arrow
Which of the following statements is incorrect?
Question

Which of the following statements is incorrect?

A.

Given a context free grammar G and a string x, an algorithm can be designed to decide whether xL(G)x \in L(G)​ in polynomial time.

B.

Given a context free language L, its complement is also context free.

C.

Class of deterministic context free languages is closed under intersection.

D.

Both (b) and (c)

Correct option is D

(a) Given a CFG G and a string x, an algorithm can decide whether x ∈ L(G) in polynomial time. — True
The membership problem for Context-Free Languages (CFLs) is decidable in polynomial time.
For example, the CYK (Cocke–Younger–Kasami) algorithm can determine whether a string belongs to the language generated by a CFG in O(n3)O(n^3)​ time for a grammar in Chomsky Normal Form.
(b) Given a context-free language L, its complement is also context free. — False
Context-Free Languages are not closed under complementation.
That is:
L is CFL=≯L is CFLL\text{ is CFL}\not\Rightarrow\overline L\text{ is CFL}​​
For example, consider:
L={aibjcki,j,k0 and i=j=k}L=\{a^ib^jc^k\mid i,j,k\geq0\text{ and }i=j=k\}​​
The language
{anbncnn0}\{a^nb^nc^n\mid n\geq0\}​​
is not context-free. Using closure properties, one can construct examples demonstrating that CFLs are not closed under complement.
(c) {anbmcp:m,n,p0, mn or mp}\{a^n b^m c^p:m,n,p\geq0,\ m\ne n\text{ or }m\ne p\}​ is not deterministic context-free. — True
Let:
L={anbmcp:mn or mp}L=\{a^n b^m c^p:m\ne n\text{ or }m\ne p\}​​
Within the regular language:
R=abcR=a^*b^*c^*​​
the complement of L is:
RL={anbncn:n0}R-L=\{a^n b^n c^n:n\geq0\}​​
Now, suppose L were a deterministic context-free language (DCFL).
DCFLs are closed under complement, and regular languages are also DCFLs. Therefore, R – L would also be a DCFL and hence a CFL.
But, {anbncn:n0}\{a^nb^nc^n:n\geq0\}​ is not context-free.
This gives a contradiction.
(d) Class of deterministic context-free languages is closed under intersection. — False
DCFLs are not closed under intersection.
That is:
L1,L2 are DCFLsL_1,L_2\text{ are DCFLs}​​
does not necessarily imply:
L1L2L_1\cap L_2​ is a DCFL.
However, DCFLs are closed under complement.

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
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
528k+ students have already unlocked exclusive benefits with Test Prime!
Our Plans
Monthsup-arrow