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.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.