• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

K&B Master Exam Regex Question

 
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

Maybe I misunderstood the below question. Could you please give me your opinions.

What are true about Java Regex ? (Choose all that apply)

a) The \w metacharacter searches for whitespaces.
b) The \b metacharacter searches for numeric digits.
c) The . metacharacter searches for alphabetic characters.
d) The String [af] searches for a,b,c,d,e or f characters.

In my first attempt I chose B and C but according to MasterExam explanation the correct answer is only B.

The explanation for C as incorrect is because . metacharacter searches for any character.

I personally don't agree with this explanation. I think option C would be incorrect if it was stated in this way :

c) The . metacharacter searches only for alphabetic characters.


I'm really interested about your comments.

Thanks.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


a) The \w metacharacter searches for whitespaces.
b) The \b metacharacter searches for numeric digits.
c) The . metacharacter searches for alphabetic characters.
d) The String [af] searches for a,b,c,d,e or f characters.



I don't think any of these choices are correct. Choice B is wrong because "\b" is for matching of a word boundary.


I personally don't agree with this explanation. I think option C would be incorrect if it was stated in this way :

c) The . metacharacter searches only for alphabetic characters.



Hard call... How about this as an example? If you tell one of your programmers to look for numbers, and when he delivers the program, it doesn't work because you didn't tell him to only look for numbers...

Henry
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Henry,

Thank you so much for your prompt reply.

First of all, I've just realized that I mistyped the option B. The correct sentence is :

b) The \d metacharacter searches for numeric digits.

Sorry for that, now I think B is correct and makes sense, doesn't it ?

Henry, as I said before, maybe I misunderstood the question and what you said about tell one of my programmers to look for numbers is indeed another perspective to consider.

I'm really worried about how interpret such kind of questions in the exam. I really don't want to miss such simple question just because I mislead it.

For me, the option C has double sense. Do you have some tip or some kind of rule which could help me to decide better in the exam ?

Thanks in advance Henry.
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henry, as I said before, maybe I misunderstood the question and what you said about tell one of my programmers to look for numbers is indeed another perspective to consider.

I'm really worried about how interpret such kind of questions in the exam. I really don't want to miss such simple question just because I mislead it.

For me, the option C has double sense. Do you have some tip or some kind of rule which could help me to decide better in the exam ?

Thanks in advance Henry.



Well, I would just not worry about it... I don't think there will enough of these really subtle distinctions in questions to greatly affect your overall score -- unless you are either going for a perfect score, or believe you are borderline between passing and failing...

Another option. Just remember that you are taking a Java certification test -- and not the LSAT.

Henry
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Henry
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

I guess we'll add the word "only" to options A, B, and C. (e.g. "searches only for...")

I don't think you'll run into an issue like this on the real exam, first of all, on the real exam you'll be told how many answers are correct which, I think, would have made this question easier.

hth,

Bert
 
reply
    Bookmark Topic Watch Topic
  • New Topic