The correct options are:
A. A class constructor can return a value. In Python, the constructor method is usually named __init__, and while it is not required to return a value, it is possible to include a return statement within the __init__ method if needed.
C. A class constructor can be invoked directly from any of the subclasses. Subclasses can call the constructor of their superclass using the super() function. This allows the initialization code in the superclass to be executed.
So, the correct choices are A and C.
A is incorrect.
A class constructor can only return the value 'None'.
If you try something else you will receive the errors below. Please check.
TypeError: __init__() should return None, not 'int'
TypeError: __init__() should return None, not 'float'
TypeError: __init__() should return None, not 'str'
TypeError: __init__() should return None, not 'list'
TypeError: __init__() should return None, not 'tuple'
TypeError: __init__() should return None, not 'dict
A class constructor cannot return a value and can be invoked directly from any subclass or superclass. Therefore, options B and A are incorrect. The correct answer is options C and D.
Option C means that the class constructor can be invoked directly from any subclass. Option D means that the class constructor can be invoked directly from any superclass.
D is false. You can't call a constructor from any superclass
upvoted 4 times
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
kstr
1 year agoGvsl
12 months agoGvsl
1 year, 1 month agoMikku123
1 year, 3 months agoSenthorus
1 year, 4 months agoaferiver
1 year, 8 months agoSenthorus
1 year, 4 months ago