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

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

What is the expected behavior of the following code?

  • A. it outputs 0
  • B. it raises an exception
  • C. it outputs 1
  • D. it outputs 2
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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
deckman
Highly Voted 2 years, 6 months ago
Selected Answer: B
B is the correct answer Traceback (most recent call last): File "main.py", line 17, in <module> print(a.doit() + b.doit()) TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
upvoted 5 times
...
seaverick
Most Recent 10 months, 1 week ago
#question 120 class Super: def make(self): pass def doit(self): return self.make() class Sub_A(Super): def make(self): return 1 class Sub_B(Super): pass a=Sub_A() b=Sub_B() print(a.doit()) print(b.doit()) print(a.doit() + b.doit())#TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' Tested: B. it raises an exception
upvoted 1 times
...
Siva_2022
2 years, 6 months ago
Option B is the correct answer
upvoted 1 times
...
macxsz
2 years, 7 months ago
Outputs error. Int + NoneType
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 ...