adplus-dvertising
frame-decoration

Question

Consider the following code snippet. What does the below code result?
function hypotenuse(a, b) 
{
  function square(x) 
  { 
    return x*x; 
  }
  return Math.sqrt(square(a) + square(b));
}

a.

Sum of square of a and b

b.

Square of sum of a and b

c.

Sum of a and b square

d.

None of the mentioned

Posted under JavaScript

Answer: (a).Sum of square of a and b

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Consider the following code snippet. What does the below code result?

Similar Questions

Discover Related MCQs

Q. Which of the following is the correct code for invoking a function without this keyword at all, and also too determine whether the strict mode is in effect?

Q. Which is an equivalent code to invoke a function m of class o that expects two arguments x and y?

Q. Consider the following code snippet :

var grand_Total=eval("10*10+5");

The output for the above statement would be :

Q. Do functions in JavaScript necessarily return a value ?

Q. Consider the following code snippet :

var tensquared = (function(x) {return x*x;}(10));

Will the above code work ?

Q. Consider the following code snippet :

var string2Num=parseInt("123xyz");

The result for the above code snippet would be :

Q. If you have a function f and an object o, you can define a method named m of o with

Q. For the below mentioned code snippet:

var o = new Object();

The equivalent statement is:

Q. What is the difference between the two lines given below ?

!!(obj1 && obj2);
(obj1 && obj2);

Q. What kind of scoping does JavaScript use?

Q. What must be done in order to implement Lexical Scoping?

Q. What is a closure?

Q. Which of the following are examples of closures?

Q. Which of the following uses a lot of CPU cycles?

Q. What is the fundamental rule of lexical scoping?

Q. What is the opposite approach to the lexical scoping?

Q. What is the purpose of the dynamic scoping?

Q. Which of the algorithmic languages is lexical scoping standardized in?