menu

Python OOPs Concepts

Python OOPs Concepts - Important Points


31. Which of the following is true about multiple inheritance in Python?

A. A class can inherit from multiple classes at the same time

B. A class can inherit from only one class at a time

C. Multiple inheritance is not supported in Python

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

In Python, a class can inherit from multiple classes at the same time, which is known as multiple inheritance.

32. Which of the following is true about abstract classes in Python?

A. An abstract class cannot be instantiated

B. An abstract class must contain at least one abstract method

C. An abstract class can be inherited by another class

D. All of the above

Discuss Work Space

Answer: option d

Explanation:

In Python, an abstract class cannot be instantiated and must contain at least one abstract methoAn abstract class can also be inherited by another class.

33. Which of the following is a decorator in Python?

A. @classmethod

B. @staticmethod

C. @property

D. All of the above

Discuss Work Space

Answer: option d

Explanation:

@classmethod, @staticmethod, and @property are all decorators in Python.

34. Which of the following is true about the init method in Python?

A. It is called when an object is created from a class

B. It is called when an object is deleted

C. It is used to define instance variables

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

The init method in Python is called when an object is created from a class and is used to initialize the instance variables.

35. Which of the following is true about instance variables in Python?

A. They are defined inside the class but outside any method

B. They are shared by all instances of a class

C. They are accessed using the class name

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

Instance variables in Python are defined inside the class but outside any method, and are accessed using the instance name.


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