Discussion
Give regular expression for the language that contains all strings with at least one occurrence of each symbol in Σ = {a, b, c},.
Answer: B
Of the options, the key's answer is (a + b + c)* a (a + b + c)* b (a + b + c)* c (a + b + c)*.
It allows any symbols before, between and after one a, one b and one c, so every string it matches contains all three symbols.
The other options are more restrictive. The first needs the substring abc, missing strings such as acbbc. The third must end in c, and the fourth must begin with a.
Strictly, this expression only matches strings in which some a comes before some b, which comes before some c, so a string such as cba is missed; a complete expression would combine all six orders. The paper's option set does not include that, and B is the most general of the four.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development