1.

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); };

Answer» The correct answer is (a) Complex.prototype.conj = function() { return 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.


Discussion

No Comment Found

Related InterviewSolutions