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
View Answer Discuss Work SpaceAnswer: option b
Explanation:
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
View Answer Discuss Work SpaceAnswer: option a
Explanation:
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
View Answer Discuss Work SpaceAnswer: option a
Explanation:
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
View Answer Discuss Work SpaceAnswer: option a
Explanation:
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
View Answer Discuss Work SpaceAnswer: option a
Explanation: