menu

Python OOPs Concepts

Python OOPs Concepts - Important Points


16. Which method is used to delete an object in Python?

A. del

B. delete

C. remove

D. destroy

Discuss Work Space

Answer: option a

Explanation:

The method "del" is used to delete an object in Python.

17. Which keyword is used to define a static method in Python?

A. static

B. def

C. classmethod

D. None of the above

Discuss Work Space

Answer: option d

Explanation:

None of the above keywords are used to define a static method in Python. The @staticmethod decorator is used instead.

18. What is the purpose of a class method in Python?

A. To create new objects

B. To call methods from other classes

C. To define variables in a class

D. To perform actions on a class itself

Discuss Work Space

Answer: option d

Explanation:

The purpose of a class method in Python is to perform actions on a class itself.

19. Which keyword is used to define an instance variable in Python?

A. class

B. self

C. instance

D. var

Discuss Work Space

Answer: option b

Explanation:

The keyword "self" is used to define an instance variable in Python.

20. Which method is used to access the representation of an object in Python?

A. str

B. repr

C. eq

D. cmp

Discuss Work Space

Answer: option b

Explanation:

The method "repr" is used to access the representation of an object in Python.


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now