0% found this document useful (0 votes)
21 views

Solutions To Set 15

Uploaded by

Amigo X-boy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Solutions To Set 15

Uploaded by

Amigo X-boy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

THEORY OF COMPUTATION

(Mealy & Moore Machines, CNF & GNF, Closure Properties)

SOLUTIONS

1. Determine the minimum height of parse tree in CNF for terminal string of length w, which is
constructed by using CFG G

(a) log 2 |w| + 1 (b) log 2 |w|

(c) log 2 |w| − 1 (d) None of these

Solution: Option (a)

2. Let G and G1 be a CFG with productions

G: S → S + S | S*S | (S) | a
G1: S → S + T | T
T → T*F | F
F → (S) | a

Then which of the following is true?

(a) L(G) ≠ L(G1) (b) L(G1) ⊆ L(G)

(c) L(G) ⊂ L(G1) (d) L(G) = L(G1)

Solution: Option (d)

Explanation:
G1 is the unambiguous expression of G.

3. Choose the correct statements.

(i) Moore and Mealy machines are FSM’s with output


(ii) Any given Moore machine has an equivalent Mealy machine
(iii) Any given Mealy machine has an equivalent Moore machine
(iv) Moore machine is not a FSM

(a) (ii) & (iii) only (b) (ii), (iii) & (iv)

1
(c) (i), (ii) & (iii) (d) All of these

Solution: Option (c)

4. The intersection of a CFL and a regular language

(a) Need not be regular (b) Need not be context free

(c) Is always regular (d) Is always CFL

Solution: Option (d)

5. Let Σ = {a, b} and let L = {w | w contains an equal number of occurrences of substrings “ab”
and “ba”}. Thus aba ∈ L since “aba” contain one occurrence of “ab” and one occurrence of “ba”
but abab ∉ L. Then which of the following is true?

(a) L is regular (b) L is a DCFL but not regular

(c) L is a CFL but not regular (d) L is recursive but not a CFL

Solution: Option (a)

Explanation:
We can write a DFA that accepts the given language L.

6. Consider the following DFA.

2
The language accepted by the above finite automata is

(a) (0 + 1)∗ (0 + 1)∗ (b) (0 + 1)∗ (010)∗

(c) (00)∗ (11)∗ (d) (0 + 1)∗ (11)∗

Solution: Option (c)

Explanation:

In the given DFA, state D is the dead state. So for strings that are accepted by the DFA, we can
just consider the following finite automata:

7. L1 = {an bn am ⁄n, m = 1,2,3, … }


L2 = {an bm am ⁄n, m = 1,2,3, … }
L3 = {an bn an ⁄n = 1,2,3, … }

Which of the following is true?

(a) L3 = L1 ∩ L2

(b) L1 is context free language (CFL) but L2 and L3 are not CFL’s

(c) L1 and L2 are not CFL’s but L3 is a CFL

(d) Both (a) and (b)

3
Solution: Option (a)

Explanation:

L1 and L2 are CFLs but L3 is not CFL as we need to have two instances of memory to accept L3.

8. Which of the following language is accepted by the following finite automata?

(a) (110)∗ 01

(b) 0 + (1(11)∗ 10)+ 0

(c) 0 + (1(11)∗ 101)+ 0

(d) (11 + 10)∗ 01

Solution: Option (b)

Explanation:

In the given DFA, state ‘S’ is the dead state. We obtain the following finite automata after
removing the dead state.

4
9. Which one of the following is a DCFL?

(a) L = {an bn c n | n > 1000} (b) L = set of all balanced parenthesis

(c) L = {WW R | W ∈ {a, b}∗ } (d) All of these

Solution: Option (b)

Explanation:

Option (a) is not CFL at all because we need two stacks to accept the strings of the language.

Option (c) is not deterministic CFL, because we need to guess the mid of the string for every
string in the language.

Option (b) is deterministic CFL, because we know push and pop operations deterministically.

10. The transition diagram shown

(a) Represents serial adder

(b) Produces 01 when input is 10

5
(c) Produces 01 when input is 01

(d) Produces sum of previous and


current bit

Solution: Option (d)

Explanation:

Take a binary string and see what the transition diagram gives as output.

You might also like