nerdexam
Oracle

1Z0-809 · Question #26

1Z0-809 Question #26: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #26. The question stem and answer options stay visible for context.

Question

public class Test { public static Connection newConnection =null; public static Connection getConnection () throws SQLException { try (Connection con = DriverManager.getConnection(URL, userName, password)) { newConnection = con; } return newConnection; } public static void main (String [] args) throws SQLException { getConnection (); Statement st = newConnection.createStatement(); st.executeUpdate("INSERT INTO student VALUES (102, 'Kelvin')"); } } Assume that:
  • The required database driver is configured in the classpath.
  • The appropriate database is accessible with the URL, username, and password exists.
  • The SQL query is valid. What is the result?

Options

  • AThe program executes successfully and the STUDENT table is updated with one record.
  • BThe program executes successfully and the STUDENT table is NOT updated with any record.
  • CA SQLException is thrown as runtime.
  • DA NullPointerException is thrown as runtime.

Unlock 1Z0-809 to see the answer

You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 1Z0-809 Practice