Skip to content
Sharp

Spring Core · interview question

In Spring Boot, why is it recommended to use DTOs when communicating between the service layer and controllers?

Multiple choiceEasychapter-9-curatedpremiumspring-coredtos-and-entities
Choose one answer
Answer and explanation

Correct answer

C. To separate API from the internal data model.

Why

DTOs help in separating the API representation from the internal data models, which allows for easier modifications and maintenance without affecting the client-facing API.

Test yourself on Spring Core

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

Start free test
All Spring Core questions →