STQC-NIELIT STA 2021
February 17, 2025
Computer-Graphics
February 17, 2025
STQC-NIELIT STA 2021
February 17, 2025
Computer-Graphics
February 17, 2025

UGC 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
A
odd numbers of a’s and odd numbers of b’s
B
even numbers of a’s and even numbers of b’s
C
equal numbers of a’s and b’s
D
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.
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.

Leave a Reply

Your email address will not be published. Required fields are marked *