Home / CSE MCQs / Javascript MCQs :: javascript Lexical Structures

CSE MCQs :: Javascript MCQs

  1. The pop() method of the array does which of the following task ?
  2. A.
    decrements the total length by 1
    B.
    increments the total length by 1
    C.
    prints the first element but no effect on the length
    D.
    None of the above

  3. What is the fundamental rule of lexical scoping?
  4. A.
    Functions are declared in the scope
    B.
    Functions are executed using scope chain
    C.
    Both a and b
    D.
    None of the mentioned

  5. What will happen if a return statement does not have an associated expression?
  6. A.
    It returns the value 0
    B.
    It will throw an exception
    C.
    It returns the undefined value
    D.
    None of the mentioned

  7. Consider the following statements

    var text = "testing: 1, 2, 3"; // Sample text

    var pattern = /\d+/g // Matches all instances of one or more digits

    In order to check if the pattern matches with the string "text, the statement is
  8. A.
    text==pattern
    B.
    text.equals(pattern)
    C.
    text.test(pattern)
    D.
    pattern.test(text)

  9. For the below mentioned code snippet:

    var o = new Object();

    The equivalent statement is:
  10. A.

    var o = Object();

    B.

    var o;

    C.

    var o= new Object;

    D.

    Object o=new Object();


  11. JavaScript Code can be called by using
  12. A.
    RMI
    B.
    Triggering Event
    C.
    Preprocessor
    D.
    Function/Method

  13. One of the special feature of an interpreter in reference with the for loop is that
  14. A.
    Before each iteration, the interpreter evaluates the variable expression and assigns the name of the property
    B.
    The iterations can be infinite when an interpreter is used
    C.
    The body of the loop is executed only once
    D.
    All of the mentioned

  15. Consider the following code snippet

    function f(o) 
    {
         if (o === undefined) debugger;
    }
    What could be the task of the statement debugger?
  16. A.
    It does nothing but a simple breakpoint
    B.
    It debugs the error in that statement and restarts the statement's execution
    C.
    It is used as a keyword that debugs the entire program at once
    D.
    All of the mentioned

  17. Consider the below given syntax

    book[datatype]=assignment_value;

    In the above syntax, the datatype within the square brackets must be
  18. A.
    An integer
    B.
    A String
    C.
    An object
    D.
    None of the mentioned