Courseiva
Object-Oriented ProgrammingeasyMultiple SelectObjective-mapped

PCAP Object-Oriented Programming Practice Question

Which TWO of the following are special methods in Python?

⚠ Common exam trap

Python Institute often tests the distinction between actual special methods (like `__init__` and `__str__`) and arbitrary dunder-named attributes that are not part of Python's language specification, leading candidates to mistakenly think any name with double underscores is a special method.

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

`__init__`

`__init__` is a predefined special method in Python used as a constructor to initialize an object's state when an instance of a class is created. It is automatically invoked by the Python runtime upon object instantiation, making it a core part of the object-oriented programming model in Python.

Answer analysis

Option-by-option breakdown

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

  • `__bar__`

    Why it's wrong here

    This is not a predefined special method in Python.

  • `__main__`

    Why it's wrong here

    `__main__` is the name of the top-level script environment, not a method.

  • `__init__`

    Why this is correct

    This is the instance initializer method.

  • `__str__`

    Why this is correct

    This defines the informal string representation of an object.

  • `__foo__`

    Why it's wrong here

    This is not a predefined special method in Python.

About these practice questions

One of 169 original PCAP practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.