Java OCA OCP Practice Question 2072

Question

Suppose the ResultSet is scrollable and contains 10 rows.

How many times does the following print true?.

16:  System.out.println(rs.absolute(-2)); 
17:  System.out.println(rs.relative(-1)); 
18:  System.out.println(rs.beforeFirst()); 
19:  System.out.println(rs.relative(5)); 
  • A. Two
  • B. Three
  • C. Four
  • D. None of the above


D.

Note

Line 18 doesn't compile because beforeFirst() has a void return type.

Since the code doesn't compile, it doesn't print true at all, and Option D is correct.

If line 18 called rs.beforeFirst() without trying to print the result, Option B would be the answer.

All the other statements are valid and return true.




PreviousNext

Related