Home › GATE CSE › computerscience › Theory of Computation › The REGULAR EXPRESSION $(0 + 1)^* 0$ describes t…
The REGULAR EXPRESSION $(0 + 1)^* 0$ describes the language of all strings over $\{0, 1\}$
Astarting with $0$
Bending with $0$
Ccontaining the substring $00$
Dof even length
Answer & Solution
Correct answer: B. ending with $0$
1. Parse the regex $(0 + 1)^* 0$:
- $(0 + 1)^*$: any sequence (possibly empty) of 0's and 1's — i.e., any string in $\{0,1\}^*$.
- Then the symbol $0$ — must end with a 0.
2. So the language is $\{w \cdot 0 \mid w \in \{0,1\}^*\}$ — every string ending in 0.
3. Examples: '0', '10', '110', '00', '1110' are in $L$. '1' and '01' (wait — 01 DOES end in 1, NOT in 0, so 01 is NOT in $L$).
4. Option A would be $0(0+1)^*$. Option C would be $(0+1)^* 00 (0+1)^*$. Option D would be $((0+1)(0+1))^*$.
_Source: Jeff Erickson, "Models of Computation", §2.3 (Regular Expressions)._
Related questions
Which class of grammars generates ALL recursively enumerable languages?What is a LEFTMOST DERIVATION?Which of the following languages is CONTEXT-FREE?Consider the grammar $S \to (S) \mid SS \mid \varepsilon$. The language generated isEvery regular language is also context-free. The PROOF construction isThe CYK algorithm parses a CFG in CNF. Its time complexity for a string of length $n$ isA LEFT-RECURSIVE rule in a CFG has the form $A \to A\alpha$ for some non-empty $\alpha$. WContext-free languages are CLOSED under which of the following operations?