Question Set 6



Q19. Which regular expression is used to tell that it does not contain a digit.

A. \d
B. \D
C. $
D. ^


Q20. Which of the following is used to indicate beginning of a search.

A. [ ]
B. *
C. $
D. ^


Q21. Which regular expression is used to search any number, letter or underscore.

A. /s
B. /S
C. /w
D. /W


Q22. Consider the following section of code

var pattern1 = new RegExp("\\d");
var string = "100"


What is the value of pattern1.test(string)

A. True
B. False


Q23. Consider the following section of code

var pattern1 = new RegExp("\\d");
var string = "dark"


What is the value of pattern1.test(string)

A. True
B. False


Q24. Consider the following section of code var pattern1 = new RegExp("\d");

var string = "dark"

What is the value of pattern1.test(string)

A. True
B. False


Q25. Which of the following match the regular expression /\bcat\b/

A. My son likes cat very much.
B. This question should be in different category.
C. Tommycat is the name of my dog.
D. My son denied it categorically.


Q26. Which of the following match the regular expression /\Bcat\B/

A. I do not know what staccato means
B. Tommycat is the name of my dog.
C. This question should be in different category
D. My son likes cat very much


Q27. Consider the regular expression /big|bigger/. Which of the two alternatives is matched in the sentence “My dog is bigger than yours dog.

A. bigger
B. big


Q28. Consider the regular expression /\bJohn\b|\bJohnson\b/. Which of the two alternatives is matched in the sentence “My big brother Johnson is a great person”.

A. \bJohn\b
B. \bJohnson\b


This covers most of the javascript regular expression. In the next chapter will cover some more javascript regular expression methods before proceeding further.