Given: S->aSb S->e S-> A A->aA B->C C->D The ratio of number of useless variables to number of useless production is:

Given:
S->aSb
S->e
S-> A
A->aA
B->C
C->D
The ratio of number of useless variables to number of useless production is:
A. 1
B. 3/4
C. 2/3
D. 0
 
Answer: A
Explanation: A, B, C, D are the useless symbols in the given grammar as they never tend to lead to a terminal. The productions S-> A, A->aA, B->C, C->D are also termed as useless production as they will never produce a string to the grammar.
 

Tìm kiếm

Back
Top