Courseiva

PCAP Object-Oriented Programming Practice Question

Which TWO statements about static methods (@staticmethod) are correct?

⚠ Common exam trap

Python Institute often tests the distinction between `@staticmethod` and `@classmethod`, and the trap here is that candidates confuse static methods with class methods, assuming static methods can access class variables via `cls` or instance attributes via `self`.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

They do not receive an implicit first argument.

Static methods in Python do not receive an implicit first argument like `self` (for instance methods) or `cls` (for class methods). They behave like plain functions but belong to a class's namespace, and are called without any automatic parameter injection.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    They do not receive an implicit first argument.

    Why this is correct

    Static methods are not bound to either an instance or the class, so Python passes no implicit first argument when they are invoked. Unlike instance methods which receive self or class methods which receive cls, a static method's signature matches exactly what is written in the function definition. This makes them behave like ordinary functions, but they still live in the class's namespace.

  • ✗

    They can access instance attributes via self.

    Why it's wrong here

    A static method has no self parameter because no instance is automatically injected into the call. Without that reference, it cannot directly access instance attributes such as self.value; the only way to do so is if an explicit instance argument is passed and used manually. This is in contrast to regular instance methods, where self provides implicit access to the instance's attribute namespace.

  • ✗

    They can access class variables only via cls.

    Why it's wrong here

    Static methods also lack a cls parameter, so unlike classmethods they receive no automatic reference to the class itself. To read a class variable, a static method would have to name the class explicitly (for example, MyClass.attr) rather than using a supplied cls. The statement that they can access class variables only via cls is therefore wrong because static methods do not have cls at all.

  • ✓

    They are defined using the @staticmethod decorator.

    Why this is correct

    The @staticmethod decorator is the standard and only direct way to declare a static method in Python's function-definition syntax. It wraps the function as a descriptor whose __get__ returns the plain function regardless of whether access goes through the class or an instance. Without this decorator, a function defined inside a class would be bound as an instance method and would receive self when called.

  • ✗

    They can only be defined inside a metaclass.

    Why it's wrong here

    There is no requirement that static methods live only in metaclasses; any ordinary class can contain them. Metaclasses are themselves classes and may contain static methods, but that is a special case rather than a restriction. Static methods are simply a tool for organizing functions inside any class namespace when no self or cls is needed.

About these practice questions

This PCAP question is part of Courseiva's 421-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCAP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCAP exam.