STQC-NIELIT STA 2021
February 17, 2025Computer-Graphics
February 17, 2025UGC NET CS 2014 Dec-Paper-2
|
Question 35
|
The following Context-Free Grammar (CFG) :
S → aB | bA
A → a | as | bAA
B → b | bs | aBB
will generate
S → aB | bA
A → a | as | bAA
B → b | bs | aBB
will generate
|
odd numbers of a’s and odd numbers of b’s
|
|
|
even numbers of a’s and even numbers of b’s
|
|
|
equal numbers of a’s and b’s
|
|
|
different numbers of a’s and b’s
|
Question 35 Explanation:
Option A is false: as it generate string “abab” which has even number of a’s and b’s.
Option B is false: as it generate string “ab” which has odd number of a’s and b’s.
Option D is false: as it always generate one “a” along with one “b”. So it will always generate equal number of a’s and b’s and will never generate different number of a’s and b’s.
Hence option C is correct.
Option B is false: as it generate string “ab” which has odd number of a’s and b’s.
Option D is false: as it always generate one “a” along with one “b”. So it will always generate equal number of a’s and b’s and will never generate different number of a’s and b’s.
Hence option C is correct.
Correct Answer: C
Question 35 Explanation:
Option A is false: as it generate string “abab” which has even number of a’s and b’s.
Option B is false: as it generate string “ab” which has odd number of a’s and b’s.
Option D is false: as it always generate one “a” along with one “b”. So it will always generate equal number of a’s and b’s and will never generate different number of a’s and b’s.
Hence option C is correct.
Option B is false: as it generate string “ab” which has odd number of a’s and b’s.
Option D is false: as it always generate one “a” along with one “b”. So it will always generate equal number of a’s and b’s and will never generate different number of a’s and b’s.
Hence option C is correct.
