Multiple choice technology security

Choose the correct answer: ... Statement stmt = conn.createStatement (); ResultSet rs = stmt.executeQuery (); stmt.close (); conn.close(); ...

  1. Code is vulnerable as Resource is not released in the “finally” block

  2. Code is vulnerable as Resource is not released at all

  3. Code has no vulnerability

  4. Option 1 AND Option 2

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

If an exception occurs before close() calls, resources leak. Proper Java resource management requires finally blocks or try-with-resources to guarantee cleanup regardless of exceptions.