Sail E0 Webinar

MCQs

Total Questions : 67 | Page 4 of 7 pages
Question 31. Consider the following statement containing regular expressions
var text = "testing: 1, 2, 3";
var pattern = /d+/g;
In order to check if the pattern matches, the statement is
  1.    text==pattern
  2.    text.equals(pattern)
  3.    text.test(pattern)
  4.    pattern.test(text)
 Discuss Question
Answer: Option D. -> pattern.test(text)
Question 32. The regular expression to match any one character not between the brackets is
  1.    […]
  2.    [^]
  3.    [^…]
  4.    [D]
 Discuss Question
Answer: Option C. -> [^…]
Question 33. What does /[^(]* regular expression indicate ?
  1.    Match one or more characters that are not open paranthesis
  2.    Match zero or more characters that are open paranthesis
  3.    Match zero or more characters that are not open paranthesis
  4.    Match one or more characters that are open paranthesis
 Discuss Question
Answer: Option C. -> Match zero or more characters that are not open paranthesis
Question 34. What will be the result when non greedy repetition is used on the pattern /a+?b/ ?
  1.    Matches the letter b preceded by the fewest number of a’s possible
  2.    Matches the letter b preceded by any number of a
  3.    Matches letter a preceded by letter b, in the stack order
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> Matches the letter b preceded by the fewest number of a’s possible
Question 35. What does the subexpression /java(script)?/ result in ?
  1.    It matches “java” followed by the optional “script”
  2.    It matches “java” followed by any number of “script”
  3.    It matches “java” followed by a minimum of one “script”
  4.    None of the mentioned
 Discuss Question
Answer: Option A. -> It matches “java” followed by the optional “script”
Question 36. What is the most essential purpose of parantheses in regular expressions ?
  1.    Define pattern matching techniques
  2.    Define subpatterns within the complete pattern
  3.    Define portion of strings in the regular expression
  4.    All of the mentioned
 Discuss Question
Answer: Option B. -> Define subpatterns within the complete pattern
Question 37. The method that performs the search-and-replace operation to strings for pattern matching is
  1.    searchandreplace()
  2.    add()
  3.    edit()
  4.    replace()
 Discuss Question
Answer: Option B. -> add()
Question 38. What would be the result of the following statement in JavaScript using regular expression methods ?
  1.    Returns [“123″”456″”789”]
  2.    Returns [“123″,”456″,”789”]
  3.    Returns [1,2,3,4,5,6,7,8,9]
  4.    Throws an exception
 Discuss Question
Answer: Option B. -> Returns [“123″,”456″,”789”]
Question 39. The Crockford’s subset doesnot include which function in JavaScript?
  1.    eval()
  2.    coeval()
  3.    equal()
  4.    equivalent()
 Discuss Question
Answer: Option A. -> eval()
Question 40. Why does JavaScript subset disallow == and !=?
  1.    It uses bitwise checking
  2.    It uses === and !== instead
  3.    It uses equals() and notequals() instead
  4.    None of the mentioned
 Discuss Question
Answer: Option B. -> It uses === and !== instead

Latest Videos

Latest Test Papers