Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 1. What type of programming language is regular expressions? a. Line-based b. Key word-based c. Character-based d. None of the above 2. What is
Python
1. What type of programming language is regular expressions? a. Line-based b. Key word-based c. Character-based d. None of the above 2. What is the name of the Python library for regular expressions? a. re b. regexp c. regex d. None of the above 3. What is one of the uses of the re.search function? a. The re.search function indicates if there is a match for the pattern in the string b. The re.search function returns a list of matches for the pattern c. None of the above 4. What does the re.findall function do? a. The re. findall function searches a string and returns a Boolean indicating if there is a match to the pattern b. The re. findall function searches a string and returns all of the substrings that match the pattern c. The re. findall function returns the first substring that matches the pattern d. None of the above 5. What does the term "greedy matching" mean? a. "Greedy matching" means that the longest string that matches the pattern is returned b. "Greedy matching" means that every possible string that matches the pattern is returned c. "Greedy matching" means that the shortest string that matches the pattern is returned d. None of the above 6. What is a "wild card" character? a. A "wild card" is a card can be used to replace a string with a random character. b. A "wild card" is a special character that matches any character. c. A "wild card" in regular expressions is the period. d. A "wild card" can refer to any string in Python. e. B and C 7. Which special character makes the matching operate in "non-greedy" mode? a. b. . c. Is d. *? e. None of the above 8. What is the benefit of using regular expressions to search and parse strings compared to built-in string functions like find and strip? a. Regular expressions can accomplish the same task in fewer lines of code b. Regular expressions are easy to read and understand c. Regular expressions can be more precise in finding a match to a string pattern d. A and C e. None of the above 9. Which special character extracts a particular subset of the matched string instead of the whole string when using findall()? a. [] b. [aeiou] c. () d. Is e. None of the above 10. What is the escape character used for in regular expressions? a. The escape character acts as a "not" and takes the opposite of the expression. b. The escape character tells the search to work backwards through the string. c. The escape character is a way to indicate that a special character is "normal" and is to be treated as a regular character instead of for its special purpose. d. None of the aboveStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started