Regular-Expressions

Question 1

In some programming languages, an identifier is permitted to be a letter following by any number of letters or digits. If L and D denote the sets of letters and digits respectively, which of the following expressions defines an identifier?

A
(L ∪ D)+
B
L(L ∪ D)*
C
(L⋅D)*
D
L⋅(L⋅D)*
Question 1 Explanation: 
Which is to be letter followed by any number of letters (or) digits
L(L ∪ D)*
Question 2

Which two of the following four regular expressions are equivalent? (ε is the empty string).

    (i) (00)*(ε+0)
    (ii) (00)*
    (iii) 0*
    (iv) 0(00)*
A
(i) and (ii)
B
(ii) and (iii)
C
(i) and (iii)
D
(iii) and (iv)
Question 2 Explanation: 
(00)*(ε+0),0*
In these two, we have any no. of 0's as well as null.
Question 3

Which one of the following regular expressions over {0,1} denotes the set of all strings not containing 100 as a substring?

A
0*(1+0)*
B
0*1010*
C
0*1*01
D
0(10+1)*
Question 3 Explanation: 
(A) generates 100.
(B) generates 100 as substring.
(C) doesn't generate 1.
(D) answer.
Question 4

If the regular set A is represented by A = (01 + 1)* and the regular set ‘B’ is represented by B = ((01)*1*)*, which of the following is true?

A
A ⊂ B
B
B ⊂ A
C
A and B are incomparable
D
A = B
Question 4 Explanation: 
Both A and B are equal, which generates strings over {0,1}, while 0 is followed by 1.
Question 5

The string 1101 does not belong to the set represented by

A
110*(0 + 1)
B
1 ( 0 + 1)* 101
C
(10)* (01)* (00 + 11)*
D
Both C and D
Question 5 Explanation: 
Options A & B are generates string 1101.
C & D are not generate string 1101.
There are 5 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access