Solutions To Set 15
Solutions To Set 15
SOLUTIONS
1. Determine the minimum height of parse tree in CNF for terminal string of length w, which is
constructed by using CFG G
G: S → S + S | S*S | (S) | a
G1: S → S + T | T
T → T*F | F
F → (S) | a
Explanation:
G1 is the unambiguous expression of G.
(a) (ii) & (iii) only (b) (ii), (iii) & (iv)
1
(c) (i), (ii) & (iii) (d) All of these
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?
(c) L is a CFL but not regular (d) L is recursive but not a CFL
Explanation:
We can write a DFA that accepts the given language L.
2
The language accepted by the above finite automata is
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:
(a) L3 = L1 ∩ L2
(b) L1 is context free language (CFL) but L2 and L3 are not CFL’s
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.
(a) (110)∗ 01
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?
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.
5
(c) Produces 01 when input is 01
Explanation:
Take a binary string and see what the transition diagram gives as output.