Do functions in JavaScript necessarily return a value ?
A. It is mandatory
B. Not necessary
C. Few functions return values by default
D. All of the mentioned
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 ?
A. Yes, perfectly
B. Error
C. Exception will be thrown
D. Memory leak
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 :
A. 123
B. 123xyz
C. Exception
D. NaN
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
A. o.m=m.f;
B. o.m=f;
C. o=f.m;
D. o=f;
Select an option to see the answer and solution.
For the below mentioned code snippet:
The equivalent statement is:
A. var o = Object();
B. var o;
C. var o= new Object;
D. Object o=new Object();
Select an option to see the answer and solution.
What is the difference between the two lines given below ?
!!( obj1 && obj2) ;
( obj1 && obj2) ;
A. Both the lines result in a boolean value “True”
B. Both the lines result in a boolean value “False”
C. Both the lines checks just for the existence of the object alone
D. The first line results in a real boolean value whereas the second line merely checks for the existence of the objects
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 ?
A. 9
B. 0
C. 10
D. None of the mentioned
Select an option to see the answer and solution.
What kind of scoping does JavaScript use?
A. Literal
B. Lexical
C. Segmental
D. Sequential
Select an option to see the answer and solution.
What must be done in order to implement Lexical Scoping?
A. Get the object
B. Dereference the current scope chain
C. Reference the current scope chain
D. None of the mentioned
Select an option to see the answer and solution.
What is a closure?
A. Function objects
B. Scope where function’s variables are resolved
C. Both Function objects and Scope where function’s variables are resolved
D. None of the mentioned
Select an option to see the answer and solution.
Which of the following are examples of closures?
A. Objects
B. Variables
C. Functions
D. All of the mentioned
Select an option to see the answer and solution.
Which of the following uses a lot of CPU cycles?
A. GUI
B. Statically generated graphics
C. Dynamically generated graphics
D. All of the mentioned
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?
A. Returns value null
B. Returns exception
C. Returns the value in scope
D. None of the mentioned
Select an option to see the answer and solution.
What is the fundamental rule of lexical scoping?
A. Functions are declared in the scope
B. Functions are executed using scope chain
C. All of the mentioned
D. None of the mentioned
Select an option to see the answer and solution.
What is the opposite approach to the lexical scoping?
A. Literal scoping
B. Static scoping
C. Dynamic scoping
D. Generic scoping
Select an option to see the answer and solution.
What is the purpose of the dynamic scoping?
A. Variables can be declared outside the scope
B. Variables must be declared outside the scope
C. Variables cannot be declared outside the scope
D. None of the mentioned
Select an option to see the answer and solution.
Which of the algorithmic languages is lexical scoping standardized in?
A. Ada
B. Pascal
C. Modula2
D. All of the mentioned
Select an option to see the answer and solution.