Sail E0 Webinar

MCQs

Total Questions : 38 | Page 3 of 4 pages
Question 21. Do functions in JavaScript necessarily return a value ?
  1.    It is mandatory
  2.    Not necessary
  3.    Few functions return values by default
  4.    All of the mentioned
 Discuss Question
Answer: Option C. -> Few functions return values by default
Question 22. Consider the following code snippet :
var tensquared = (function(x) {return x*x;}(10));
Will the above code work ?
  1.    Yes, perfectly
  2.    Error
  3.    Exception will be thrown
  4.    Memory leak
 Discuss Question
Answer: Option A. -> Yes, perfectly
Question 23. Consider the following code snippet :
var string2Num=parseInt("123xyz");
The result for the above code snippet would be :
  1.    123
  2.    123xyz
  3.    Exception
  4.    NaN
 Discuss Question
Answer: Option B. -> 123xyz
Question 24. If you have a function f and an object o, you can define a method named m of o with
  1.    o.m=m.f;
  2.    o.m=f;
  3.    o=f.m;
  4.    o=f;
 Discuss Question
Answer: Option A. -> o.m=m.f;
Question 25. For the below mentioned code snippet:
var o = new Object();
The equivalent statement is:
  1.    var o = Object();
  2.    var o;
  3.    var o= new Object;
  4.    Object o=new Object();
 Discuss Question
Answer: Option C. -> var o= new Object;
Question 26. What is the difference between the two lines given below ?
!!(obj1 && obj2);
(obj1 && obj2);
  1.    Both the lines result in a boolean value “True”
  2.    Both the lines result in a boolean value “False”
  3.    Both the lines checks just for the existence of the object alone
  4.    The first line results in a real boolean value whereas the second line merely checks for the existence of the objects
 Discuss Question
Answer: Option D. -> The first line results in a real boolean value whereas the second line merely checks for the existence of the objects
Question 27. 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 :
  1.    1
  2.    0
  3.    Null
  4.    Undefined
 Discuss Question
Answer: Option A. -> 1
Question 28. What kind of scoping does JavaScript use?
  1.    Literal
  2.    Lexical
  3.    Segmental
  4.    Sequential
 Discuss Question
Answer: Option B. -> Lexical
Question 29. Consider the following code snippet :
var c = counter(), d = counter();
function constfuncs()
{
var funcs =
  1.    9
  2.    0
  3.    10
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> 10
Question 30. What must be done in order to implement Lexical Scoping?
  1.    Get the object
  2.    Dereference the current scope chain
  3.    Reference the current scope chain
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> Reference the current scope chain

Latest Videos

Latest Test Papers