Machine-translated by Google. Questions are authored in English.
Top

Regular Expressions and Languages Questions and Answers

11.

For which of the following applications regular expressions can be used ?

Exam Year(s)

Tripura Public Service Commission - 2019,

Answer: D

Regular expressions can be used for all of the above.

They describe the tokens recognised by the lexical analyser when designing compilers, power the search-and-replace features of text editors, and, because they are equivalent to finite automata, model the behaviour of sequential circuits, which are finite-state machines.

Since each listed application is a genuine use, no single option is complete.

Please log in or register to report this question.

12.

Which of the following is NOT recognized by a finite automaton ?

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: C

The language not recognised by a finite automaton is \(a^{n} b^{n}\) where n ≥ 0.

To accept anbn a machine must count the a's to check that the same number of b's follows, and n is unbounded. A finite automaton has only finitely many states, so it cannot keep an unbounded count, and the pumping lemma proves the language is not regular. A pushdown automaton can accept it with its stack, because the language is context-free.

a*b*, (a+b)* and ab*a are regular expressions, so each describes a regular language that some finite automaton accepts.

Please log in or register to report this question.

13.

Let w be a string defined on the alphabet {0, 1} then which of the following language is regular ?

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: C

The regular language is L = {w | w has even number of 0's and even number of 1's}.

A DFA needs to remember only two bits of information: whether it has seen an even or odd number of 0s, and of 1s. Four states (even-even, even-odd, odd-even, odd-odd) suffice, with even-even as the start and accepting state, so the language is regular.

The other three need unbounded counting or memory. Equal numbers of 0s and 1s and more 0s than 1s need a counter, and w followed by its reverse needs a stack; each can be shown non-regular with the pumping lemma and is context-free.

Please log in or register to report this question.

Answer: C

Kleene closure is zero or more occurrences of the symbol.

For a symbol a, the Kleene closure a* is the set of all strings of zero or more a's:

\[ a^{*} = \{ \varepsilon, a, aa, aaa, \ldots \} \]

It includes the empty string ε. 'One or more occurrences' describes the positive closure a+, which leaves ε out. 'Cleanly closes the token' is a pun on the name with no meaning.

Please log in or register to report this question.

15.

Which of the following regular expression identities are true ?

Exam Year(s)

UGC NET - 2012,

Answer: C

The identity \((r+s)^* = (r^* s^*)^*\) is true, since both sides describe all strings made of any number of r's and s's in any order. The identity \((r+s)^* = r^* s^*\) is false because the right side cannot produce a string such as sr in which s comes before r, and \((r+s)^* = r^* + s^*\) is false for the same reason, as \(r^* + s^*\) has no string mixing the two. The last identity, \(r^* s^* = r^* + s^*\), is false, because the left side gives rs but the right side does not. The keyed answer is the third option.

Please log in or register to report this question.

16.

Consider the regular expression (a + b) (a + b) … (a + b) (n-times). The minimum number of states in finite automaton that recognizes the language represented by this regular expression contains

Exam Year(s)

UGC NET - 2012,

Answer: B

The language of the expression (a + b) repeated n times is the set of all strings of length exactly n over a and b. An automaton that counts the symbols needs one state for each count from 0 to n, which is n + 1 states, with the last one accepting; a complete deterministic automaton would also need a dead state for longer strings, but the key counts the n + 1 states of the counting chain. So the answer is n + 1 states, option (B). Fewer than n + 1 states cannot count to n, and the other options count more than are needed.

Please log in or register to report this question.

17.

The regular expression for the following DFA is

A DFA with two states. The start state, marked by an arrow, loops on a and goes to the final (double-circled) state on b. The final state loops on b and returns to the start state on a.

Exam Year(s)

UGC NET - 2012,

Answer: D

The DFA has a start state that loops on a and goes to the final state on b, and the final state loops on b and returns to the start state on a. From the start, any number of a's then a b brings us to the final state, which gives a*b. From the final state each round trip is either a b loop, or an a back to the start followed by any number of a's and a b, which is aa*b, so the expression is a*b(b + aa*b)*, option (B). Option (A) starts with one a, so it cannot generate the string b, which the DFA accepts, and options (C) and (D) put a star on the wrong part of the second factor.

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Regular Expressions and Languages Questions and Answers || Regular Expressions and Languages MCQ Questions and Answers || Regular Expressions and Languages GK Questions and Answers || Regular Expressions and Languages GK MCQ Questions || Regular Expressions and Languages Multiple Choice Questions and Answers || Regular Expressions and Languages GK || GK on Regular Expressions and Languages || Theory of Computation Questions and Answers || Theory of Computation MCQ Questions and Answers || Theory of Computation GK Questions and Answers || GK on Theory of Computation