AALL10 ยท Chapter 10Theory of Computation & Graphics๐๏ธ Past Licensure QuestionID: 0fd622ef
Which regular expression represents the set of all strings over that do NOT contain "rt" as a substring?
Which regular expression represents the set of all strings over that do NOT contain "rt" as a substring?
Multiple Choice Options
- A
- B
- C
- Dโ Correct Option
Detailed Technical Solution & Explanation
A string contains the substring "rt" if any 'r' is followed by a 't'. To prevent "rt" from appearing anywhere, all 't's must appear before all 'r's (i.e., once an 'r' appears, no 't' can ever follow). This is precisely generated by the regular expression **** (any number of 't's followed by any number of 'r's).
Option Analysis:
โข
Option A (): Explicitly contains 'rt'.
โข
Option B (): Generating strings like contains "rt" internally.
โข
Option C (): Generates when .
โข
Option D (): Correct; guarantees all 't's precede 'r's, completely preventing "rt".
Reference: Mock Test 05NEC Licensure Syllabus