Compilers Questions and Answers – Obtaining the regular Expression from the Finite automata – 2

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

Answer: d
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

Answer: a
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

Answer: a
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.
advertisement
advertisement

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

Answer: c
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

Answer: c
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

Answer: a
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

Answer: d
Explanation: All these expression give us a regular grammar when L1 and L2 are regular.
advertisement

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

Answer: b
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

Answer: c
Explanation: Either b or a can lead followed by c this expression can be achieved by C as well.
advertisement

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.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.