MCQOPTIONS
Saved Bookmarks
This section includes 4 Mcqs, each offering curated multiple-choice questions to sharpen your Python knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which of the following lines of code will not show a match? |
| A. | >>> re.match(‘ab*’, ‘a’) |
| B. | >>> re.match(‘ab*’, ‘ab’) |
| C. | >>> re.match(‘ab*’, ‘abb’) |
| D. | >>> re.match(‘ab*’, ‘ba’) |
| Answer» E. | |
| 2. |
Which of the following functions does not accept any argument? |
| A. | re.purge |
| B. | re.compile |
| C. | re.findall |
| D. | re.match |
| Answer» B. re.compile | |
| 3. |
The following Python code snippet results in an error. |
| A. | True |
| B. | FalseView Answer |
| Answer» C. | |
| 4. |
Which of the following functions returns a dictionary mapping group names to group numbers? |
| A. | re.compile.group |
| B. | re.compile.groupindex |
| C. | re.compile.index |
| D. | re.compile.indexgroup |
| Answer» C. re.compile.index | |