0% found this document useful (0 votes)
10 views

Application Development Using Python CA2

This document summarizes the questions and answers from a quiz on application development using Python. It covered topics like regular expressions, object-oriented programming concepts, exception handling, file manipulation, and more. The quiz contained 30 multiple choice questions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Application Development Using Python CA2

This document summarizes the questions and answers from a quiz on application development using Python. It covered topics like regular expressions, object-oriented programming concepts, exception handling, file manipulation, and more. The quiz contained 30 multiple choice questions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Home

Week 10 : Learning Task CA - 02 (CS&IT)


Application Development Using Python Continuous Assessment 2

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?

Response: A group of characters that represent a single character in a pattern.

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?

Response: To save and retrieve Python objects to and from files

Question 8
In Python, how can you create a custom exception class?

Response: By inheriting from the built-in Exception class

Question 9
What is the term for the process of catching an exception and then re-raising it?

Response: Exception chaining

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?

Response: A reference to the object

Question 12
What is the term for the process of defining multiple methods with the same name in a class but with different parameters?

Response: Method overloading

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?

Response: User-defined exceptions

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?

Response: It finds and returns all occurrences of a pattern in a string.

Question 17
What is the purpose of the os.path.abspath() function in Python?

Response: To return the absolute path of a file or directory

Question 18
What is the primary use of the time class in Python?

Response: To work with time-related data and functions

Question 19
In Python, how do you read the contents of a text file line by line?

Response: Using the file.readlines() method

Question 20
What is the purpose of the try and except blocks in exception handling?

Response: To catch and handle exceptions

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?

Response: By using the try block

Question 24
What is the result of using the os.makedirs() function to create a directory that already exists?

Response: It raises an error.

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?

Response: shutil.copy(file, destination)

Question 30
What is the term for finding a specific sequence of characters within a larger string?

Response: Searching

You might also like