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

Exam PCAP All Questions

View all questions & answers for the PCAP exam

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 (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Damon54
9 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
10 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
1 year, 2 months ago
CaptinPirate answer is answer A and answer D, this will save you checking his/her/they link
upvoted 3 times
...
CaptainPirate
1 year, 3 months 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
1 year, 4 months 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
2 years, 3 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, 6 months 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, 7 months 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, 10 months ago
Anyone can please explain this questions?
upvoted 1 times
macxsz
2 years, 6 months 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
3 years, 1 month ago
shouldn't this be BC?
upvoted 1 times
mouhsini
3 years, 1 month 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 ...