Chapter 5: Regular Sets and Regular Grammars ~ 175
SELF-TEST
(b) (01)*
(d) none of these.
Choose the correct answer to Questions 1-10.
1. The set of aJl strings over {a, b} of even length is represented by the
regular expression
(a) (ab + aa + bb + ba)*
(b) (a + b)*(a* + b)*
(c) (aa + bb)*
(d) (ab + ba)*
2. The set of all strings over {a, b} of length 4. starting with an a is
represented by the regular expression
(a) a(a + b)*
(b) a(ab)*
(c) (ab + ba)(aa + bb)
(d) a(a + b)(a + b)(a + b)
3. (0*1*)* is the same as
(a) (0 + 1)*
(c) (10)*
4. If L is the set of aJl strings over {a, b} containing at least one a, then
it is not represented by the regular expression
(a) b*a(a + b)*
(b) (a + b)*a(b + a)*
(c) (a + b)*ab*
(d) (a + b)*a
5. {a
211 I n ~ I} is represented by the regular expression
(a) (aa)*
(b) a*
(c) aa*a
(d) a*a*
(b) a*ba*ba*b
(d) a*ba*ba*ba*
(b) (a + b)*abab(a + b)*
(d) (a + b)*abab
6. The set of strings over {a, b} having exactly 3b's is represented by the
regular expression
(a) a*bbb
(e) ba*ba*b
7. The set of all stlings over {a, b} having abab as a substring is
represented by
(a) a*ababb*
(c) a*b*ababa*b*
(b) a*
(d) none of these.
8. (a + a*)* is equivalent to
(a) a(a*)*
(c) aa*
9. a*(a + b)* is equivalent to
(a) a* + b*
(b) (ab)*
(c) a*b*
(d) none of these,
ab* + b* represents all strings waver {a, b}
(a) starting 'vvirh an a and having no other a's or having no a's but
only b's
(b) starting with an a followed by b's
(e) having no a's but only b's
(d) none of these,
10.
Précédent

- 188/434

Suivant