Let \(𝐺_1, 𝐺_2 \) be Context Free Grammars (CFGs) and \(𝑅\) be a regular…

2025

Let \(𝐺_1, 𝐺_2 \) be Context Free Grammars (CFGs) and \(𝑅\) be a regular expression. For a grammar \(G\), let \(𝐿(𝐺)\) denote the language generated by \(G\).

Which ONE among the following questions is decidable?

Answer: D. \(Is 𝐿(𝐺_1) = ∅?\)Answer: The only decidable question among the list is "Is L(G1) = ∅?" Why this is decidable: There is a standard algorithm to decide emptiness of a…

  1. A.

    \(Is 𝐿(𝐺_1) = 𝐿(𝐺_2)?\)

  2. B.

    \(Is 𝐿(𝐺_1) ∩ 𝐿(𝐺_2) = ∅?\)

  3. C.

    \(Is 𝐿(𝐺_1) = 𝐿(𝑅)?\)

  4. D.

    \(Is 𝐿(𝐺_1) = ∅?\)

Attempted by 111 students.

Show answer & explanation

Correct answer: D

Answer: The only decidable question among the list is "Is L(G1) = ∅?"

Why this is decidable:

  • There is a standard algorithm to decide emptiness of a context-free grammar.

  • Algorithm (marking/generating-variable method):

    • Initialize a set M of nonterminals that have a production whose right-hand side is composed entirely of terminals.

    • Repeat: add any nonterminal A to M if there is a production A → α where every symbol of α is either a terminal or already in M.

    • When no new nonterminals can be added, check whether the start symbol is in M. If it is, the grammar generates at least one string (so L(G) ≠ ∅); otherwise L(G) = ∅.

Why the other questions are not decidable (sketches):

  • Equivalence of two arbitrary context-free grammars is undecidable. There is no algorithm that decides for every pair of CFGs whether they generate the same language.

  • Emptiness of the intersection of two context-free languages is undecidable. Deciding whether L(G1) ∩ L(G2) is empty is known to be an undecidable problem.

  • Equality between an arbitrary context-free language and a given regular language is not generally decidable; there is no uniform algorithm that solves this equality test in all cases.

Therefore the decidable question among the provided choices is the emptiness test for a single CFG.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…