Skip to content
Sharp

Classes and Objects · interview question

What is the healthiest performance judgment around when to use a class?

Multiple choiceMediumchapter-7-curatedpremiumclasses-and-objectswhen-to-use-a-class
python
order = {"id": "ORD-1", "subtotal": 49.99}
print(order["id"])
Choose one answer
Answer and explanation

Correct answer

D. Measure before optimizing, then change the part that actually dominates cost instead of guessing from style alone.

Why

Premature optimization is usually weaker than targeted optimization backed by measurement.

Test yourself on Classes and Objects

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

Start free test
All Classes and Objects questions →