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

Given the information: Emp table has 10 records.

Given the code fragment:

Which code fragment, inserted at Line n1, helps you determine the number of records in ResultSet?

    Correct Answer: B

    The correct way to determine the number of records in a ResultSet is to iterate through the ResultSet and count the rows. The provided code fragment `int totRows=0; while(rs.next()){ totRows++; }` correctly iterates through the ResultSet, counting each row, and thus provides the accurate count of records. Methods like `getRowCount()` or `getRowId()` are not defined for ResultSetMetaData or ResultSet in this context, making them incorrect for this purpose.

Discussion
jduarteOption: B

Answer B. Tested

DmitryKOption: B

getRowCount() is undefined for the type ResultSetMetaData Ans. B

petetsai

also undefined for the type ResultSet

steefaandOption: B

B is correct.

duydnOption: B

B is correct