Consider the following code snippet
function hypotenuse(a, b)
{
function square(x)
{
return x*x;
}
return Math.sqrt(square(a) + square(b));
}
What does the above 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
Answer: Option A
Solution(By Examveda Team)
The above code snippet contains nested function in which the function hypotenuse(a,b) has another function inside its scope, function square(x). The interesting thing about nested functions is their variable scoping rules. They can acceess the parameters and variables of the function (or functions) they are nested within.Consider the code snippet given below
var count = [1,,3];
A. The omitted value takes “undefined”
B. This results in an error
C. This results in an exception
D. None of the mentioned
A. true false
B. false true
C. true true
D. false true
The pop() method of the array does which of the following task ?
A. decrements the total length by 1
B. increments the total length by 1
C. prints the first element but no effect on the length
D. None of the mentioned
Consider the following code snippet :
if (!a[i]) continue ;
A. Skips the undefined elements
B. Skips the non existent elements
C. Skips the null elements
D. All of the mentioned
Join The Discussion