Question #37: Which of the following text represent the regular expression
[A-Z][a-z]*[ ][A-Z][A-Z]?
Options:
A) Bangalore KR
B) Palo Alto CA
C) New Delhi
D) NDLS
Solution:
The above mentioned regular expression says that first word should start with a capital letter, then it is followed by a space and then the last word only has two capital letters. Only A option satisfies these constraints. This regular expression is usually used to represent city name followed by state name. Hence, the correct answer is A.