File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Mock Exam Errata and the fly likes ExamLab, final test, question 6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "ExamLab, final test, question 6" Watch "ExamLab, final test, question 6" New topic
Author

ExamLab, final test, question 6

Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Hi Ranchers!

I've just finished the final test from ExamLab (priceless software!) and bumped into this one. It's purpose is to put the elements into the code so that it is compile-free and runs without exceptions. My answer was marked as wrong because of the type result of DateFormat.parse(...). I've insert Object and in the solution there was a Date (check the attached image).

I've put this code into Eclipse, compiled, execute and either solution is in my opinion right - no compile time errors and no runtime exceptions.

My question is - in real exam (in drag and drops), is there EXACTLY only one right solution for the given task?

Thanks in advance for all replies. I'm going to take the OCPJP 6 exam on Friday (24.09.2010).

Cheers!


[Thumbnail for Screenshot-2.png]



OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
Martin Vanyavchich
Ranch Hand

Joined: Sep 16, 2008
Posts: 241
I think the answers should be as specific as possible. Object is wider than Date.


SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
Harpreet Singh janda
Ranch Hand

Joined: Jan 14, 2010
Posts: 317

Martin Vanyavchich is right. Asnwer should be more specific.

But in the exam the questions will not be tricky.
Gari Jain
Ranch Hand

Joined: Jun 29, 2009
Posts: 100
The object returned over here is a Date object and it got implicitly typecasted to Object when you collected it in a Object reference. and now you cannot use the date object returned unless you type-cast it again.

if instead of DateFormat.parse(..), it was keySet() and you collect it in an Object, it would still compile:




but then you would have to typecast it again to Set, to retrieve the Set object from it, without explicit cast object 'o' is not of any use.


So, There can be more than one answers for drag and drop questions, but in your question, it should be collected in Date object only


OCPJP 6-100%; Preparing for GATE11
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

In my opinion it just lacks of some information or exemplary usage of the "x" object at the last line of "main" method, just like, i.e. x.getTime() which would prevent from such a problems.

I understand that the o type reference needs to be downcasted to the java.lang.Date object if you want to use it this way, BUT it wasn't the purpose of this task. There is no usage of the "x" in code. The purpose was just to make the code compile and run.


It's just the first time I see a D&D with multiple valid solutions, therefore I wanted to know if this situation can happen on the real exam.

I will follow the Martin Vanyavchich's "answers should be as specific as possible" advice, but I still think the code template it should be more precise... But then again, maybe I'm just too suspicious after having too much ExamLab questions? :-))

Thanks guys for your time!

Cheers!
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3218
    
  49

Pedro,
This, of course, is an error - I'll correct this with the next upgrade. Thanks for the heads up.

Pedro Kowalski wrote:My question is - in real exam (in drag and drops), is there EXACTLY only one right solution for the given task?

No - there could be multiple correct solutions. But, marks will be given for any correct solution.

I'm moving this to mock exam errata forum.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Thanks Devaka.

BTW: Nice to meet the author of such a great learning platform which is available free - chapeau bas my friend! :-)

If it might help, I've bumped into one other thing in mock test nr 3, question 60.

Despite some error with layout (don't know if it's fault of my particular installation or is it a global error), after finishing the exam I've copied the program to the notepad and tried to analyze it. I think the answer should be C rather than B, which is "false", as that's the result of the code execution and also that's what the explanation tells us:

This return boolean value (false) (....) will be printed by the statement System.out.print(ob);


Cheers!


[Thumbnail for Screenshot.png]

Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3218
    
  49

Thanks Pedro,

I checked this with the current database, and this error was already resolved. I don't remember when I corrected that, though.
The layout problem is not only for you. The next upgrade will be soon available with a fix for that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ExamLab, final test, question 6