Skip to content
Sharp

Object-oriented programming · interview question

In an e-commerce application, which class is a good candidate for immutability?

Multiple choiceEasychapter-3-curatedpremiumoopimmutability-basics
Choose one answer
Answer and explanation

Correct answer

D. A class representing a product's details.

Why

A product's details like name, description, and price are unlikely to change once created, making it a good candidate for an immutable class.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →