Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a\'s followed Provide a regular expression which will match any string that cont

ID: 3706638 • Letter: A

Question

a's followed Provide a regular expression which will match any string that contains zero or more by one or more b's. 6. 7. The regular expression a*brc will match all of the following strings except for b. abc e. It will match all of the above 8. Which of the following best describes the regular expression .+? a. Any single character b. Any single character followed by an asterisk c. Any single character repeated any number of times d. Any single character repeated at least one time e. Any list of characters as long as there is at least one character 9. True/false: The regular expression.will only match any single character that appears three times 10. Which of the following strings does not match the regular expression ^ a*b*c? c. abcddd d. The empty string e. All of these match 11. Which of the following best explains the regular expression [0-9].$? a. A string containing only digits b. A string containing exactly one digit c. A string containing at least one digit d. A string starting with one digit e. A string starting with one digit followed by any non-digit characters

Explanation / Answer

6. answer = a*b+

    explanation: according to the question a* will gives zero or more a's and b+ will gives one or more b's . a* = epsilon,a,aa,aaa,aaaa......... and b+ = b,bb,bbb,bbbb,bbbbb.....

   the language for this regular expression is L = {b,ab,abb,aab,abbb......}

7. answer = option a,c,d

explanation : option 'a' is aaaabbbb. According to the given regular expression there is only one b. but in option 'a' there are four b's.

                   option 'c' is bbbbbb. According to the given regular expression there is only one b. but in option 'c' there are six b's.

                   option 'd' is aaaaaa. According to the given regular expression a* should follow the b. but in option 'd' aaaaaa should never follow the b.

8. answer = option 'a' that means any single character.

   explanation : '.' is a meta character that matches every character except a newline.

9. answer = false.

explanation : Regular expression doesn't allow the duplicate characters in sequence. According to given statement any single character that appears three times, it means there are duplicate characters in sequence. So, it returns false.

10. answer = option a,b,d

explanation : ^a*b*c* mathces any string oher than a*b*c*. According to the options ^a*b*c* matches abcddd and does not matches aaabbbccc, aaaaaaa, the empty string.

11. answer = option e

   explanation : ^[0-9] . *$ means a string starting with one digit followed by any non-digit characters.