Courseiva
Advanced Object Oriented ProgrammingmediumMultiple ChoiceObjective-mapped

PCPP1 Advanced Object Oriented Programming Practice Question

When overriding the __getattr__ method, what must you be careful to avoid?

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

Infinite recursion by accessing non-existent attributes.

Infinite recursion occurs if you try to access an attribute inside __getattr__ that does not exist, triggering __getattr__ again.

Answer analysis

Option-by-option breakdown

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

  • Infinite recursion by accessing non-existent attributes.

    Why this is correct

    Always use super() or direct dictionary access to avoid the cycle.

  • Raising AttributeError.

    Why it's wrong here

    Raising AttributeError is the correct way to signal an attribute is missing.

  • Accessing class attributes.

    Why it's wrong here

    Class attributes are accessed via the class dict, not instance lookup.

  • Calling super().__getattr__.

    Why it's wrong here

    Object does not have a default __getattr__.

About these practice questions

One of 209 original PCPP1 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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed August 2026 · checked against the official Python Institute exam blueprint

This PCPP1 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 PCPP1 exam.