Exam-style question
Try this first
Describe the language recognised by the regular expression (a|b)*abb. Give three example strings that are recognised and one string that is not recognised, explaining your choices.
Model answer
What a good answer should say
- The language consists of strings made from a and b that end with abb.
- The part (a|b)* allows any number of a or b characters before the final abb.
- Examples of recognised strings are abb, aabb and babb.
- An example that is not recognised is abba, because it ends in a rather than abb.
Explanation
Why this works
The final abb is compulsory. The preceding part can contain any sequence of a and b, including no characters, so the string may be exactly abb or may have additional characters before abb.
Common mistake
No common mistake is linked to this question yet.
