1z0-809 Exam QuestionsBrowse all questions from this exam

1z0-809 Exam - Question 197


Given the EMPLOYEE table:

Given the code fragment:

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

Show Answer
Correct Answer: CD

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

7 comments
Sign in to comment
fffffOption: C
Feb 11, 2021

102, peter is printed, tested

DmitryKOption: A
Mar 16, 2021

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

WilsonKKerllOption: C
Mar 21, 2022

Answer is C.

WilsonKKerllOption: D
Apr 13, 2022

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

duydnOption: D
Sep 22, 2023

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

iSnoverOption: C
Feb 7, 2024

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

DarGrinOption: C
Jun 6, 2024

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