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 : 36
What kind of expression is new Point(2,3)?

Primary Expression
Object Creation Expression
Invocation Expression
Constructor Calling Expression

Question No : 37
Which of the operator is used to test if a particular property exists or not?

in
exist
within
exists

Question No : 38
Among the following, which one is a ternary operator?

+
:
^
?:

Question No : 39
An expression that can legally appear on the left side of an assignment expression. is a well known explanation for variables, properties of objects, and elements of arrays. They are called ___________

Properties
Prototypes
Lvalue
Definition

Question No : 40
What will be the equivalent output of the following JavaScript code snippet?

x = ~-y;
w = x = y = z;
q = a?b:c?d:e?f:g;

x = ~(-y); w = (x = (y = z));
q = a?b:(c?d:(e?f:g));
x = a?b:(c?d:(e?f:g));
q = ~(-y); w = (x = (y = z));
x = (x = (y = z));w = ~(-y);
q = a?b:(c?d:(e?f:g));
x = ~(-y); w = (x = (y = z));
q = (c?d:(e?f:g));

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

function output(option)
{
return (option ? yes : no);
}
bool ans=true;
console.log(output(ans));

Yes
No
Runtime error
Compilation error

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

var obj=
{
length:20,
height:35,
}
if (breadth' in obj === false)
{
obj.breadth = 12;
}
console.log(obj.breadth);

20
12
undefined
error