This action might not be possible to undo. Are you sure you want to continue?

BooksAudiobooksComicsSheet Music### Categories

### Categories

### Categories

Editors' Picks Books

Hand-picked favorites from

our editors

our editors

Editors' Picks Audiobooks

Hand-picked favorites from

our editors

our editors

Editors' Picks Comics

Hand-picked favorites from

our editors

our editors

Editors' Picks Sheet Music

Hand-picked favorites from

our editors

our editors

Top Books

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Audiobooks

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Comics

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Sheet Music

What's trending, bestsellers,

award-winners & more

award-winners & more

Welcome to Scribd! Start your free trial and access books, documents and more.Find out more

Construct the phase structured grammar of the following language. (a) The language of all string over the alphabet set of odd length. (b) The language of all string over the alphabet set palindrome. (c) The language L = {wcw −1 | w ∈ {a, b}∗ , c ∈ set = {a, b, c}. w−1 is the reverse of w. = {1, 0} that is = {a, b} that is

} over the alphabet

(d) The language of all string over the alphabet = {0, 1, 2, 3, ..., 9} that represents the integer number. (N.B. preceding zero string is not in the language, i.e. 023, 0021, 000 are not in the language. However 0 is in the language.) (e) The language of all string over the alphabet = {+, −, 0, 1, 2, 3, ..., 9} that represents the decimal number. (N.B. preceding zero string is not in the language,i.e. +023, 002.1, -00.0, +0, -0 are not in the language. However 0, -0.23 is in the language.) (f) The language of all string over the alphabet that is divisible by 3. (g) The language of all string over the alphabet that is divisible by 2. (h) The language of all string over the alphabet that is divisible by 5. (i) The language of all string over the alphabet equal number of ’a’ and ’b’. = {+, −, 0, 1, 2, 3, ..., 9} = {+, −, 0, 1, 2, 3, ..., 9} = {+, −, 0, 1, 2, 3, ..., 9} = {a, b} that have = {a, b} that = {1, 0} that

(j) The language over of all string over the alphabet have even number of a’s and b’s. (k) The language of all binary string over the alphabet is divisible by 3.

(l) The language of all string over the alphabet = {0, 1, 2, 3} that is interpreted as a number of base 4 and divisible by 5. (m) The language of all binary string over the alphabet is divisible by either 2 or 3 or both. (n) Language L = {ai bj ck |a, b, c ∈ (o) Language L = {a b c |a, b, c ∈

2i k 2j

= {1, 0} that

= {a, b, c} k = i + j, i, j >= 1} = {a, b, c} k = i + j, i, j >= 1}

3. Explain the Chomsky’s hierarchy of grammar. What are the type 3, type 2, type 1 and type 0 grammar. 4. A phase structure grammar is as follows: 1

(a) G =< {a. 0} that is = {1. D → (E). 2 . E > where = {(. (. D → a Find derivation path of the string a ∗ (a + a) + a (c) G =< . Formally deﬁne the ﬁnite state machine. (b) The transition matrix is as follows. M. = {1. S → (S). Formally deﬁne automata. 6. P. D} and the production set is E → E + M. VN . M → M ∗ D. Draw the transition diagram of the following FSM. ). P. ]}. Q/ q0 q1 q2 q3 0 q3 q3 q0 q1 1 q1 q0 q3 q2 q0 is the start state and q3 is the ﬁnal state. S → S ∗ S.. S > where the production set is S → S + S. 5.. E > where = {a. )}. Deﬁne the regular expression. S. (a) The transition matrix is as follows. What is the diﬀerence between a DFSM and a NFSM. VN = {S} and the production set is S → (S)| {S}| [S]. VN = {E. S → a Find derivation path of the string a ∗ (a + a) + a (b) G =< . 0} that starts with = {1. 8. )}. {. Design Finite state automata for the following: (a) Recognizes all strings over the alphabet 00 and ends with 11. +. E → M. (c) Recognizes all binary strings over the alphabet divisible by 5. S → ()S| {}S| []S Find the derivation path of the string [()[]{[]}]. (. What are the transition function of the DFSM (DFA) and NFSM (NFA). +. ∗. 9. Deﬁne the transition function of the automata. 0} that is (b) Recognizes all binary strings over the alphabet divisible by 3. P. Q/ q0 q1 q2 q3 0 q0 q2 q2 q0 1 q1 q1 q3 q3 φ q3 q0 q0 is the start state and the ﬁnal state. M → D. }. VN . 7. ∗. [.

= {0. p0} (b) T = {q2. 1} where the length of the string is even. (l) Regular expression of the language L = {a2k+3 | k >= 1} over the = {a}. (a) All string over the (b) All string over the (c) All string over the (d) All string over the by 5. 1} with at least one pair of 0 or one pair = {0. q8} 15. where T is as follows. (e) All string over the (f) All string over the two 1. Write the algorithm to ﬁnd the φ-CLOSURE of a set of state T (φ-CLOSURE(T)). q8} (c) T = {q3. + φ)(0 + 1 + 2 + . 1} where every 0 is followed by at least = {0. where T is as follows.. Construct NFA from the following regular expression.10. 1} the starts with 00 and ends with 11. + 9)∗ 12. Deﬁne the φ-CLOSURE of a set of state T. 1} where there is no successive 0.2 and 3. 11. (a) T = {q1. = {0. Find the φ-CLOSURE(T) for the NFA as in ﬁgure 6..+ φ)(0 + 1 + 2 + . 13. 1} where the length of the string is odd. b. = {0. What is φ-CLOSURE of a state. = {a} where the length of the string is divisible = {a. q4. (k) All string over the = {a... 14. q7} (b) T = {q5. (j) All string over the = {0. q6. q1} 3 . (i) All string over the of 1. (a) (φ + 0)(11 + 00)∗ (b) (1 + 0)∗ 11(0 + 1)∗ (c) 1∗ 01∗ 01∗ (d) (+ + . 1} that do not contain 101 as substring. b} where the number of occurrence of ’a’ = {0. c} where the length of the string is divisible by either 2 or 3 or both. Find the φ-CLOSURE(T) for the NFA as in ﬁgure 7. (g) All string over the (h) All string over the is divisible by 3. = {a. Find the equivalent DFA for the NFA as in the ﬁgure 1. (a) T = {q0. + 9)∗ (. Find the regular expression of the following. b} that have at most 2 ’a’s.

2.3 q2 a q3 q8 a q9 q0 q1 q4 q5 q6 q7 q10 c q11 q12 c q13 b Figure 6 (q0 start state.1 q0 a q1 b b q2 a b 0 q0 1 q1 0 1 0 q3 0 1 q2 0 1 a Figure 1 (q0 is the start state) Figure 2 (q0 is the start state) 1 1 q0 0 0 q1 Figure 3 (q0 start state) Figure 1: ﬁg 1. all aumarked transitions are null transition) Figure 2: ﬁg 6 4 .

Deﬁne the and Mealy machine. (a) A m/c that takes a string in binary and calculate the modulo 3. State and proof the Arden’s theorem. Point out the diﬀerence of this two machine. (a) A Mealy m/c that takes a binary string as input and output ’y’ when it detects a sequence ’101’ else output ’n’. (b) A m/c that takes a string in base-4 and calculate the modulo 5. Write down the algorithm to convert a NFA to DFA using φ-CLOSURE(T).10. 5 . 21. (Example: 100010 input produces 0 output as (1 + 0 + 0 + 0 + 1 + 0)mod2 = 0) (e) A m/c that takes a string in base-3 and complete the modulo 2 addition of the digits in the string. (c) A m/c that takes a string in base-3 and calculate the modulo 2. Using the Arden’s Theorem ﬁnd the regular expression if the FSM of ﬁgure 8. Design the following Mealy machine. 18. (d) A m/c that takes a string in binary and complete the modulo 2 addition of the bits in the string. (Example: 302012 input produces 2 output as (3 + 0 + 2 + 0 + 1 + 2)mod3 = 2) 22.q2 q0 m p0 c q1 q4 a q3 q6 q7 b q5 p2 q9 p1 Figure 7 (m is the start state. Design the following machine. 19. 17. Convert the NFA of ﬁgure 6 and 7 to its equivalent DFA using φ-CLOSURE(T). (Example: 202012 input produces 1 output as (2 + 0 + 2 + 0 + 1 + 2)mod3 = 1) (f) A m/c that takes a string in base-4 and complete the modulo 3 addition of the digits in the string.9. all unmarked transitions are null transition) Figure 3: ﬁg 7 16. 20.

complement. State and proof the pumping lemma for regular language. (b) L = {ak bk | f or k >= 1} is not a regular language. 24. Using pumping lemma proof the following. b}∗ and wR is the reverse of w. (a) L = {a2 | f or i >= 0} is not a regular language. ”The Regular Set is closed under the operation union. concatenation. Here w ∈ {a. (c) L = {wwR } is not regular language. (Example abba.a q0 b q1 aa Figure 8 (q0 start state) q2 b a q0 b 0 0 q1 1 1 q2 1 0 Figure 9 (q0 start state) 0 1 q0 1 Figure 10 (q0 start state) q1 0 1 2 q2 2 Figure 4: ﬁg 8. 23. w = ab and w R = ba) (d) L = {a2k+2 | k >= 0} is a regular language. 6 i . (a) aa(a + b)∗ bb (b) 1∗ 01∗ (c) (φ + 0)(1 + 10)∗ 25.9. intersection”-proof.10 (b) A Mealy m/c that takes a binary string as input and output ’1’ when it detects a sequence ’101’. Find the regular expression that represents the complement of the Regular Set described by the following regular expression. 26. ’b’ when detects a sequence ’100’ and ’c’ when detects ’110’ else output ’n’.

7 .(e) L = {aK bl | k. l >= 0} is a regular language.

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue listening from where you left off, or restart the preview.

scribd