PCAP Exam QuestionsBrowse all questions from this exam

PCAP Exam - Question 116


What is the expected behavior of the following code?

Show Answer
Correct Answer: A

A

Discussion

4 comments
Sign in to comment
macxszOption: A
May 4, 2022

because of the typos: A. it raises an exception

Iamrandom
Jan 3, 2024

which typos?

MallieOption: A
Dec 25, 2022

Using correct mangling, o._Class__foo(), gives an output of 2. So answer is A.

Damon54
Feb 8, 2024

Mangling error

zantrzOption: A
Feb 12, 2024

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.