Python: Which statement about Abstract Base Classes vs Protocols is the strongest interview answer?

Difficulty:

Easy

Questions:

1

Time Limit:

2 minutes

Passing Score:

100%

Question

Which statement about Abstract Base Classes vs Protocols is the strongest interview answer?

  1. Abstract Base Classes vs Protocols is mostly a naming style choice and has little effect on runtime behavior or design tradeoffs.
  2. Abstract Base Classes vs Protocols exists mainly to reduce the number of files in a Python project.
  3. Abstract Base Classes vs Protocols matters only for frontend scripting and not for backend or automation code.
  4. Abstract base classes model explicit inheritance contracts, while protocols model behavior-based compatibility through structural typing.

Hint

Start with the core rule behind Abstract Base Classes vs Protocols.

Answer and rationale

Correct answer: D. Abstract base classes model explicit inheritance contracts, while protocols model behavior-based compatibility through structural typing.

Abstract base classes model explicit inheritance contracts, while protocols model behavior-based compatibility through structural typing. This is the base concept interviewers commonly test first.

Track: Python