This set of Compilers test focuses on “Obtaining the Regular Expression from the Finite Automata – 2”.
1. Which of the following identity is true?
a) Ɛ + RR* = R* = ɛ + R*R
b) (R1R2)*R1 = R1 (R2R1)*
c) R*R* = R*
d) All of the mentioned
View Answer
Explanation: The former Re can be produced from the latter one.
2. The set of all strings over ∑ = {a,b} in which all strings having bbbb as substring is?
a) (a+b)* bbbb (a+b)*
b) (a+b)* bb (a+b)*bb
c) bbb(a+b)*
d) bb (a+b)*
View Answer
Explanation: Out of all RE mentioned only the first string certainly has bbbb as substring. Rest all just have a possibility of having it.
3. The set of all strings over ∑ ={a,b} in which a single a is followed by any number of b’s a single b followed by any number of a’s is?
a) ab* + ba*
b) ab*ba*
c) a*b + b*a
d) None of the mentioned
View Answer
Explanation: ab*+ba* is the expression in which a single a is followed by any number of b’s a single b followed by any number of a’s.
4. Regular expressions are used to represent which language?
a) Recursive language
b) Context free language
c) Regular language
d) All of the mentioned
View Answer
Explanation: Regular expression is represented by regular language.
5. The set of all strings over ∑ = {a,b} in which strings consisting a’s and b’s and ending with in bb is?
a) ab
b) a*bbb
c) (a+b)* bb
d) All of the mentioned
View Answer
Explanation: Only this expression ends with bb only.
6. If P, Q, R are three regular expressions and if P does not contain a then the equation R = R + RP has a unique solution given by?
a) R = QP*
b) R = P*Q
c) R = RP
d) None of the mentioned
View Answer
Explanation: It is an important law primarily used in conversion.
7. If L1 and L2 are regular languages is/are also regular language(s).
a) L1 + L2
b) L1L2
c) L1
d) All of the mentioned
View Answer
Explanation: All these expression give us a regular grammar when L1 and L2 are regular.
8. Which of the following regular expression denotes zero or more instances of an a or b?
a) a/b
b) (a/b)*
c) (ab)*
d) a*Ib
View Answer
Explanation: This expression gives o or more instances of a or b.
9. The string (a)|((b)*(c)) is equivalent to ______________
a) Empty
b) abcabc
c) b*c|a
d) None of the mentioned
View Answer
Explanation: Either b or a can lead followed by c this expression can be achieved by C as well.
Sanfoundry Global Education & Learning Series – Compilers.
To practice all areas of Compilers for tests, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Apply for Computer Science Internship
- Practice Computer Science MCQs
- Check Computer Science Books
- Practice MCA MCQs
- Check Compiler Design Books