

MCQOPTIONS
Saved Bookmarks
This section includes 7 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 special characters matches a pattern only at the end of the string?$ |
A. | \B |
B. | \X |
C. | \Z |
D. | \A |
Answer» E. | |
2. |
The special character \B matches the empty string, but only when it is? |
A. | at the beginning or end of a word |
B. | not at the beginning or end of a word |
C. | at the beginning of the word |
D. | at the end of the word |
Answer» D. at the end of the word | |
3. |
The function of re.match is: |
A. | Error |
B. | Matches a pattern anywhere in the string |
C. | Matches a pattern at the end of the string |
D. | Matches a pattern at the start of the string |
Answer» B. Matches a pattern anywhere in the string | |
4. |
(‘welcome’, ‘home’)$ |
A. | [‘welcome’, ‘home’] |
B. | welcome home |
C. | [‘welcome’ // ‘home’ ] |
Answer» C. [‚Äö√Ñ√∂‚àö√ë‚àö‚â§welcome‚Äö√Ñ√∂‚àö√ë‚àö¬• // ‚Äö√Ñ√∂‚àö√ë‚àö‚â§home‚Äö√Ñ√∂‚àö√ë‚àö¬• ] | |
5. |
Which of the following pattern matching modifiers permits whitespace and comments inside the regular expression: |
A. | re.L |
B. | re.S |
C. | re.U |
D. | re.X |
Answer» D. re.X | |
6. |
Which of the following functions creates a Python object? |
A. | re.compile(str) |
B. | re.assemble(str) |
C. | re.regex(str) |
D. | re.create(str) |
Answer» E. | |
7. |
The function of re.search is: |
A. | Matches a pattern at the start of the string |
B. | Matches a pattern at the end of the string |
C. | Matches a pattern from any part of a string |
D. | Such a function does not exist |
Answer» B. Matches a pattern at the end of the string | |