Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 154

Given the structure of the Student table:

Student (id INTEGER, name VARCHAR)

Given the records from the STUDENT table:

Given the code fragment:

Assume that:

✑ The required database driver is configured in the classpath.

✑ The appropriate database is accessible with the dbURL, userName, and passWord exists.

What is the result?

    Correct Answer: B

    The code executes a DELETE SQL statement to remove records from the Student table where the id is 103. The query is not a SELECT statement, hence the execute method will return false. The code prints out this false status. Since there are two records in the table with the id 103, both will be deleted. Therefore, the correct answer is that the program prints Status: false and two records are deleted from the Student table.

Discussion
steefaandOption: B

B is correct since execute returns true for SELECT queries and false for others.

WilsonKKerllOption: B

Answer is B.

AVB22Option: C

execute boolean execute(String sql) throws SQLException Returns:true if the first result is a ResultSetobject; false if it is an update count or there are no results

Svetleto13Option: B

B is correct.