About Question enthuware.ocpjp.v7.2.1350 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
vijayanand
Posts: 10
Joined: Fri Sep 26, 2014 8:40 am
Contact:

About Question enthuware.ocpjp.v7.2.1350 :

Post by vijayanand »

Since column indexing starts with 1, rsmd.getColumnName(0) will cause an exception

System.out.print(rsmd.getColumnName(i)+" = "+rs.getObject(i+1)+", ");

Instead rs.getObject(i+1), shouldn't it be Instead rs.getObject(i+1) when i starts from 1

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1350 :

Post by admin »

Yes, that is why option 1 is correct. If you start i with 0, you need to do i+1, if you start i with 1, you can use i.
-Paul.
If you like our products and services, please help us by posting your review here.

cnh57811
Posts: 3
Joined: Sun Jul 06, 2014 8:17 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1350 :

Post by cnh57811 »

The DriverManager.getConnection() method throws SQLException and this is not handled nor thrown in this example. In other examples, where this method has not been inside of a try block, a note has been present that says something like, "Assume all try/catch blocks are valid." Without this note, the testee cannot assume proper try/catch blocks are in place...and therefore, the code would not compile.

I think that note should be added to this question as well.

Thanks,
Chris

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1350 :

Post by admin »

This statement is given only where the code shown is complete or almost complete. Where the code is clearly incomplete, you can assume that the exception is handled appropriately.
This is how it is in the real exam as well.
If you like our products and services, please help us by posting your review here.

cnh57811
Posts: 3
Joined: Sun Jul 06, 2014 8:17 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1350 :

Post by cnh57811 »

I'll keep that in mind. Thanks for the info!

Chris_All
Posts: 1
Joined: Thu Jun 08, 2017 1:39 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1350 :

Post by Chris_All »

Hi,
I can't agree with admin explanation that we can assume that all exceptions are handled when code looks as not complete. This question could test us that we know that establishing connection requires to handle exception. It is not clear also as well as the one of potential response is "It will not compile".
What do you think about my doubts?

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1350 :

Post by admin »

Oracle has clearly mentioned it in its guidelines for the exams. You may check out the official exam details from Oracle.
Code fragments: A code fragment is a small section of source code that is presented without its context. Assume that all necessary supporting code exists and that the supporting environment fully supports the correct compilation and execution of the code shown and its omitted environment.
If you like our products and services, please help us by posting your review here.

UncleF
Posts: 11
Joined: Wed Jun 14, 2017 3:43 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1350 :

Post by UncleF »

Using ResultSetMetaData is not in OCP 8 1Z0-809 exam objectives:
"Building Database Applications with JDBC

Describe the interfaces that make up the core of the JDBC API including the Driver, Connection, Statement, and ResultSet interfaces and their relationship to provider implementations
Identify the components required to connect to a database using the DriverManager class including the JDBC URL
Submit queries and read results from the database including creating statements, returning result sets, iterating trough the results, and properly closing result sets, statements, and connections"

It was an interesting topic, but there are a lot of interesting topics which are not on the exam.
We have to keep to objectives.

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1350 :

Post by admin »

Yes, it is not explicitly mentioned in the OCPJP 8 objectives. However, a few candidates got a question similar to this and 2.1347 in the real exam. That is why we have kept these two questions in the question bank.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 57 guests