All Exams Test series for 1 year @ ₹349 only
Question

Which of the folowing CFG(s) is/are in chomsky Normal form (All capital letters are variables & lower case are terminals)

A. S → ABC / AB
A → a
B → b
C → d

B. X → RT / TR
T → t
R → XT / r

C. P → qP / sQ
Q → r / s

D. M → MN / MP
N → nm / n
P → p

Choose the correct answer from the options given below:

This question was previously asked in
UGC NET 2024 Computer Science and Applications Question Paper (23-Aug-2024) (Shift 1)
The correct answer is

B only

A context-free grammar is in Chomsky Normal Form (CNF) when every production has one of only two shapes: a variable deriving exactly two variables (A → BC) or a variable deriving exactly one terminal (A → a). (S → ε is allowed only for the start symbol when ε is in the language.) Each grammar is checked production by production.

Step 1 — Grammar A: S → ABC has three variables on the right side, which CNF does not allow. Grammar A is not in CNF even though S → AB, A → a, B → b and C → d are fine.

Step 2 — Grammar B: X → RT and X → TR are two-variable bodies; T → t is a single terminal; R → XT is a two-variable body and R → r is a single terminal. Every production fits, so Grammar B is in CNF.

Step 3 — Grammar C: P → qP and P → sQ mix a terminal with a variable (Greibach-style), which is not allowed in CNF. Grammar C is not in CNF.

Step 4 — Grammar D: M → MN, M → MP, N → n and P → p are fine, but N → nm has two terminals on the right side, so Grammar D is not in CNF.

Therefore only Grammar B qualifies; any choice including A, C or D (such as the pairs with A or D, or C alone) contains a grammar that breaks the CNF shape rules.

B only option is correct.

Was this answer helpful?

Similar Questions

  1. For the above specified passage, which of the following represent the grammar for the language accepted the machine?

  2. The following Context-Free Grammar (CFG) :

    S → aB | bA

    A → a | as | bAA

    B → b | bs | aBB

    will generate

  3. Match the following :

    List - IList - II
    a. Chomsky Normal formi. \(S \to b\,S\,S \mid a\,S \mid c\)
    b. Greibach Normal formii. \(S \to a\,S\,b \mid ab\)
    c. S-grammariii. \(S \to AS \mid a\)
    \(A \to SA \mid b\)
    d. LL grammariv. \(S \to a\,B\,S\,B\)
    \(B \to b\)
  4. The context free grammar for the language \(L = \{a^{n}b^{m}c^{k} \mid k = |n - m|, n \geq 0, m \geq 0, k \geq 0\}\) is

  5. The context free grammar given by

    \(S \to XYX\)

    \(X \to aX \mid bX \mid \lambda\)

    \(Y \to bbb\)

    generates the language which is defined by regular expression :

  6. Let G = (V, T, S, P) be a context-free grammar such that every one of its productions is of the form A → v, with |v| = K > 1. The derivation tree for any W ∈ L(G) has a height h such that

  7. A context free grammar for \(L = \{ w \mid n_{0}(w) \gt n_{1}(w) \}\) is given by :

  8. If all the production rules have single non - terminal symbol on the left side, the grammar defined is :


Important Questions from Context Free Grammars

  1. Which of the following grammars is (are)ambiguous ?
    (1) S → SS | aSb | bSa |e 

    (2) S → aSbS | bSaS |e 

    (3) S → aAB 

    A → bBb 
    B → A Ι e

  2. Consider the grammar,

    G = S → abScB | e, 

    B→ bB | b. 

    What is the language generated by the given grammar ?

     

  3. Consider the given grammar
    S → Abc | ad 

    A → eS | Cr| ξ 

    C → f/p/ξ
    Compute FIRST (A)

  4. Select the sentence which is meaningful and grammatically correct.

  5. Consider the following context-free grammar $G$.
    $$S \rightarrow abaABabba$$
    $$A \rightarrow aaBBAB \mid bBabaa$$
    $$B \rightarrow aBb \mid ab$$
    In the above grammar, $S$ is the start symbol, $a$ and $b$ are terminal symbols, and $A$ and $B$ are non-terminal symbols.
    Let $L(G)$ be the language generated by the grammar $G$. For a string $s \in L(G)$, let $n_1(s)$ be the number of $a$’s in $s$ and $n_2(s)$ be the number of $b$’s in $s$.
    Which of the following statements is/are true?
Need Expert Advice?
Upcoming Exams
CTET
December 12, 2026
WB SET
December 13, 2026
CBSE UGC NET
December 14, 2026
CSIR UGC NET
December 19, 2026
Test Series
UGC NET img
Teaching
UGC NET (Paper 2) December 2026 Mock Test Series
799 Tests 2 Tests Free
299 Attempts
4.4(45)
English, Hindi
More Questions from UGC NET

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App