Vidyalelo
JavaScript · all questions

Array And Function
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

38

Questions

2/2

Page

Pick an option on a question to see the right answer and solution.

Do functions in JavaScript necessarily return a value ?

Select an option to see the answer and solution.

Consider the following code snippet :
var tensquared = (function(x) {return x*x;}(10));
Will the above code work ?

Select an option to see the answer and solution.

Consider the following code snippet :
var string2Num=parseInt("123xyz");
The result for the above code snippet would be :

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

For the below mentioned code snippet:
var o = new Object();
The equivalent statement is:

Select an option to see the answer and solution.

What is the difference between the two lines given below ?
!!(obj1 && obj2);
(obj1 && obj2);

Select an option to see the answer and solution.

Consider the following code snippet :
var c = counter(), d = counter(); 
c.count()
d.count() 
c.reset() 
c.count() 
d.count()
The state stored in d is :

Select an option to see the answer and solution.

Consider the following code snippet :
var c = counter(), d = counter(); 
function constfuncs() 
{
    var funcs = [];
    for(var i = 0; i < 10; i++)
        funcs[i] = function() { return i; };
    return funcs;
}
var funcs = constfuncs();
funcs[5]()
What does the last statement return ?

Select an option to see the answer and solution.

What kind of scoping does JavaScript use?

Select an option to see the answer and solution.

What must be done in order to implement Lexical Scoping?

Select an option to see the answer and solution.

What is a closure?

Select an option to see the answer and solution.

Which of the following are examples of closures?

Select an option to see the answer and solution.

Which of the following uses a lot of CPU cycles?

Select an option to see the answer and solution.

Consider the following code snippet :
var scope = "global scope";
function checkscope() {
var scope = "local scope"; 
function f() 
{ 
     return scope; 
}
return f;
What is the function of the above code snippet?

Select an option to see the answer and solution.

What is the fundamental rule of lexical scoping?

Select an option to see the answer and solution.

What is the opposite approach to the lexical scoping?

Select an option to see the answer and solution.

What is the purpose of the dynamic scoping?

Select an option to see the answer and solution.

Which of the algorithmic languages is lexical scoping standardized in?

Select an option to see the answer and solution.