T. Sharma wrote:
Devaney Marcondes wrote:
I will correct myself but the book answer is still incorrect.
The correct answer is C.
The book explanation say:
Answer: B. “b\ D\ w*@\ w +\. com\ b” (“\ b” is used to mark word boundaries,
“\ D” is used to match any non-digit number, and “\ w*”
is used to match any word of length zero or more.
The remaining part is similar to that used earlier.)
For this reason \w* is wrong because if the email is "@notaemail.com" the regex “b\ D\ w*@\ w+\. com\ b” will accept it.
The right regex is “b\ D\w+@\ w +\. com\ b” (with the plus before @).
Dear Devanev, with due respect I think your explanation is not correct. You are missing "\D" which is used in this question to satisfy the requirement of the question that the email address must not start with a digit. Thus, the regex will not match to "@notaemail.com" because the regex looks for a not digit (due to "\D") which is missing. Since, "\D" is already used, there should be "\w*" (and not "\w+") to make the expression correct; otherwise it will not match to addresses like "a@notaemail.com". I hope it will help.
You are right about the typo, we will include that in our errata doc. Thanks for that.
Devaney Marcondes wrote:In my opinion the question 5 of the chapter 7 have 2 correct answer.
The B and C are correct.
Jose Ricardo Santos wrote:
About the practical exam (Appendix H) don't you think that:
Question 13 - If the continue statement is allowed in switch statement then the break is also (as well the continue) in all conditional statements. After all, since the conditional statement is inside a loop, you can have a break or continue statement. Don't you agree?
Roel De Nijs wrote:If you try to cast between different inheritance trees (like casting a String to an Integer or your example) you'll get a compiler error. If you perform a wrong casting in the same inheritance tree, you'll get a runtime exception (e.g. casting an object to a String)
Deepak Lal wrote:what is the answer given to this question and the reason please ?
According to me the answer is C. Code obfuscation.Please correct me If im wrong.
Roel De Nijs wrote:
Devaney Marcondes wrote:Experts, what do you think?
D is the correct answer, all methods are valid overloads of the given method.
Why do you think only C is a valid overload? What are the rules for a valid overload?
Roel De Nijs wrote:
As a side note: These explanations are very weird. It seems that they should belong to another question, because this question has nothing to do with inheritance, but (based on A & B) with (in)valid implementations of an interface.