Home / CSE / Javascript - CS :: Classes and Modules

CSE :: Javascript - CS

  1. 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

  2. A.

     text==pattern

    B.

     text.equals(pattern)

    C.

     text.test(pattern)

    D.

     pattern.test(text)


  3. The regular expression to match any one character not between the brackets is

  4. A.

     […]

    B.

     [^]

    C.

     [^…]

    D.

     [D]


  5. What does /[^(]* regular expression indicate ?

  6. A.

     Match one or more characters that are not open paranthesis

    B.

     Match zero or more characters that are open paranthesis

    C.

     Match zero or more characters that are not open paranthesis

    D.

     Match one or more characters that are open paranthesis


  7. What will be the result when non greedy repetition is used on the pattern /a+?b/ ?

  8. A.

     Matches the letter b preceded by the fewest number of a’s possible

    B.

     Matches the letter b preceded by any number of a

    C.

     Matches letter a preceded by letter b, in the stack order

    D.

     None of the mentioned


  9. What does the subexpression /java(script)?/ result in ?

  10. A.

     It matches “java” followed by the optional “script”

    B.

     It matches “java” followed by any number of “script”

    C.

     It matches “java” followed by a minimum of one “script”

    D.

     None of the mentioned


  11. What is the most essential purpose of parantheses in regular expressions ?

  12. A.

     Define pattern matching techniques

    B.

     Define subpatterns within the complete pattern

    C.

     Define portion of strings in the regular expression

    D.

     All of the mentioned


  13. The method that performs the search-and-replace operation to strings for pattern matching is

  14. A.

     searchandreplace()

    B.

     add()

    C.

     edit()

    D.

     replace()


  15. What would be the result of the following statement in JavaScript using regular expression methods ?

  16. A.

     Returns [“123″”456″”789”]

    B.

     Returns [“123″,”456″,”789”]

    C.

     Returns [1,2,3,4,5,6,7,8,9]

    D.

     Throws an exception


  17. The Crockford’s subset doesnot include which function in JavaScript?

  18. A.

     eval()

    B.

     coeval()

    C.

     equal()

    D.

     equivalent()


  19. Why does JavaScript subset disallow == and !=?

  20. A.

     It uses bitwise checking

    B.

     It uses === and !== instead

    C.

     It uses equals() and notequals() instead

    D.

     None of the mentioned