Answer to Questions on Chapter 1 Set 1 to 6



Answers


Click on the question to see explanation of the answer with working example.

Q1. A
Q2. B
Q3. B & C
Q4. A & C
Q5. B & C
Q6. A & D
Q7. A
Q8. A
Q9. A
Q10. B
Q11. D
Q12. B
Q13. B
Q14. A & B
Q15. C
Q16. A
Q17. C
Q18. C
Q19. B
Q20. D
Q21. C
Q22 .A
Q23. B
Q24. A
Q25. A
Q26. A
Q27. B
Q28. B

Explanation to selected questions



Q25. \b matches the boundary between a word and a non word /\bcat\b/. In the word category, it matches the beginning but not the end. In the word Tommycat, it matches the end but not the beginning.

Q26. \B matches all places where there is no boundary between word and non word. Tommycat satisfies this condition at the beginning of cat but not in the end. The word category satisfies it in the end but not in the beginning. In the sentence "My son likes cat very much", it satisfies the condition, neither at the beginning nor at the end.

Q27. The regular expression engine stops as soon as it finds the first alternative. It does not check for the second alternative.

Q28. Note that \bJohn\b does not get matched because we have placed the word boundary and therefore the right part is not matched.