If A is the superclass and B is the subclass, then subclass inheriting the superclass can be represented as ……
a) B=inherit(A);
b) B=A.inherit();
c) B.prototype=inherit(A);
d) B.prototype=inherit(A.prototype);
Explanation: inherit() function is a predefined function in javascript which is used to inherit properties of another class. The subclass B inherits the prototype of the class A.
The snippet that filters the filtered set is
a) var t=new FilteredSet(s, {function(s) {return !(x instanceof Set);});
b) var t=new FilteredSet{function(s) {return !(x instanceof Set);});
c) var t=new FilteredSet(s, {function(s) {return (x instanceof Set);});
d) var t=new FilteredSet(s, {function(s) {return x;});
Explanation: The instanceof operator is used to check the type of an object at run time. The instanceof operator returns a boolean value that indicates if an object is an instance of a particular class.
The method that can be used to create new properties and also to modify the attributes of existing properties is……
a) Object.defineProperty()
b) Object.defineProperties()
c) Both Object.defineProperty() and Object.defineProperties()
d) Object.inherit()
Which variables are used internally in object methods and are also
globally visible?
a) Object properties
b) Variable properties
c) Method properties
d) Internal properties
Explanation: The variable properties are usually variables that are used internally in the object’s methods, but can also be globally visible variables that are used through the page.
The class that represents the regular expressions is………
a) RegExpObj
b) RegExpClass
c) RegExp
d) StringExp
Explanation: Regular expression is an object that describes a pattern of characters. The JavaScript RegExp class represents regular expressions, and both string and RegExp define methods that use regular expressions.!
Which is the correct code that returns a complex number that is the complex conjugate of this one?
a) Complex.prototype.conj = function() { return new Complex(this.r, -this.i); };
b) Complex.prototype.conj = function() { return Complex(this.r, -this.i); };
c) Complex.prototype.conj = function() { return (this.r, -this.i); };
d) Complex.prototype.conj = function() { new Complex(this.r, -this.i); };
Explanation: Object.prototype.constructor specifies the function that creates the object prototype. The above code snippet returns a complex number that is the complex conjugate of this one.