Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Possible questions from Unit I

2 Marks

1. Obtain DFAs to accept strings of a’s and b’s having exactly one a.

2. Obtain a DFA to accept strings of a’s and b’s having even number of a’s and b’s
3. Draw a DFA to accept string of 0’s and 1’s ending with the string 011

4. Give a simple verbal characterization of the following language: (0 + 1)*0(0 + 1)(0 + 1).

Length three or more, third digit from the end is a 0.

5. What strings are accepted by the automaton below? Give a verbal or set
characterization of the language.

aa,bb,abb,baa,abbaaaaaaa,baabbbbb etc
Strings containing aa or bb as a substring.

6. Find a regular language without  that cannot be the language accepted by any DFA
with only one accept state. Justify your answer.
{a, aa} Need one accept state for each string.
{a,aa,aaa}
a*

7. Determine if each of the following is true or false.


a. b*a*  a*b* = a*  b* True
b. a*b*  c*d* =  False—intersection is {}
5. Find a regular expression for the each of the following:
a. {w  {a, b, c}* | w begins with c or has two consecutive symbols the same

c(a + b + c)* + (a + b + c)*(aa + bb + cc)(a + b + c)*

b. {w  {a, b}* | w contains no pair of consecutive a’s}

(a + )(b+(a + ))*

6. Construct a DFA for the set of all strings over {a, b, c} that begin with a, contain
exactly two b’s and end with c.

7. Consider the following grammar G: S  bA | aB | 

A  abaS
B  babS
Construct a DFA M such that L(M) = L(G). Each transition arrow should have a one symbol
label.

8. Construct a minimal DFA for {w  {0, 1, …,9}* | w corresponds to the decimal encoding, without
leading 0’s, of an odd natural number.} Also construct a regular grammar for the language.
Grammar: S  dgtA | odd

A  0A | dgtA | odd

odd  1 | 3 | 5 | 7 | 9

dgt  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

9. Find a regular expression for L = {ambn | m + n is a multiple of 3}.

(aaa)*(aab+abb+)(bbb)*

11. Prove or disprove that the following language is regular:

L = {w  {a, b}* | w contains exactly two more b’s than a’s}

As you should suspect, the language is not regular. The pumping lemma can be
used to prove this. Choose w = ambm+2 where m is the integer from the pumping
lemma. Then, w can be written as w = xyz such that |xy|  m and |y|  1. This
means that y contains only a’s. If |y| = k, then pumping down using i = 0 gives us

w0 = am-kbm+2. Since k  1, there are at least three more b’s than a’s so that w 0 is
not in L and thus L is not regular.

12. Convert the NFA below to a DFA. Be sure to follow the algorithm shown in class.
Epsilon closure (q0) then Mov()

13. Minimize the following DFA. The only final state is 5.


state a b
0 1 3
1 1 2
2 2 5
3 3 4
4 4 5
5 5 5

Note: on a test you will be expected to show all work i.e. show the tables used to find
the minimum DFA.
14. Find a regular grammar corresponding to the following DFA:

S  aA | 

A  aA |bB |b
B  bB | aA | 

15. Given the DFA below construct a regular expression that represents the language accepted by the
machine. Use state elimination.

Use state elimination to remove q2 to get:

Then, the corresponding regular expression is b*a(b + a+b)*. Note aa* = a+.
16. Determine if the following statement is always, sometimes or never true. If your
answer is always or never, justify the answer. If the answer is sometimes, give
two examples—one for which the statement is true and one for which it is false.

The intersection of a regular language with a nonregular language is regular.

Sometimes. Let L = {anbn | n  0}. L   =  is regular, but L  * = L is not.

17. Find the powerset of S where S is a set {a,b,c}.

2S = { Ǿ,{a},{b},{c},{a,b},{a,c},{b,c},{a,b,c}}.

18. Differentiate between L* and L+.

L* denotes Kleene closure --- Language includes empty words also.

L+ denotes Positive closure --- Language does not include empty words.

19. Construct a regular expression for the language which accepts all strings with at least

two c’s over the set Σ={c,b}.

(b+c)* c (b+c)* c (b+c)*

20. prove that 2+√2 is a irrational

Assuming 2+2–√2+2 is rational, we can write

2+2–√=pq2+2=pq,

with pp, qq coprime.

Therefore

2–√=p−2qq2=p−2qq

and

2q2=(p−2q)22q2=(p−2q)2.

Then the right-hand side is even, and hence p−2qp−2q is even. Therefore, pp is even, and can be
written as p=2kp=2k. Therefore the previous equation is written

2q2=(2k−2q)22q2=(2k−2q)2

or
2q2=4(k−q)22q2=4(k−q)2

or

q2=2(k−q)2q2=2(k−q)2.
Now we see that qq is even, but we have assumed that pp and qq are coprime. This is
impossible, and the incorrect step were to assume that 2+2–√2+2 is rational. Hence, it
must be irrational.

21.

22.
23.

24.

25.

Give a grammar for the set of integer numbers in C.


(number) ::= (unsigned number) | (sign)(unsigned number)

(sign) ::= + | –

(unsigned number) ::= (digit) | (unsigned number)(digit)

(digit) ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Big Questions

1. Show that the language L= { awa : w ∈ {a,b}* } is regular.


Ans: Transition Graph of NFA or DFA

2. Convert the following NFA to DFA.


Any NFA will be given as Input

Minimize the following automaton.


3.
4.

Assume L is Regular, Using Pumping lemma,

5. Prove by using Pumping lemma that the following language is not regular.

L = {an bm | n is an integral multiple of m}

You might also like