About Question enthuware.ocpjp.v17.2.3750 :

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

Moderator: admin

Post Reply
i.salvadori
Posts: 5
Joined: Thu Dec 01, 2022 3:27 am
Contact:

About Question enthuware.ocpjp.v17.2.3750 :

Post by i.salvadori »

Hi,
I think there is an issue with this question.
I think the line

Code: Select all

PreparedStatement ps = con.prepareStatement("insert into department values(2, 'FINANCE', 222)",  ResultSet.TYPE_SCROLL_INSENSITIVE);
would fail to compile, since, when you pass a ResultSet Type option you should also provide a ResultSet Concurrency option.
Or am I wrong?

Thanks for the help!
Cheers,
Ilenia

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

Re: About Question enthuware.ocpjp.v17.2.3750 :

Post by admin »

You are right. Concurrency option should also be provided. Fixed.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

kabanvau
Posts: 14
Joined: Thu Nov 21, 2019 5:48 am
Contact:

Re: About Question enthuware.ocpjp.v17.2.3750 :

Post by kabanvau »

If your query doesn’t have an ORDER BY clause, you can’t reliably predict the order of your ResultSet. So it should be:

Code: Select all

select * from department ORDER BY id

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

Re: About Question enthuware.ocpjp.v17.2.3750 :

Post by admin »

It is true that order cannot be guaranteed without the order by clause in the query. However, you might see such a question in the exam where there is no "order by" clause but the output assumes a particular order when the options do not depend on the order. In this question also, all the options assume that the first row in the result will be the row with id 1 and so you can answer based on that.
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 19 guests