A. class Class_3(A,C): pass
This class declaration is proper based on the assumed inheritance set.
It correctly inherits from classes A and C.
B. class Class_4(C,B): pass
This class declaration is also proper based on the assumed inheritance set.
It correctly inherits from classes C and B.
C. class Class_1(D): pass
This class declaration is not proper based on the assumed inheritance set.
It tries to inherit from class D, but D doesn't exist in the assumed inheritance set.
D. class Class_2(A,B): pass
This class declaration is not proper based on the assumed inheritance set.
It tries to inherit from classes A and B, which is fine, but it doesn't cover all the necessary classes in the inheritance set (specifically, class C and its descendants).
So, the proper class declarations are:
A. class Class_3(A,C): pass
B. class Class_4(C,B): pass
A. class Class_3(A,C): pass, it does not work because if the variable or method is not found in A it will not even be found in C as C inherits from A
D. class Class_2(A,B): pass, the same thing doesn't work because if the variable or method is not found in A it won't even be found in B as B inherits from A
class A:
pass
class B(A):
pass
class C(A):
pass
class D(B,C):
pass
#class Class_3(A,C): pass #TypeError: Cannot create a consistent method resolution order (MRO) for bases A, C
class Class_4(C,B): pass
class Class_1(D): pass
#class Class_2(A,B): pass #TypeError: Cannot create a consistent method resolution order (MRO) for bases A, B
Ans is B,C
I also agree, B and C are correct.
Switch to voting comment, so that Community vote distribution is displayed after Reveal Solution.
upvoted 1 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.
macxsz
Highly Voted 2 years, 7 months agokstr
Most Recent 9 months, 2 weeks agoDamon54
9 months agoDamon54
9 months, 3 weeks agoseaverick
10 months agoNenggg
1 year, 11 months agohaly
2 years, 1 month agoalfonsocav1982
2 years, 3 months agoJnanada
2 years, 3 months agodsirak
2 years, 3 months ago