Classes And Modules Questions MCQs


classes and modules Questions

Total Questions : 67

Page 1 of 4 pages
Question 1. The behaviour of the instances present of a class inside a method is defined by
  1.    Method
  2.    Classes
  3.    Interfaces
  4.    Classes and Interfaces
Answer: Option B
Question 2. Consider the following code snippet :
var o = new F();
o.constructor === F
The output would be :
  1.    false
  2.    true
  3.    0
  4.    1
Answer: Option B
Question 3. The keyword or the property that you use to refer to an object through which they were invoked is
  1.    from
  2.    to
  3.    this
  4.    object
Answer: Option C
Question 4. The meaning for Augmenting classes is that
  1.    objects inherit prototype properties even in dynamic state
  2.    objects inherit prototype properties only in dynamic state
  3.    objects inherit prototype properties in static state
  4.    None of the mentioned
Answer: Option A
Question 5. The basic difference between JavaScript and Java is
  1.    There is no difference
  2.    Functions are considered as fields
  3.    Variables are specific
  4.    Functions are values, and there is no hard distinction between methods and fields
Answer: Option D
Question 6. The property of JSON() method is:
  1.    it can be invoked manually as object.JSON()
  2.    it will be automatically invoked by the compiler
  3.    it is invoked automatically by the JSON.stringify() method
  4.    it cannot be invoked in any form
Answer: Option C
Question 7. If A is the superclass and B is the subclass, then subclass inherting the superclass can be represented as
  1.    B=inherit(A);
  2.    B=A.inherit();
  3.    B.prototype=inherit(A);
  4.    B.prototype=inherit(A.prototype);
Answer: Option C
Question 8. The snippet that filters the filtered set is
  1.    var t=new FilteredSet(s, {function(s) {return !(x instanceof Set);});
  2.    var t=new FilteredSet{function(s) {return !(x instanceof Set);});
  3.    var t=new FilteredSet(s, {function(s) {return (x instanceof Set);});
  4.    var t=new FilteredSet(s, {function(s) {return x;});
Answer: Option A
Question 9. When a class B can extend another class A, we say that
  1.    A is the superclass and B is the subclass
  2.    B is the superclass and A is the subclass
  3.    Both A and B are the superclass
  4.    Both A and B are the subclass
Answer: Option A
Question 10. The method that can be used to create new properties and also to modify the attributes of existing properties is
  1.    Object.defineProperty()
  2.    Object.defineProperties()
  3.    Both Object.defineProperty() and Object.defineProperties()
  4.    None of the mentioned
Answer: Option C
Question 11. The four kinds of class members are
  1.    Instance methods, Instance fields, Static method, Dynamic method
  2.    Instance fields, Instance methods, Class fields, Class methods
  3.    Instance fields, Non-instance fields, Dynamic methods, Global methods
  4.    Global methods, Local methods, Dynamic methods, Static methods
Answer: Option B
Question 12. The object whose properties are inherited by all instances of the class, and properties whose values are functions behaving like instance methods of the class, is
  1.    Instance object
  2.    Constructor object
  3.    Destructor object
  4.    Prototype object
Answer: Option D
Question 13. The properties of the objects act like different kinds of class members. They are
  1.    Public object, Private object, Protected object
  2.    Constructor object, Function object, Destructor object
  3.    Constructor object, Prototype object, Instance object
  4.    Instance method, Static object, Dynamic object
Answer: Option C
Question 14. The class that represents the regular expressions is
  1.    RegExpObj
  2.    RegExpClass
  3.    RegExp
  4.    StringExp
Answer: Option C
Question 15. Which are usually variables that are used internally in object methods and also are globally visible variables?
  1.    Object properties
  2.    Variable properties
  3.    Method properties
  4.    Internal properties
Answer: Option B
Question 16. Which is the correct code that returns a complex number that is the complex conjugate of this one?
  1.    Complex.prototype.conj = function() { return new Complex(this.r, -this.i); };
  2.    Complex.prototype.conj = function() { return Complex(this.r, -this.i); };
  3.    Complex.prototype.conj = function() { return (this.r, -this.i); };
  4.    Complex.prototype.conj = function() { new Complex(this.r, -this.i); };
Answer: Option A
Question 17. How can we make methods available on all objects?
  1.    Object.add(methods)
  2.    Object.methods(add)
  3.    Object.add.methods(…)
  4.    Object.prototype
Answer: Option D
Question 18. What is the procedure to add methods to HTMLElement so that they will be inherited by the objects that represent the HTML tags in the current document?
  1.    HTMLElement.prototype(…)
  2.    HTMLElement.prototype
  3.    HTML.addmethods()
  4.    HTML.elements(add)
Answer: Option B
Question 19. You can refresh the webpage in JavaScript by using
  1.    window.reload
  2.    location.reload
  3.    window.refresh
  4.    page.refresh
Answer: Option B
Question 20. The functions provide() and require() of Dojo toolkit and Google’s Closure library are used for
  1.    declaring and loading modules
  2.    loading and declaring modules
  3.    declaring modules
  4.    none of the mentioned
Answer: Option A