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?
About Question enthuware.ocpjp.ii.v11.2.3301 :
Moderator: admin
-
- Posts: 10
- Joined: Tue Jul 09, 2019 8:33 am
- Contact:
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3301 :
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.
-
- Posts: 4
- Joined: Sun May 15, 2022 10:18 am
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3301 :
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:
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:
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:
The correct answer is:What will the following code print when compiled and run?
When you compile and run this code in fact, line marked //1 will cause an exception.Line marked //1 will cause an exception at run time.
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)
-
- Site Admin
- Posts: 10055
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.3301 :
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.
Who is online
Users browsing this forum: No registered users and 42 guests