Skip to content
Sharp

Classes and Objects · interview question

A bug appears around dataclass basics. What is the strongest first debugging move?

Multiple choiceEasychapter-7-curatedpremiumclasses-and-objectsdataclass-basics
python
from dataclasses import dataclass

@dataclass
class OrderLine:
    sku: str
    quantity: int
Choose one answer
Answer and explanation

Correct answer

A. Trace one concrete example, inspect the state transitions, and compare them to the intended rule before rewriting anything.

Why

That approach is reliable because it creates evidence. Avoiding dataclasses out of habit can leave beginner Python modeling more verbose than necessary.

Test yourself on Classes and Objects

A free test with instant, explained results. No account needed.

Start free test
All Classes and Objects questions →