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 94 discussion

Actual exam question from Python Institute's PCAP
Question #: 94
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_4(D,A): pass
  • B. class Class_3(A,C): pass
  • C. class Class_2(B,D): pass
  • D. class Class_1(C,D): pass
Show Suggested Answer Hide Answer
Suggested Answer: AD 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Damon54
2 months, 3 weeks ago
TypeError: Cannot create a consistent method resolution order (MRO) for bases A, C TypeError: Cannot create a consistent method resolution order (MRO) for bases B, D
upvoted 1 times
...
seaverick
3 months ago
Selected Answer: AD
class A: pass class B(A): pass class C(A): pass class D(B): pass class Class_4(D,A): pass #class Class_3(A,C): pass#TypeError: Cannot create a consistent method resolution order (MRO) for bases A, C #class Class_2(B,D): pass#TypeError: Cannot create a consistent method resolution order (MRO) for bases A, C class Class_1(C,D): pass Ans is A,D
upvoted 1 times
...
Janpcap123
8 months ago
CaptinPirate answer is answer A and answer D, this will save you checking his/her/they link
upvoted 3 times
...
CaptainPirate
8 months, 1 week ago
Ok guys.Here is your answer.I only typed it in VSSCODE and here it is: https://drive.google.com/file/d/122fvfA91ZyKcsq7qlaBQXYcGH0x7e9Ja/view?usp=sharing
upvoted 2 times
...
Raymond91
9 months, 2 weeks ago
Why is the corract answer not Class(D,C): pass ?? D -> B -> A C -> A I do not understand why the correct answer is Class(C,D): pass Can someone please explain? Is that because in the inheritance class B cannot be invoked before class C is invoked which is why it's Class(C,D): pass C -> A D -> B -> A (class B invoked later on as it is initialized earlier than class C)
upvoted 1 times
...
Boka
1 year, 8 months ago
How class Class_1(C,D): pass is correct here? D is not sub class of C
upvoted 2 times
...
macxsz
2 years ago
Selected Answer: AD
only corrects are: A. class Class_4(D,A): pass D. class Class_1(C,D): pass
upvoted 2 times
...
MTLE
2 years ago
A can't be declared from C as A is superclass to C, same goes to B and D. Answer is correct
upvoted 3 times
...
ruydrigo
2 years, 3 months ago
Anyone can please explain this questions?
upvoted 1 times
macxsz
2 years ago
On multiple inheretance, the Parent cannot be declared before the child: https://www.datacamp.com/community/tutorials/super-multiple-inheritance-diamond-problem
upvoted 7 times
...
...
erikkk
2 years, 6 months ago
shouldn't this be BC?
upvoted 1 times
mouhsini
2 years, 6 months ago
Can't be B, class A shouldn't be before class C, because class C is a subclass of class A. The order left and right is important in python.
upvoted 3 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 ...