Question: What statements about the following method are correct? (Choose three.) A. It protects against a denial of service attack. B. It does not protect against

What statements about the following method are correct? (Choose three.) 

public String checkAlarm (String connectionStr, boolean alarmed) throws SQLException { var query=

A. It protects against a denial of service attack.

B. It does not protect against denial of service attacks.

C. It protects against SQL injection.

D. It does not protect against SQL injection because it does not use a PreparedStatement.

E. Even if the method completes without throwing an exception, a resource leak might occur.

F. If the method completes without throwing an exception, then no resource leak can occur.

public String checkAlarm (String connectionStr, boolean alarmed) throws SQLException { var query= "SELECT FROM office WHERE alarmed = true"; var con = Driver Manager.getConnection (connectionStr); var stmt = con.createStatement (); try (con; stmt; var rs = stmt.executeQuery (query)) { return rs.next() ? rs.getString("address"): null; } }

Step by Step Solution

3.24 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

From the code snippet provided we can make the following assessments B It does not protect against d... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Oracle Questions!