Page 1 of 1

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

Posted: Tue Jul 16, 2019 9:19 am
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?

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

Posted: Tue Jul 16, 2019 10:37 am
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.

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

Posted: Thu Jun 23, 2022 10:47 am
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)

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

Posted: Thu Jun 23, 2022 11:22 am
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.