menu

Python OOPs Concepts

Python OOPs Concepts - Important Points


11. Which method is used to compare two objects in Python?

A. cmp

B. eq

C. lt

D. gt

Discuss Work Space

Answer: option b

Explanation:

The method "eq" is used to compare two objects in Python.

12. Which keyword is used to define a class in Python?

A. class

B. def

C. method

D. function

Discuss Work Space

Answer: option a

Explanation:

The keyword "class" is used to define a class in Python.

13. What is the purpose of a destructor in Python?

A. To free up resources when an object is destroyed

B. To create a new object

C. To define variables in a class

D. To call methods from other classes

Discuss Work Space

Answer: option a

Explanation:

The purpose of a destructor in Python is to free up resources when an object is destroyed.

14. Which method is used to access an attribute in a class in Python?

A. dot notation

B. square bracket notation

C. parentheses notation

D. curly brace notation

Discuss Work Space

Answer: option a

Explanation:

The dot notation is used to access an attribute in a class in Python.

15. Which keyword is used to create a new instance of a class in Python?

A. self

B. new

C. create

D. None of the above

Discuss Work Space

Answer: option d

Explanation:

None of the above keywords are used to create a new instance of a class in Python. The correct syntax is ClassName().


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