

MCQOPTIONS
Saved Bookmarks
This section includes 8 Mcqs, each offering curated multiple-choice questions to sharpen your Python knowledge and support exam preparation. Choose a topic below to get started.
1. |
What does print(Test.__name__) display (assuming Test is the name of the class)? |
A. | () |
B. | Exception is thrown |
C. | Test |
D. | __main__ |
Answer» D. __main__ | |
2. |
__del__ method is used to destroy instances of a class. |
A. | True |
B. | False |
Answer» B. False | |
3. |
What is delattr(obj,name) used for? |
A. | To print deleted attribute |
B. | To delete an attribute |
C. | To check if an attribute is deleted or not |
D. | To set an attribute |
E. | used for?a) To print deleted attributeb) To delete an attributec) To check if an attribute is deleted or notd) To set an attribute |
Answer» C. To check if an attribute is deleted or not | |
4. |
What is hasattr(obj,name) used for? |
A. | To access the attribute of the object |
B. | To delete an attribute |
C. | To check if an attribute exists or not |
D. | To set an attribute |
E. | used for?a) To access the attribute of the objectb) To delete an attributec) To check if an attribute exists or notd) To set an attribute |
Answer» D. To set an attribute | |
5. |
Special methods need to be explicitly called during object creation. |
A. | True |
B. | False |
Answer» C. | |
6. |
What are the methods which begin and end with two underscore characters called? |
A. | Special methods |
B. | In-built methods |
C. | User-defined methods |
D. | Additional methods |
Answer» B. In-built methods | |
7. |
Which of the following is not a class method? |
A. | Non-static |
B. | Static |
C. | Bounded |
D. | Unbounded |
Answer» B. Static | |
8. |
The assignment of more than one function to a particular operator is _______ |
A. | Operator over-assignment |
B. | Operator overriding |
C. | Operator overloading |
D. | Operator instance |
Answer» D. Operator instance | |