Home / CSE MCQs / Javascript MCQs :: Javascript Classes and Modules

CSE MCQs :: Javascript MCQs

  1. Which are usually variables that are used internally in object methods and also are globally visible variables?
  2. A.
    Object properties
    B.
    Variable properties
    C.
    Method properties
    D.
    Internal properties

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. The basic difference between JavaScript and Java is
  4. A.
    There is no difference
    B.
    Functions are considered as fields
    C.
    Variables are specific
    D.
    functions are values, and there is no hard distinction between methods and fields

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. When a class B can extend another class A, we say that
  6. A.
    A is the superclass and B is the subclass
    B.
    B is the superclass and A is the subclass
    C.
    Both A and B are the superclass
    D.
    Both A and B are the subclass

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Consider the following code snippet

    console.log(p)

    If p is not defined, what would be the result or type of error?
  8. A.
    Zero
    B.
    Null
    C.
    ReferenceError
    D.
    ValueNotFoundError

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Why was "The Good Parts designed as a language subset in JavaScript?
  10. A.
    To improve programmer flexibility
    B.
    To balance the work load of the programmer
    C.
    To create an in-built compiler and interpreter
    D.
    To improve programmer productivity

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Which are the two functions that are not allowed in any secure subset?
  12. A.
    evaluate() and restrict()
    B.
    eval() and the Function() constructor
    C.
    debugger() and test()
    D.
    eval() and debugger()

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. To define each of the set classes as a property of the sets object (namespace) for the module, the statement is
  14. A.
    sets = sets.AbstractEnumerableSet.extend();
    B.
    sets.SingletonSet = sets.AbstractEnumerableSet.extend(...);
    C.
    sets.SingletonSet = sets.extend(...);
    D.
    sets = sets.extend(...);

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. 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
  16. A.
    text==pattern
    B.
    text.equals(pattern)
    C.
    text.equals(pattern)
    D.
    pattern.test(text)

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. What will be the reaction when a catch clause has no conditionals ?
  18. A.
    Takes it to be 0
    B.
    Takes it to be 1
    C.
    Takes it to be true
    D.
    Takes it to be false

    View Answer

    Workspace

    Discuss Discuss in Forum