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 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 (?) , you can switch to a simple comment.
Switch to a voting comment New
zantrz
2 months, 3 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
2 months, 3 weeks ago
Mangling error
upvoted 1 times
...
Mallie
1 year, 4 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 ago
Selected Answer: A
because of the typos: A. it raises an exception
upvoted 2 times
Iamrandom
4 months 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 ...