Which of the following is a regular language? ans.String with substring wwr in betweenPalindrome stringString with even number of Zero’sString whose length is a sequence of prime numbers Previous Marked for Review Next
Question
Which of the following is a regular language? ans.String with substring wwr in betweenPalindrome stringString with even number of Zero’sString whose length is a sequence of prime numbers Previous Marked for Review Next
Solution
The regular language among the options given is the "String with even number of Zero’s".
Here's why:
-
"String with substring wwr in between" - This is not a regular language because it requires the ability to remember an arbitrary number of characters 'w', which is not possible with a finite automaton (which defines regular languages).
-
"Palindrome string" - This is not a regular language because it requires the ability to compare the first half of the string with the reversed second half, which is not possible with a finite automaton.
-
"String with even number of Zero’s" - This is a regular language because it can be represented by a finite automaton. The automaton only needs to keep track of whether it has seen an odd or even number of zeros, which can be done with two states.
-
"String whose length is a sequence of prime numbers" - This is not a regular language because it requires the ability to count the length of the string and check if it's a prime number, which is not possible with a finite automaton.
Similar Questions
Which of the following is a regular language?
Which language accepted by the regular expression (0+1)*0(0+1)*0(0+1)*.Select one:a. The set of all strings containing at least two 0’s.b. The set of all strings that begin and end with either 0 or 1.c. The set of all strings containing at most two 0’s.d. The set of all strings containing the substring 00.
Which of the following languages are regular?A = {x | x has two 0’s separated by the number of positions that is a multiple of 4 }.B = {x | x is binary representation of multiple of 3}.C = {x | x is a binary string and decimal of any prefix of x is not of form 3m + 2, where m ≥ 0}.Select one:a. All of the mentioned.b. Only B and C. c. Only A.d. Only B.
Write regular expressions for the following languages.1. the set of all alphabetic strings;2. the set of all lower case alphabetic strings ending in a b;3. the set of all strings from the alphabet a, b such that each a is immedi-ately preceded by and immediately followed by a b
The language generated by the below grammar is the set of ____________.S →→ aSa| bSb| a| b; a)all odd length palindromesb)all palindromesc)strings beginning and ending with the same symbold)all even length palindromes
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.