Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java Programming Multiple Choice Question Which of these code lines related to t

ID: 3845810 • Letter: J

Question

Java Programming Multiple Choice Question

Which of these code lines related to the Statement-type object is true?

statement.executeUpdate("select * from employees");

statement.executeQuery("delete from employees");

statement.execute("select * from employees");

statement.executeQuery("select * from employees");

All of the above.

a.

statement.executeUpdate("select * from employees");

b.

statement.executeQuery("delete from employees");

c.

statement.execute("select * from employees");

d.

statement.executeQuery("select * from employees");

e.

All of the above.

Explanation / Answer

Option d.

-For sql statements relate to queries we use executeQuery(query_sql) method.

-For sql statements related to Updating the existing row or inserting a new row or for Deleting the row we use executeUpdate(sql) method.

- Only exceute() method is used for executing DDL statements.

- Based on the above information we can see that all the sql statements except the query sql statement, are calling the wrong execute() method.

So option d is correct.   

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote