These questions are from "OCA/OCP Java SE Programmer Practice Tests" (J.Boyarsky & S.Selikoff) book, Chapter 23 OCP Practice Exam:
Question 44. Given an updatable ResultSet that contains the following and this code, what does the code snippet output?
C. The code does not compile.
D. The code compiles but throws an exception at runtime.
In this question it isn't written that ResultSet is scrollable, says only updatable. If ResulSet is not scrollable the correct answer should be D, but the correct answer is A. Maybe "scrollable" was forgotten to be added.
Question 45. Which statements describe a java.io stream class and cannot be applied to a java.util.stream.Stream class? (Choose three.)
A. Can be used with try-with-resources statement
B. Includes a class or set of classes used solely for working with character data
C. Requires all data objects to implement Serializable
D. Some classes contain a flush() method.
E. Some classes contain a method to skip over data.
F. Some classes contain a method to sort the data.
Option A is shown as one of the correct answers in book and explanation says that:
Option A is correct because the java.io stream classes implement Closeable and can be used with try-with-resources statements, while java.util.stream.Stream does not implement Closeable.
But Stream class implements AutoClosable indirectly and can be used with try-with-resources statements.