Application Development Using Python CA2
Application Development Using Python CA2
End of quiz
You are at the end; press Finished to complete and grade the quiz.
You can review your answers below and click Edit if you want to change any.
Finished
Question 1
What is a character class in regular expressions?
Question 2
In OOP, what is the term for methods that change the state of an object?
Response: Modifiers
Question 3
What module is used to create, read, and write compressed ZIP archives in Python?
Response: zipfile
Question 4
What is the purpose of the finally block in exception handling?
Response: To specify code that will always execute, whether or not an exception occurs
Question 5
What is the keyword used to raise an exception manually in Python?
Response: raise
Question 6
Which method is used to perform regular expression pattern matching in Python?
Response: search()
Question 7
What is the purpose of the shelve module in Python?
Question 8
In Python, how can you create a custom exception class?
Question 9
What is the term for the process of catching an exception and then re-raising it?
Question 10
Are objects in Python mutable or immutable by default?
Response: Mutable
Question 11
In OOP, when an object is returned from a method, what is returned?
Question 12
What is the term for the process of defining multiple methods with the same name in a class but with different parameters?
Question 13
What character is used to represent the end of a line in a regular expression?
Response: $
Question 14
In Python, what is the term for creating and using your own exception classes?
Question 15
What is the primary difference between a class and a function in Python?
Response: Functions are used to define behavior, while classes are used to define objects.
Question 16
What does the findall() method in Python's re module do?
Question 17
What is the purpose of the os.path.abspath() function in Python?
Question 18
What is the primary use of the time class in Python?
Question 19
In Python, how do you read the contents of a text file line by line?
Question 20
What is the purpose of the try and except blocks in exception handling?
Question 21
Which Python module is used to create and manipulate directory trees?
Response: os.path
Question 22
What character is used to represent the beginning of a line in a regular expression?
Response: ^
Question 23
How can you handle exceptions in Python?
Question 24
What is the result of using the os.makedirs() function to create a directory that already exists?
Question 25
What is a "pure function" in programming?
Response: A function that always returns the same output for the same input and has no side effects
Question 26
Which Python module is used for working with regular expressions?
Response: re
Question 27
What is the term for creating a new object that is a copy of an existing object?
Response: Cloning
Question 28
In OOP, what is the primary difference between prototyping and planning a class?
Response: Prototyping is a quick and informal way to design a class, while planning is a more formal and detailed process.
Question 29
How can you copy a file from one location to another using the shutil module?
Question 30
What is the term for finding a specific sequence of characters within a larger string?
Response: Searching