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

Exam PCPP-32-101 All Questions

View all questions & answers for the PCPP-32-101 exam

Exam PCPP-32-101 topic 1 question 5 discussion

Actual exam question from Python Institute's PCPP-32-101
Question #: 5
Topic #: 1
[All PCPP-32-101 Questions]

Analyze the following function and choose the statement that best describes it.

  • A. It is an example of a decorator that accepts its own arguments.
  • B. It is an example of decorator stacking.
  • C. It is an example of a decorator that can trigger an infinite recursion
  • D. The function is erroneous.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
pgcool
9 months, 3 weeks ago
D it is.. I have tested it
upvoted 1 times
...
Moneybing
1 year, 1 month ago
Selected Answer: D
The answer is D. if you run this code to decorator a new function, you will get name error, regardless the colon in line 3 is missing or not. NameError: name 'level2_warpper' is not defined. This is because our_function (line 4) and my_function(line 2) did not return the SAME function name. line 2: def level1_wrapper(my_function) line4: return our_function To make this code correct, you can make FUNCTION_NAME in line 2 and line 4 consistency. eg. line 4 should be ' return my_function' B is Wrong. Because we did not have two more decorators for decorator stacking. C is Wrong. Because the decorator returns arguments 2 times (2 level wrap), not infinite recursion. A is NOT the answer since the code is wrong. A could be a correct answer if the code is consistency. my_func('smallcoat','middlecoat')
upvoted 4 times
...
fabian123324
1 year, 3 months ago
Selected answer c
upvoted 1 times
...
rafles
1 year, 4 months ago
Selected Answer: D
Not only the wrapper is missing the colon, it's calling own_function, which wasn't defined anywhere
upvoted 2 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 ...