 GeeksforGeeks App
Open App Browser
Continue

These questions for practice purpose of GATE CS Exam. Ques-1: Consider the following statements:

• X: For any language either a language L or its complement L’ must be finite.
• Y: DFA for language which contains epsilon must have initial state as final state.
• Z: Non-deterministic finite automata is more powerful than deterministic finite automata.

Which of the following statement(s) is/are correct? (A) only X (B) only Y (C) only Z (D) all of the above. Explanation: X: It is incorrect. since, a language L and its complement can be infinite. Y: It is correct.since, if the language contains epsilon then its initial state must be final also, otherwise the DFA wont be able to accept epsilon. Z: It is incorrect. since, every language accepted by NFA is also accepted by some DFA. Hence, NFA and DFA both are equivalent in power. Option (B) is true. Ques-2: Which one of the following regular expression describes the language over {a, b} which consists of no pair of consecutive b’s? (A) (a*baa*)(b + epsilon) (B) (a + ba)*(b + epsilon) (C) (a*baa*)*(b + epsilon) + a* (D) (a*ba*)*(b + epsilon) + a*(b + epsilon) Explanation:

• (A) It is incorrect. since, it does not contains (a or epsilon).
• (B) It is correct. since, it contains (epsilon, a, b, ba, ab, …..), i.e., no pair of consecutive b’s.
• (C) It is incorrect. since, it does not contains ‘ab’ or ‘aab’.
• (D) It is incorrect. since, it contains ‘bb’, which is not allowed.

Option (B) is true. Ques-3: What is the length of the shortest string not in the language over alphabet {0, 1} for regular expression given below:

`1*(0 + 1)*1* `

(A) three (B) five (C) six (D) four Explanation: Check each string generated over the alphabet {0, 1} until you reach the shortest string which is not generated by the given regular expression. In this case, smallest string which is not generated by the given regular expression is 0110, whose length is four. so, option (D) is true. Ques-4: Let ‘X’ be set of all languages accepted by deterministic push down automata (DPDA) by final state and ‘Y’ be set of all languages accepted by DPDA by empty stack then, which of the following is true? (A) X is proper subset of Y (B) X = Y (C) X is proper super set of Y (D) none of the above Explanation: The set of languages accepted by DPDA by final state is proper super set of languages accepted by empty stack DPDA. So X is proper super set of Y. Option (C) is true. Ques-5: Consider X and Y are two languages over alphabet {0, 1} represented by regular expression 0*(10*)* and (0* + 1*)* respectively. which of the following is true? (A) X is proper subset of Y (B) Y is proper subset of X (C) X = Y (D) none Explanation: Here,

```L(X)
= 0*(10*)*
= {epsilon, 0, 1, 10, 01, 00, 11, ......} ```

And.

```L(Y)
= (0* + 1*)*
= {epsilon, 0, 1, 10, 01, 00, 11, ....} ```

So, both languages are equivalent to each other. Option (C) is true.

My Personal Notes arrow_drop_up