Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

301.

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.
302.

How many default number methods are available in JavaScript?(a) 5(b) 6(c) 7(d) 8

Answer» Right answer is (c) 7

To elaborate: There are a total of 7 default number methods in JavaScript namely:

constructor()

toExponential()

toFixed()

toLocaleString()

toPrecision()

toString()

valueOf()
303.

How can we make methods available on all objects?(a) Object.add(methods)(b) Object.methods(add)(c) Object.add.methods(…)(d) Object.prototype

Answer» Right choice is (d) Object.prototype

Easiest explanation: It is possible to add methods to Object.prototype, making them available on all objects. This is not recommended, however, because prior to ECMAScript5, there is no way to make these add-on methods non enumerable, and if you add properties to Object.prototype, those properties will be reported by all for/in loops.
304.

Which of the following property(s) has a default value as false?(a) disableWhenFirebugActive(b) showIconWhenHidden(c) disableXHRListener(d) both disableWhenFirebugActive & showIconWhenHidden

Answer» Right option is (c) disableXHRListener

For explanation: Only disableXHRListener property has a default value false. The properties disableWhenFirebugActive and showIconWhenHidden has a default value of true.
305.

Which of the following methods adds and connects the point to the cubic bezier curve?(a) bezierConnect()(b) bezierCurveTo()(c) Connectbezier()(d) bezierTo()

Answer» Correct option is (b) bezierCurveTo()

The explanation: A cubic bezier curve requires three points. The first two points are control points that are used in the cubic Bézier calculation and the last point is the ending point for the curve. This method adds a new point P to the subpath and connects it to the current point with a cubic Bezier curve.
306.

Which of the following shows a poorer runtime performance for coalescing functionality, using functions, and using objects?(a) Firefox unwoundfun(b) Firefox UsingFunct(c) Firefox UsingObject(d) Firefox UsingStruct

Answer» Right option is (a) Firefox unwoundfun

For explanation: When we compare the runtime performance for coalescing functionality, using functions, and using objects, the Firefox UsingFunct shows a poorer performance. This results in poor user experience.
307.

The function stops its execution when it encounters?(a) continue statement(b) break statement(c) goto statement(d) return statement

Answer» The correct choice is (d) return statement

Easiest explanation: Continue statement and break statement are used in the loops for skipping the iteration or going out of the loop. Whenever a return statement is encountered the function execution is stopped.