Skip to content
Sharp

Exceptions · interview question

What exception type should you throw when encountering a database connection error in an e-commerce application?

Multiple choiceEasychapter-6-curatedpremiumexceptionscause-chaining-and-error-context
Choose one answer
Answer and explanation

Correct answer

D. SQLException

Why

SQLException is the appropriate type to throw for database connection errors, as it specifically addresses issues related to SQL operations.

Test yourself on Exceptions

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

Start free test
All Exceptions questions →