Final Exam 2023, V2
Final Exam 2023, V2
9. What does the filter() function do with a lambda function as its first argument?
a) Filters out elements from an iterable based on the lambda function’s result
b) Adds elements to an iterable based on the lambda function's result
c) Sorts elements in an iterable based on the lambda function's result
d) Reverses elements in an iterable based on the lambda function’s result
11. What does the character '^' represent in a regex pattern in Python ?
a) Matches the end of a string
b) Matches the start of a string
c) Matches any character except newline
d) Matches zero or one occurrence of the preceding element
12. Which of the following regex patterns will match either "cat" or "dog" in Python ?
a) (cat|dog)
b) [catdog]
c) cat*dog
d) cat&dog
16. What does the character '|' represent in a regex pattern in Python?
a) Matches the start of a string
b) Logical OR, matches either the pattern on the left or the one on the right
c) Matches any digit character
d) Matches one or more occurrences of the preceding element
17. What does the '?' symbol indicate in a regex pattern in Python?
a) Matches zero or more occurrences of the preceding element
b) Matches one or zero occurrences of the preceding element
c) Matches exactly one occurrence of the preceding element
d) Matches one or more occurrences of the preceding element
18. Which of the following regex patterns will match a phone number with an optional country code in Python?
a) \d{10}
b) \d{1,3}-\d{3}-\d{4}
c) \+?\d{1,3}-\d{3}-\d{4}
d) (\d{3}-){2}\d{4}
23. Which event is triggered when the close button of the window is clicked?
a) pygame.QUIT
b) pygame.CLOSE
c) pygame.EXIT
d) pygame.CLOSE_WINDOW
Minutes #29 of School of Information Technology and Engineering meeting December 01, 2023