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

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

What is the expected behavior of the following code?

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

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
zantrz
9 months, 2 weeks ago
Selected Answer: A
if we magle correctly, we would get the output 2, which is not in the answer list. The first call to o._Class__foo() increments Var by 1 and returns the updated value, which is 1. The second call to o._Class__foo() again increments Var by 1 (now it's 2) and returns the updated value, which is 2.
upvoted 1 times
...
Damon54
9 months, 3 weeks ago
Mangling error
upvoted 1 times
...
Mallie
1 year, 11 months ago
Selected Answer: A
Using correct mangling, o._Class__foo(), gives an output of 2. So answer is A.
upvoted 2 times
...
macxsz
2 years, 6 months ago
Selected Answer: A
because of the typos: A. it raises an exception
upvoted 2 times
Iamrandom
10 months, 4 weeks ago
which typos?
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 ...