The Gateway to Computer Science Excellence

NIELIT 2017 DEC Scientist B - Section B: 7

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
in Theory of Computation by
edited by | 47 views

1 Answer

+1 vote
Given data,
W1 and W2 are 2 strings,
|W1|=|W2| means same length
Example CFG grammar:
S→ Cbb | cc
C→ a
W1=cc W2=Cbb
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

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,375 questions
60,582 answers
95,402 users