Explore topic-wise MCQs in Python.

This section includes 4 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. t()
B. tException is thrown
C. tTest
D. t__main__
Answer» D. t__main__
2.

__del__ method is used to destroy instances of a class.

A. tTrue
B. tFalse
Answer» B. tFalse
3.

What is hasattr(obj,name) used for?

A. tTo access the attribute of the object
B. tTo delete an attribute
C. tTo check if an attribute exists or not
D. tTo set an attribute
Answer» D. tTo set an attribute
4.

Special methods need to be explicitly called during object creation.

A. tTrue
B. tFalse
Answer» C.