Skip to content
Sharp

SQL for Java Devs · interview question

What would be a potential outcome if a ResultSet is not closed after use?

Multiple choiceMediumchapter-8-curatedpremiumsql-for-java-devsresultsets-and-mapping
Choose one answer
Answer and explanation

Correct answer

B. The database connection remains open, causing resource leaks.

Why

Not closing a ResultSet can lead to resource leaks because the database connection remains open longer than necessary. This may not immediately crash the application but can lead to performance degradation.

Test yourself on SQL for Java Devs

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

Start free test
All SQL for Java Devs questions →