• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide Chapter 10 Question 19  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In a table animal with 10 rows, how many times does true get output by the following? (Choose all that apply.)


A. One
B. Two
C. Three
D. Four
E. Five
F. The code does not compile.
G. A SQLException is thrown.



The book says answer C is the correct answer.

One could argue that it doesn't compile, because there's no closing }.

Anyway, could G also be a correct answer? When the driver doesn't support TYPE_SCROLL_INSENSITIVE and it downgrades to TYPE_FORWARD_ONLY, then rs.absolute(0) would throw a SQLException, right?
Or when Derby isn't on the classpath.
Or when the connection to the database suddenly drops.
 
author & internet detective
Sheriff
Posts: 38569
656
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frenkel,
Sorry for the delayed response.

The exam says that if you see a code snippet, you have to assume the surrounding code is right. So the missing } can be assumed.

G is more interesting. The exam lives in a perfect world. Drivers are always available and connections don't drop. (Although to be fair, an embedded database connection isn't getting a network error). Unless it is mentioned, you should assume the driver supports the required operation as well. But yes, G would happen in that scenario.

I mention this because real life JDBC experience actually makes this part of the exam harder. It was my "weakest" exam section even thought I've done plenty with JDBC> I had trouble thinking in that perfect world way. And I'm sure you saw our rant about that at the beginning of the chapter!
 
Frenkel Smeijers
Greenhorn
Posts: 8
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:The exam lives in a perfect world.



Otherwise you could get an OutOfMemoryError on every statement in every question. That would make the exam very tedious.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!