Assignment 3
Assignment 3
Write the regular expression for the language that accepts strings
containing exactly two 'a's over
Σ = {a, b}.
= b*ab*ab*
2. Write the regular expression for the language where all strings start and
end with the symbol 'b'.
= b(b,a)*b
3. Construct a regular expression for the language that contains the substring
'010' over Σ = {0, 1}.
= (0,1)*010(0,1)*
4. Design a regular expression for the language that accepts all strings over
{a, b} with no more than two 'b's.
= a* , a*ba*, a*ba*ba*
5. Write the regular expression for the language that accepts all strings
starting with 'ba' and ending with 'ab'.
= ba(a,b)*ab
6. Formulate a regular expression for the language that contains an even
number of 'a's over Σ = {a, b}.
= (b*ab*a)*b*
7. Write the regular expression for the language where every 'b' is preceded by
exactly one 'a'.
= (a+ab*)*
8. Construct a regular expression for strings with a length of exactly 4 over Σ =
{0, 1}.
= (0,1)(0,1)(0,1)(0,1)
G. Write the regular expression for the language where all strings contain at
least three occurrences of 'b'.
= (a,b)*b(a,b)*b(a,b)*b(a,b)*
10. Design a regular expression for the language that does not contain the
substring 'ba' over Σ = {a, b}.
= b*a*
11. Write the regular expression for the language that contains both '00' and
'11' as substrings over Σ
= {0, 1}.
= (0,1)*00(0,1)*11(0,1)* | (0,1)*11(0,1)*00(0,1)*
12. Formulate a regular expression for the language accepting strings of odd
length over Σ = {a, b}.
= (a,b)((a,b)(a,b))*
13. Construct a regular expression for the language that accepts
strings with at least one 'a' followed by at least one 'b'.
= (a,b)*a(a,b)*b(a,b)*
14. Write the regular expression for the language accepting strings starting
with 'aa' and ending with 'bb'.
= aa(a,b)*bb
15. Design a regular expression for the language that contains exactly two '1's
over Σ = {0, 1}.
= 0*1+0*1+0*
16. Formulate a regular expression for the language where no two 'b's are
adjacent over Σ = {a, b}.
= (a*ba*)*
17. Write the regular expression for the language accepting all strings that end
with 'abba' over Σ =
{a, b}.
= (a,b)*abba
18. Construct a regular expression for the language that contains at least two
consecutive '0's.
= (0,1)*00(0,1)*
1G. Design a regular expression for the language where the sum of occurrences
of 'a' and 'b' is divisible by 4.
= ((a,b)(a,b)(a,b)(a,b))*
20.Write the regular expression for the language that accepts only 'ab', 'ba', and
'aaa'.
= ab , ba , aaa