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

Given the EMPLOYEE table:

Given the code fragment:

Assuming the database supports scrolling and updating, what is the result?

    Correct Answer: C

    The code uses rs.absolute(-2) to move the cursor to the next to last row, which is Employee Id: 102, Employee Name: Peter. This does not impact the insertion of new data. The subsequent call to rs.insertRow() inserts the new record (104, Michael) into the result set. However, the cursor doesn't move to this new row immediately. The call to rs.moveToCurrentRow() returns the cursor to its state before the insertion, which was positioned at Employee Id: 102, Employee Name: Peter. Therefore, the output will display the current row where the cursor is positioned, which is Employee Id: 102, Employee Name: Peter.

Discussion
fffffOption: C

102, peter is printed, tested

WilsonKKerllOption: C

Answer is C.

DmitryKOption: A

calling the method absolute(-2)moves the cursor to the next-to-last row

DarGrinOption: C

Employee Id: 102, Employee Name: Peter is displayed.

iSnoverOption: C

Answer is C, new record is inserted and Employee Id: 104, Employee Name: Peter is displayed.

duydnOption: D

moveToCurrentRow() -> the newest row that we inserted https://docs.oracle.com/javase%2F7%2Fdocs%2Fapi%2F%2F/java/sql/ResultSet.html

WilsonKKerllOption: D

A new record is inserted and Employee Id: 104, Employee Name: Peter is displayed.