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 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: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
pgcool
2 months, 3 weeks ago
D it is.. I have tested it
upvoted 1 times
...
Moneybing
7 months 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 3 times
...
fabian123324
8 months, 4 weeks ago
Selected answer c
upvoted 1 times
...
rafles
10 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 ...