Question 156

Given the structure of the STUDENT table:
Student (id INTEGER, name VARCHAR)
Given:
public class Test {
static Connection newConnection =null;
public static Connection get DBConnection () throws SQLException {
try (Connection con = DriveManager.getConnection(URL, username,
password)) {
newConnection = con;
}
return newConnection;
}
public static void main (String [] args) throws SQLException {
get DBConnection ();
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?
  • Question 157

    Given the code fragment:

    Which code fragment, when inserted at line n1, enables the code to print /First.txt?
  • Question 158

    Given the code fragment:

    Which code fragment, when inserted at line 7, enables printing 100?
  • Question 159

    Given:

    What is the result?
  • Question 160

    Given the content of Operator.java, EngineOperator.java, and Engine.java files:

    and the code fragment:

    What is the result?