Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 130

Given the data of the EMP table:

Assuming that jdbcURL, username, and password are declared and initialised.

Which two happen upon execution? (Choose two.)

    Correct Answer: B, C

    Two PreparedStatement objects are created: one for the SELECT query and one for the INSERT INTO statement. Two SQL statements are executed: one SELECT statement to fetch data from the EMP table where the DEPT is HR, and UPDATE statements inside the loop to insert the fetched data into the RECRUITING table.

Discussion
ASPushkinOptions: AB

Actually two cases if the table RECRUITING exists then answer AB if it doesn't answer BC if the tabel RECRUITING exists then three sql statements executed One for select and two for update in the loop

ASPushkinOptions: BC

answer : BC C. is correct There are just two sql statements "SELECT oid, role FROM desp_roles WHERE role = ?" and "INSERT INTO RECRUITING (ID, NAME) VALUES(?, ?)" it is not clear about RECRUITING table if it doesn't exist then there is an java.sql.SQLSyntaxErrorException: Table 'kwikorder.recruiting' doesn't exist but anyway it was executed B. obviously thats right they are two prepared statements created query, update F. failed Connection and two PreparedStatements are automatically closed in tryWithResource exceptions. A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results. actually there is just one ResultSet ResultSet rs = query.executeQuery(); it executed just one timeand closed automatically after Prepatred statements D. FAILED see F

cathDevOptions: AB

two SELECT queries and one INSERT INTO statement. It creates two PreparedStatement objects: “query” for the SELECT query and “update” for the INSERT INTO statement.

d7bb0b2Options: BC

2 prepare statemt ok 2 statements are executed independently of the number of times