retagged by
1,190 views
0 votes
0 votes

Let $G$ be a grammar in CFG and let $W_1,W_2\in L(G)$ such that $\mid W_1\mid=\mid W_2\mid$ then which of the following statements is true?

  1. Any derivation of $W_1$ has exactly the same number of steps as any derivation of $W_2$.
  2. Different derivation have different length.
  3. Some derivation of $W_1$ may be shorter than the derivation of $W_2$
  4. None of the options
retagged by

1 Answer

1 votes
1 votes
Given data,
W1 and W2 are 2 strings,
|W1|=|W2| means same length
Example CFG grammar:
S→ Cbb | cc
C→ a
W1=cc W2=abb
As per the grammar, W1 require only one derivation S→ cc
W2 requires two derivations S→ Cbb→ abb
It means W1 is smaller than W2.

Correct option- (C) Some derivation of W1 may be shorter the derivation of W2
edited by
Answer:

Related questions

1.3k
views
1 answers
0 votes
admin asked Mar 30, 2020
1,307 views
The grammar $S\rightarrow aSb\mid bSa\mid SS\mid \varepsilon $ is:Unambiguous CFGAmbiguous CFGNot a CFGDeterministic CFG
2.6k
views
6 answers
0 votes
admin asked Mar 30, 2020
2,582 views
According to the given language, which among the following expressions does it correspond to ?Language $L=\{x\in\{0,1\}\mid x\text{ is of length 4 or less}\}$.$(0+1+0+1+0+1+0+1)^4$(0+1)^4$(01)^4$(0+1+\varepsilon)^4$
2.2k
views
3 answers
1 votes
admin asked Mar 30, 2020
2,160 views
A regular expression is $(a+b^{\ast}c)$ is equivalent toset of strings with either $a$ or one or more occurrence of $b$ followed by $c$.$(b^{\ast}c+a)$set of ... either $a$ or zero or more occurrence of $b$ followed by $c$.Both (B) and (C)
2.3k
views
2 answers
1 votes
admin asked Mar 30, 2020
2,255 views
Which of the following are undecidable?$P1$: The language generated by some CFG contains any words of length less than some given number $n$.$P2$: Let $L1$ be CFL and $L2$ be ... $P2$ only$P1$ and $P2$ only$P2$ and $P3$ only$P3$ only