menu

Python OOPs Concepts

Python OOPs Concepts - Important Points


36. Which of the following is true about class variables in Python?

A. They are defined inside a method

B. They are shared by all instances of a class

C. They are accessed using the instance name

D. None of the above

Discuss Work Space

Answer: option b

Explanation:

Class variables in Python are defined inside the class but outside any method, and are shared by all instances of a class.

37. Which of the following is true about the super() function in Python?

A. It is used to call a method in the parent class

B. It is used to call a method in the current class

C. It is used to call a method in a child class

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

The super() function in Python is used to call a method in the parent class.

38. Which of the following is true about the isinstance() function in Python?

A. It is used to check if an object is an instance of a specific class

B. It is used to check if an object is an instance of any class

C. It is used to check if a class is a subclass of another class

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

The isinstance() function in Python is used to check if an object is an instance of a specific class.

39. Which of the following is true about the issubclass() function in Python?

A. It is used to check if a class is a subclass of another class

B. It is used to check if an object is an instance of a specific class

C. It is used to check if a class is an instance of another class

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

The issubclass() function in Python is used to check if a class is a subclass of another class.

40. Which of the following is true about method overriding in Python?

A. It occurs when a subclass provides a different implementation for a method that is already defined in the parent class

B. It occurs when a subclass adds a new method to the parent class

C. It occurs when a subclass inherits all the methods from the parent class

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

Method overriding in Python occurs when a subclass provides a different implementation for a method that is already defined in the parent class.


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