# Clarification needed

Hi Team,

Question:
“How can we test if a given address (a string variable called fullAddress) can be found on a particular street (a string variable called streetName)?”

For the above question I opted for streetName.contains(fulladdress) as we are searching the fulladdress in streetname variable. Is my understanding correct? I chose the same but its wrong. Can any one explain whether my interpretation is wrong?

3 Likes

Hi Gopinath,

I think you misunderstood the question, question is like Street Address contains in Full Address, therefore answer will be fulladdress.contains(streetName).

1 Like

A street name will always be in a full address and not the other way round. Consider this example:

Full address: 222 B Baker’s Street. Now this address (which means the place this address refers to) will be found in Baker’s street, right? AND the full address contains the street name, “Baker’s Street”. Apply the same logic in your question, too.

2 Likes

@siddharth and @GopinathSiddamsetty and @Santan_Barnwal
Agree with Siddarth - streetname is always part of Fulladdress - However you need to answer from the way the question has been laid out - the question indicates given address - “found on” - particular street - which means "particular street is the super set and fulladdress is the subset.
Hence it should ideally be : streetName.contains(fulladdress)
I also got this wrong - but I am sure my answer is right - there was another question to which I had answered right and checked with the forum and found that it was right - but when I raised a ticket - they did not agree - not provide a reason as to why my answer was wrong

@maheshmurthi nope. Ideally, it should be the other way round, and that is exactly as per the way this question has been laid out.

How? Here’s how:

If a given address can be FOUND ON a particular street, it means that a certain place (with full address being the value in “fullAddress” variable) is found ON that street (its name being the value in “streetName” variable).

When you say the full address is a subset of the street, you’re only correct if you’re considering their respective areas. The place (say a house) occupies a certain area, while the street comprises of the sum total of all the areas of the houses on that street.

However, here you have the full address and the NAME of the street (not the street itself) as STRING values. Which is why, the street NAME will be a subset of the full address. The name, not the street itself.

Read my previous reply once again to better understand this.

~Sid

@siddharth
Thank you for your reply - My mistake - I simply took “ON” key word and thought something should be within something - instead of applying logic as you have mentioned

Spent some time on this - but worth it

1 Like

I agree with Gopi.

If you don’t care about the context the correct answer should be: