I believe that there is a mistake in this review question. It reads as follows:
Suppose there are two rows in the table before this code is run, and executeUpdate() runs without error. How many rows are in the table after the code completes?
C. The code does not compile.
D. The code throws an exception.
The solution claims that the answer is:
B. The first line enables autocommit mode. This is the default and means to commit immediately after each update. When the rollback() runs, there are no uncommitted statements, so there is nothing to roll back. This gives us the initial two rows in addition to the inserted one making option B correct. If setAutoCommit(false) were called, option A would be the answer. The ResultSet types are just there to mislead you. Any types are valid for executeUpdate() since no ResultSet is involved.
SQLException - if a database access error occurs, this method is called while participating in a distributed transaction, this method is called on a closed connection or this Connection object is in auto-commit mode
As the Connection in the example is in auto-commit mode when rollback is called, any compliant implementation should throw an SQLException, meaning D should be the correct answer, no?