Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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

 
Greenhorn
Posts: 13
  • 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
Posts: 39235
727
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: 13
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!