Vidyalelo
Python · Q17

Decorators in Depth

Programming · Python · question 17

Q17

How is the @classmethod decorator applied to a method in a class?

A.
Using the @classmethod syntax above the class
B.
Using the @classmethod syntax above the method
Answer
C.
Using the @classmethod decorator within the method
D.
By using the apply_classmethod() function

Answer: Option B

Solution

Answer: Option B
Solution:
The @classmethod decorator is applied above the method definition using the @classmethod syntax.