Home

JavaScript MCQ Question with Answer

JavaScript MCQ with detailed explanation for interview, entrance and competitive exams. Explanation are given for understanding.

Download JavaScript MCQ Question Answer PDF

Question No : 22
The escape sequence stands for _________

Floating numbers
Representation of functions that returns a value
is not present in JavaScript
Form feed

Question No : 23
The snippet that has to be used to check if a is not equal to null is _________

if(a!=null)
if (!a)
if(a!null)
if(a!==null)

Question No : 24
The statement a===b refers to _________

Both a and b are equal in value, type and reference address
Both a and b are equal in value
Both a and b are equal in value and type
There is no such statement

Question No : 25
Assume that we have to convert false that is a non-string to string. The command that we use is (without invoking the new operator).

false.toString()
String(false)
String newvariable=false
Both false.toString() and String(false)

Question No : 26
What will be the output of the following JavaScript code?

function compare()
{
int num=2;
char b=2;
if(a==b)
return true;
else
return false;
}

true
false
runtime error
compilation error

Question No : 27
What will be the output of the following JavaScript code?

function equalto()
{
int num=10;
if(num===10)
return true;
else
return false;
}

true
false
runtime error
compilation error

Question No : 28
What will be the output of the following JavaScript code?

function compare()
{
int a=1;
char b=1;
if(a.tostring()===b)
return true;
else
return false;
}

true
false
runtime error
logical error