aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Whizlabs question... their explanations seems weird to me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Whizlabs question... their explanations seems weird to me" Watch "Whizlabs question... their explanations seems weird to me" New topic
Author

Whizlabs question... their explanations seems weird to me

Aj Deschanel
Ranch Hand

Joined: Oct 20, 2009
Posts: 40
QUESTION

Options:
a) Compiler error
b) Runtime exception
c) Prints "Match not found"
d) Prints "Match found"

My comment:
I answered "Match not found", which is correct, but their explanation seems a little bit strange to me.

WHIZLABS EXPLANATION
The find method scans the input sequence looking for the next sequence that matches the pattern. Since the starting letter of "Water" is in uppercase, it does not match with "water". So the find method returns false and "Match not found" is printed out. So choice C is incorrect.


My comment:
Even if we change the uppercase "W" to a lowercase "w" this will still print option C, because the longer string is the pattern, in order to have option D, we also need to switch the strings, the pattern should go to input, and vice versa.

What do you think guys ?!

By the way, how is WHIZLABS, does it make sense to pay attention to their mocks for exam preparation ?!


SCJP 1.6, SCWCD 1.5
Srikkanth Mohanasundaram
Ranch Hand

Joined: Feb 07, 2007
Posts: 185
Hello!! Welcome to Ranch!!!

You are right

Thanks,
Srikkanth
Aj Deschanel
Ranch Hand

Joined: Oct 20, 2009
Posts: 40
Srikkanth Mohanasundaram wrote:Hello!! Welcome to Ranch!!!

Thanks.
Atwal Usha
Ranch Hand

Joined: Sep 10, 2009
Posts: 137
Hi Aj,

Thank you for bringing this into our notice. After reading your post due action has been taken on this particular question by the content team and we really appreciate your inputs.

The output has nothing to do with the case of the first letter of the string "water" even if it is changed to "Water" the output will result the same and which is Match not Found.

However, if the code is changed to the following then changing "water" to "Water" will change the output to Match Found.



Java Certification Exam Mock Tests: SCJA  SCJP 5  SCJP 6  SCJP 6 (Online Training)  SCJP 6 (Instructor Led Training)   SCWCD 5   SCBCD 5  SCEA 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Whizlabs question... their explanations seems weird to me