Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What does the @staticmethod decorator do?

  1. A Makes a method callable without an instance and without receiving self or cls
  2. B Prevents the method from being overridden
  3. C Caches the method's return value
  4. D Makes the method private
Answer

Makes a method callable without an instance and without receiving self or cls

A staticmethod is a plain function namespaced inside the class. A classmethod receives cls and is typically used for alternative constructors.

All Python MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as