Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam PCAP topic 1 question 134 discussion

Actual exam question from Python Institute's PCAP
Question #: 134
Topic #: 1
[All PCAP Questions]

Assuming that the following inheritance set is in force, which of the following classes are declared properly? (Choose two.)

  • A. class Class_3(A,C): pass
  • B. class Class_4(C,B): pass
  • C. class Class_1(D): pass
  • D. class Class_2(A,B): pass
Show Suggested Answer Hide Answer
Suggested Answer: CD 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
macxsz
Highly Voted 2 years ago
Correct answers: B. class Class_4(C,B): pass C. class Class_1(D): pass
upvoted 10 times
...
kstr
Most Recent 2 months, 2 weeks ago
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
upvoted 1 times
Damon54
2 months, 1 week ago
Sure ?!?
upvoted 1 times
...
...
Damon54
2 months, 3 weeks ago
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
upvoted 1 times
...
seaverick
3 months, 1 week ago
Selected Answer: BC
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
upvoted 2 times
...
Nenggg
1 year, 4 months ago
Selected Answer: BC
A and D will have MRO error, it should be A. class Class_3(C,A): pass D. class Class_2(B,A): pass
upvoted 3 times
...
haly
1 year, 7 months ago
Selected Answer: BC
B and C are correct because you cant invoke a parent class first
upvoted 1 times
...
alfonsocav1982
1 year, 8 months ago
Selected Answer: BC
B and C are correct
upvoted 1 times
...
Jnanada
1 year, 8 months ago
Correct answer should be B and C.
upvoted 1 times
...
dsirak
1 year, 9 months ago
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
...
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.

SaveCancel
Loading ...