About Question enthuware.ocpjp.ii.v11.2.3301 :

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

Moderator: admin

Post Reply
BinSlayer
Posts: 10
Joined: Tue Jul 09, 2019 8:33 am
Contact:

About Question enthuware.ocpjp.ii.v11.2.3301 :

Post by BinSlayer »

Hi
The correct choice is wrong. There is no way that "both the lines marked //1 and //2 will cause an exception at run time."
because an exception at line 1 will stop the code execution flow and line 2 will never be reached.
The right option is: "Line marked //1 will cause an exception at run time." in my opinion.
What do you think? Am I missing something?

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

Re: About Question enthuware.ocpjp.ii.v11.2.3301 :

Post by admin »

You are logically correct but that is not how the exam question/options are interpreted. If an option raises the possibility of an error/exception on multiple lines then it expects you to check all the lines and see if they are valid or not individually also assuming the previous line causing an exception is not there or is fixed. That is why, in this case, option 6 is the best option.
If you like our products and services, please help us by posting your review here.

Riccardomz
Posts: 4
Joined: Sun May 15, 2022 10:18 am
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.3301 :

Post by Riccardomz »

I agree with @BinSlayer.
The point here is that the text of the question is clear, so wording should be improved because option E is correct and option F is not:
What will the following code print when compiled and run?
The correct answer is:
Line marked //1 will cause an exception at run time.
When you compile and run this code in fact, line marked //1 will cause an exception.
This answer is 100% correct,
F answer is not because line marked //2 will never be reached by the RE in execution.

If you want to keep the text of the problem as is, I suggest to modify the answers like this:

E - Only line marked //1 could cause an exception at runtime if reached in execution
F - Both lines marked //1 and //2 can cause an exception at runtime if reached in execution

Another possibility if you don't want to change the answers is to change the text like this:
What will the following code print when compiled and run? (Assume that any exception thrown is handled and does not prevent reaching the next line)

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

Re: About Question enthuware.ocpjp.ii.v11.2.3301 :

Post by admin »

Again, you will find the real exam questions worded similarly. Our job is to help candidates pass the exam and as a part of that we need to make sure the candidate is aware of how real exam questions are worded and how they are to be interpreted.
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 4 guests