This Quiz contains totally 10 Questions each carry 1 point for you.
1. What will be the output of the following JavaScript code?
var string1 = ”123”;
var intvalue = 123;
alert( string1 + intvalue );
var string1 = ”123”;
var intvalue = 123;
alert( string1 + intvalue );
123246
246
123123
Exception
Correct!
Wrong!
2. Guess the ternary operator used in the following example ?
marks = (mark<35)?"Fail":"Pass";
marks = (mark<35)?"Fail":"Pass";
Colon Operator
Conditional Operator
Logical Operator
Bitwise Operator
Correct!
Wrong!
3. Initialization of variable can be done by writing ______________ operator in between variable name and operand value.
Equals
=
value
==
Correct!
Wrong!
4. What will be the output of the following script ?
<script>
var x = 5;
document.write(x === "5");
</script>
<script>
var x = 5;
document.write(x === "5");
</script>
5
1
false
true
Correct!
Wrong!
5. Which of the operator is used to test if a particular property exists or not?
in
exist
within
exists
Correct!
Wrong!
6. 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 = ~(-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));
Correct!
Wrong!
7. What will be the output of the following JavaScript code?
function height()
{
var height = 123.56;
var type = (height>=190) ? "tall" : "short";
return type;
}
function height()
{
var height = 123.56;
var type = (height>=190) ? "tall" : "short";
return type;
}
123.56
190
tall
short
Correct!
Wrong!
8. What type of value gets printed if we add following two variables .
var a = "1";
var b = 5;
var a = "1";
var b = 5;
Number
Integer
Text
Long
Correct!
Wrong!
9. JavaScript contains a _________________ that assigns a value to a variable based on some condition.
Assignment operator
Logical Operator
Bitwise Operator
Conditional operator
Correct!
Wrong!
10. 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);
var obj=
{
length:20,
height:35,
}
if (‘breadth' in obj === false)
{
obj.breadth = 12;
}
console.log(obj.breadth);
20
12
undefined
error
Correct!
Wrong!
Share the quiz to show your results !
Subscribe to see your results
Ignore & go to results
Javascript – Operators – Quiz
You got %%score%% of %%total%% right
%%description%%
%%description%%
Loading...