Java OCA OCP Practice Question 2910

Question

Which of the options can fill in the blanks in order to make the code compile?

boolean bool = stmt.               (sql); 
int num = stmt.               (sql); 
ResultSet rs = stmt.                (sql); 
A.   execute, executeQuery, executeUpdate
B.   execute, executeUpdate, executeQuery
C.   executeQuery, execute, executeUpdate
D.   executeQuery, executeUpdate, execute
E.   executeUpdate, execute, executeQuery
F.   executeUpdate, executeQuery, execute


B.

Note

The first line has a return type of boolean because any type of SQL statement can be run, making it an execute() call.

The second line returns the number of modified rows, making it an executeUpdate() call.

The third line returns the results of a query, making it an executeQuery() call.




PreviousNext

Related