Context Free Language · Theory of Computation
41 questions · asked in 24 of 27 years (2000–2026)
MCQ 36 · MSQ 51-mark 23 · 2-mark 18
2000Questions per year2026
Questions 16–20 of 41
Let be any two context free languages and R be any regular language. Then which of the following is/are CORRECT ?
I. is context - free
II. is context - free
III. is context - free
IV. is context - free
I. is context - free
II. is context - free
III. is context - free
IV. is context - free
Answer: (B)
Check each statement:
- I: CFLs are closed under union. True
- II: CFLs are not closed under complement. False
- III: , and CFL regular gives a CFL. True
- IV: CFLs are not closed under intersection. False
Answer: I and III only
- I: CFLs are closed under union. True
- II: CFLs are not closed under complement. False
- III: , and CFL regular gives a CFL. True
- IV: CFLs are not closed under intersection. False
Answer: I and III only
Consider the following languages
is a prime number}
Which of the following are CORRECT ?
I. is context-free but not regular.
II. is not context-free.
III. is not context-free but recursive.
IV. is deterministic context-free.
is a prime number}
Which of the following are CORRECT ?
I. is context-free but not regular.
II. is not context-free.
III. is not context-free but recursive.
IV. is deterministic context-free.
Answer: (D)
- I: (prime lengths) is not context-free. A context-free language over a one-letter alphabet is always regular, and the primes are not regular (pumping lemma). So I is false.
- II: is context-free: the a's are free, and for push two symbols per b and pop one per c. So II is false.
- III: is not context-free. Pump : the pumped part cannot touch both the a's and the c's. If it misses the a's, they stay at p, so b would have to stay p and c stay 2p, but pumping changes at least one count. If it misses the c's, they stay at 2p, so a and b would have to stay p, again impossible. It is recursive, because a program that checks the form and then tests always halts. So III is true.
- IV: is a deterministic CFL: push a's, pop for b's, accept on an empty stack. So IV is true.
Answer: (D)
- II: is context-free: the a's are free, and for push two symbols per b and pop one per c. So II is false.
- III: is not context-free. Pump : the pumped part cannot touch both the a's and the c's. If it misses the a's, they stay at p, so b would have to stay p and c stay 2p, but pumping changes at least one count. If it misses the c's, they stay at 2p, so a and b would have to stay p, again impossible. It is recursive, because a program that checks the form and then tests always halts. So III is true.
- IV: is a deterministic CFL: push a's, pop for b's, accept on an empty stack. So IV is true.
Answer: (D)
Consider the following types of languages: :Regular, :Context-free, :Recursive, :Recursively enumerable.
Which of the following is/are TRUE?
I. is recursivelyenumerable
II. is recursive
III. is context-free
IV. is context-free
Which of the following is/are TRUE?
I. is recursivelyenumerable
II. is recursive
III. is context-free
IV. is context-free
Answer: (D)
- I: is recursive (recursive languages are closed under complement), so it is also RE. is RE, and RE languages are closed under union, so the union is RE. True.
- II: every CFL is recursive (it has a decider that always halts, such as CYK), so is recursive. Recursive languages are closed under complement, so is recursive, and the union of two recursive languages is recursive. True.
- III: is regular (closed under star), so it is a CFL, and the union of two CFLs is a CFL. True.
- IV: CFLs are not closed under complement, so need not be a CFL. Take (regular) and (a CFL). Then , which is not a CFL. False.
Answer: (D)
- II: every CFL is recursive (it has a decider that always halts, such as CYK), so is recursive. Recursive languages are closed under complement, so is recursive, and the union of two recursive languages is recursive. True.
- III: is regular (closed under star), so it is a CFL, and the union of two CFLs is a CFL. True.
- IV: CFLs are not closed under complement, so need not be a CFL. Take (regular) and (a CFL). Then , which is not a CFL. False.
Answer: (D)
Consider the following languages:
Which one of the following is TRUE?
Which one of the following is TRUE?
Answer: (B)
- : push a symbol for each a and each b, then pop one for each c, and accept when the stack is empty at the end. As a grammar: . So is context-free.
- : use the pumping lemma on . The pumped part has length at most p, so it cannot touch both the a's and the c's. If it misses the a's, the a's stay p, so b would have to stay p and c stay 2p, but pumping changes at least one of them. If it misses the c's, they stay 2p, so a and b would have to stay p, again impossible. So is not context-free.
Answer: (B)
- : use the pumping lemma on . The pumped part has length at most p, so it cannot touch both the a's and the c's. If it misses the a's, the a's stay p, so b would have to stay p and c stay 2p, but pumping changes at least one of them. If it misses the c's, they stay 2p, so a and b would have to stay p, again impossible. So is not context-free.
Answer: (B)
For any two languages L1 and L2 such that L1 is context-free and L2 is recursively enumerable but not recursive, which of the following is/are necessarily true?
I. (complement of L1) is recursive
II. (complement of L2) is recursive
III. is context-free
IV. is recursively enumerable
I. (complement of L1) is recursive
II. (complement of L2) is recursive
III. is context-free
IV. is recursively enumerable
Answer: (D)
Let us go through each statement:
- I: A CFL can be decided, and recursive languages stay recursive under complement True
- II: Suppose is recursive. Then L2 would also be recursive False
- III: CFLs do not stay closed under complement so it is not necessarily true
- IV: is recursive (so it is also RE), and RE languages are closed under union True
Answer: I and IV only
- I: A CFL can be decided, and recursive languages stay recursive under complement True
- II: Suppose is recursive. Then L2 would also be recursive False
- III: CFLs do not stay closed under complement so it is not necessarily true
- IV: is recursive (so it is also RE), and RE languages are closed under union True
Answer: I and IV only
Keep practising