Following questions have been asked in GATE CS 2009 exam.

**1) S –> aSa| bSb| a| b ;The language generated by the above grammar over the alphabet {a,b} is the set of**

(A) All palindromes.

(B) All odd length palindromes.

(C) Strings that begin and end with the same symbol

(D) All even length palindromes.

Answer (B)

The strings accepted by language are {a, b, aaa, bbb, aba, bab, ..}. All of these strings are odd length palindromes.

**2) Which one of the following languages over the alphabet {0,1} is described by the regular expression: (0+1)*0(0+1)*0(0+1)*?**

(A) The set of all strings containing the substring 00.

(B) The set of all strings containing at most two 0’s.

(C) The set of all strings containing at least two 0’s.

(D) The set of all strings that begin and end with either 0 or 1.

Answer (C)

The regular expression has two 0’s surrounded by (0+1)* which means accepted strings must have at least 2 0’s.

**3) Which one of the following is FALSE?**

(A) There is unique minimal DFA for every regular language

(B) Every NFA can be converted to an equivalent PDA.

(C) Complement of every context-free language is recursive.

(D) Every nondeterministic PDA can be converted to an equivalent deterministic PDA.

Answer (D)

Deterministic PDA cannot handle languages or grammars with ambiguity, but NDPDA can handle languages with ambiguity and any context-free grammar. So every nondeterministic PDA can not be converted to an equivalent deterministic PDA.

**4) Match all items in Group 1 with correct options from those given in Group 2.**

Group 1 Group 2 P. Regular expression 1. Syntax analysis Q. Pushdown automata 2. Code generation R. Dataflow analysis 3. Lexical analysis S. Register allocation 4. Code optimization

(A) P-4. Q-1, R-2, S-3

(B) P-3, Q-1, R-4, S-2

(C) P-3, Q-4, R-1, S-2

(D) P-2, Q-1, R-4, S-3

Answer (B)

**5) . Let L = L1 ∩ L2, where L1 and L2 are languages as defined below:
L1 = {a ^{m}b^{m}ca^{n}b^{n} | m, n >= 0 }
L2 = {a^{i}b^{j}c^{k} | i, j, k >= 0 }
Then L is**

(A) Not recursive

(B) Regular

(C) Context free but not regular

(D) Recursively enumerable but not context free.

Answer (C)

The language L1 accept strings {c, abc, abcab, aabbcab, aabbcaabb, …} and L2 accept strings {a, b, c, ab, abc, aabc, aabbc, … }. Intersection of these two languages is L1 ∩L2 = {a^{k}b^{k}c | k >= 0} which is context free, but not regular.

Please see GATE Corner for all previous year paper/solutions/explanations, syllabus, important dates, notes, etc.

Please write comments if you find any of the answers/explanations incorrect, or you want to share more information about the topics discussed above.

## Recommended Posts:

- Automata Theory | Set 1
- Automata Theory | Set 6
- Automata Theory | Set 4
- Automata Theory | Set 3
- Automata Theory | Set 2
- Theory of Computation | Applications of various Automata
- Theory of Computation | Generating regular expression from finite automata
- Construct Pushdown automata for L = {a
^{(2*m)}c^{(4*n)}d^{n}b^{m}| m,n ≥ 0} - Construct Pushdown automata for L = {0
^{n}1^{m}2^{(n+m)}| m,n ≥ 0} - Construct Pushdown automata for L = {0
^{n}1^{m}2^{m}3^{n}| m,n ≥ 0} - TOC | Designing Deterministic Finite Automata (Set 2)
- Construct Pushdown Automata for given languages
- Detailed Study of PushDown Automata
- TOC | Designing Deterministic Finite Automata (Set 1)
- Practice problems on finite automata | Set 2