Q. What will be the correct output of the following JavaScript code?

Code:
<p id="demo"></p>  
<script>  
functionmyFunc()  
{  
document.getElementById("demo").innerHTML=Math.asinh(1);  
}  
</script>  
  • (A) 0.80
  • (B) 0.78
  • (C) 0.50
  • (D) 0.88
πŸ’¬ Discuss
βœ… Correct Answer: (D) 0.88

Q. What will happen if we execute the following code of JavaScript?

Code:
vartensquared=(function(x){return x*x;}(10));  
  • (A) Memory leak
  • (B) Error
  • (C) Exception will be thrown
  • (D) Yes, perfectly
πŸ’¬ Discuss
βœ… Correct Answer: (D) Yes, perfectly

Q. What output will come if we run the following part of the JavaScript code?

Code:
var string2Num=parseInt("123abc"); 
  • (A) Exception
  • (B) 123abc
  • (C) 123
  • (D) NaN
πŸ’¬ Discuss
βœ… Correct Answer: (C) 123

Q. Which one of the given options can be considered as a code equivalent to the following code?

Code:
var o =newObject();
  • (A) var o= new Object;
  • (B) var o;
  • (C) var o = Object();
  • (D) Object o=new Object();
πŸ’¬ Discuss
βœ… Correct Answer: (C) var o = Object();

Q. In the following code, what value should the variable "a" contain?

Code:
var x =counter(), y = counter();  
x.count()  
y.count()  
x.reset()  
x.count()  
y.count()  
  • (A) Null
  • (B) 0
  • (C) 2
  • (D) Undefined
πŸ’¬ Discuss
βœ… Correct Answer: (C) 2

Q. Which one of the given options can be considered as the correct output of the following code?

Code:
var addition=newFunction("number1","number2","return number1+number2");  
document.writeln(addition(10,5));  
  • (A) 12
  • (B) 13
  • (C) 15
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 15

Q. Which one of the following is not a example of closures?

  • (A) Graphics
  • (B) Variables
  • (C) Functions
  • (D) Objects
πŸ’¬ Discuss
βœ… Correct Answer: (A) Graphics

Q. What output will be returned by the function in the following code?

Code:
var scope ="global scope";  
functioncheckingscope()  
{  
var scope ="local scope";  
functionf()  
{  
return scope;  
}  
return f;  
}  
  • (A) It will returns the value in scope
  • (B) It will returns value null
  • (C) It will returns an exception
  • (D) It will show an error message
πŸ’¬ Discuss
βœ… Correct Answer: (A) It will returns the value in scope

Q. What is the primary rule of the Lexical Scoping?

  • (A) Functions are always declared in the scope
  • (B) Variables are declared inside the function
  • (C) Functions are always declared outside the scope
  • (D) Functions gets executes using scope chain
πŸ’¬ Discuss
βœ… Correct Answer: (D) Functions gets executes using scope chain

Q. What is required in order to implement the Lexical Scoping?

  • (A) To reference the current scope chain
  • (B) Dereference the current scope chain
  • (C) Get the object
  • (D) Return the value
πŸ’¬ Discuss
βœ… Correct Answer: (A) To reference the current scope chain