Win a copy of Spring in Action (5th edition) this week in the Spring 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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

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
Posts: 38906
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
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.
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
Download Free Java APIs to Work with Office Files and PDF
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!