Copyright © 2007 Gradiance Corporation.
Gradiance Online Accelerated Learning
Regular Expressions --- Basics
1.
Consider the languages:
(a) {02n1n | n > 0} (b) {05n1n | n > 0} (c) {w | w a string of 0's and 1's such that when interpreted in reverse as a binary integer it is a multiple of 5} (d) {0n1n|n>0} (e) {w | w a string of 0's and 1's such that its length is a perfect square} (f) {w | w string of 0's and 1's such that when interpreted as a binary integer it is not a multiple of 5} (g) {w | w a string of 0's and 1's such that its length is not a perfect cube} (h) {w | w a string of 0's and 1's such that the number of 0's is not equal to twice the number of 1's}
Which is a regular language?
a)
(f)
b)
(d)
c)
(e)
d)
(a)
2.
Identify from the list below the regular expression that generates all and only the strings over alphabet {0,1} that end in 1.
(0*+1)*
(0+1)*1+
0+(0+1)*1
(0+1)*10*
3.
Here are seven regular expressions:
Determine the language of each of these expressions. Then, find in the list below a pair of equivalent expressions.
(0*+10)* and (0+1*)*
(0*+10*)* and (0*+1*)*
(0+10)* and (0*+1*)*
(0+1*0)* and (0*+1*)*
4.
In this question you are asked to consider the truth or falsehood of six equivalences for regular expressions. If the equivalence is true, you must also identify the law from which it follows. In each case the statement R = S is conventional shorthand for "L(R) = L(S)." The six proposed equivalences are:
Identify the correct statement from the list below.
Note: we use φ for the empty set, because the correct symbol is not recognized by Internet Explorer.
(0* + 1*)0 = 0*0 + 1*0 follows from the distributive law of concatenation over union.
(0*1)0* = 0*(10*) is false.
01φ = φ is false.
0*1* = 1*0* follows from the commutative law of concatenation.
5.
Which of the following strings is NOT in the Kleene closure of the language {011, 10, 110}?
011011110
10011101
11001110
11010110
6.
Which among the following languages is not regular (cannot be defined by a regular expression or finite automaton)?
L={x | x=camcbn, n, m positive integers}
L={x | x=anbn, n a positive integer}
L={x | x=am(bc6)n, n, m positive integers}
L={x | x=ambn, n, m positive integers}
7.
Here is a finite automaton:
Which of the following regular expressions defines the same language as the finite automaton? Hint: each of the correct choices uses component expressions. Some of these components are:
It helps to write down these expressions first, and then look for an expression that defines all the paths from A to D.
(01+10)(0(01+10))*(11)*
(01+10)(11+(01+10)0)*
(01+10)(11*+0(01+10))*
((01+10)(11)*0)*(01+10)(11)*