R4RIN
Articles
Java 8
MCQS
JavaScript MCQ Quiz Hub
JavaScript MCQ Set 2
Choose a topic to test your knowledge and improve your JavaScript skills
1. 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
2. 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));
3. 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
4. What will be the output of the following JavaScript code? function height() { var height = 123.56; var type = (height>=190) ? "tall" : "short"; return type; }
123.56
190
tall
short
5. What will be the output of the following JavaScript code? string a = ”hi”; string b =”there”; alert(a+b);
hi
there
hithere
undefined
6. What will be the output of the following JavaScript code? function output(object) { var place=object ? object.place : “Italy”; return “clean:”+ place; } console.log(output({place:India}));
clean:India
clean:Italy
error
undefined
7. What will be the output of the following JavaScript code? <p id="demo"></p> <script> function myFunction() { document.getElementById("demo").innerHTML = Math.abs(-7.25); } </script>
7.25
-7.25
7
-7
8. What will be the output of the following JavaScript code? <p id="demo"></p> <script> function myFunction() { document.getElementById("demo").innerHTML = Math.cbrt(125); } </script>
125
25
5
Error
9. What will be the output of the following JavaScript code? <p id="demo"></p> <script> function myFunction() { document.getElementById("demo").innerHTML = Math.acos(0.5); } </script>
1.01
1.047
1.00
1.4
Submit