Computer Science EngineeringHard
The grammar S -> aSa | bSb | a | b | epsilon generates
- A. strings with equal numbers of a's and b's
- B. strings of even length
- C. strings that start and end with the same letter
- D. all palindromes over {a, b}
Correct answer: D. all palindromes over {a, b}
The productions build a string symmetrically around an optional middle symbol, which yields exactly the palindromes.
Practise more Theory of Computation, Compilers & Digital Logic (ISRO CS) questionsTheory of Computation, Compilers & Digital Logic (ISRO CS): notes and key points
More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions
- An int a[10][20] array is stored in row-major order with base address 1000 and 4-byte elements. The address of a[3][5] is
- Which machine model is equivalent in power to context-free grammars?
- The intersection of a regular language and a context-free language is always
- Compared with a parse tree, an abstract syntax tree
- How many states does the LR(0) automaton (canonical collection of item sets, including the augmented production) have for the grammar S ->…
- For the grammar S -> aSb | c, what is FIRST(S)?