JavaScript/JavaScript MCQ Set 2 Sample Test,Sample questions

Question:
 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;

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

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

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

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


Question:
 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>

1.125

2.25

3.5

4.Error


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

string  a = ”hi”;
string  b =”there”;
alert(a+b);

1. hi

2.there

3.hithere

4.undefined


Question:
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 ___________

1.Properties

2.Prototypes

3.Lvalue

4.Definition


Question:
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>

1.7.25

2.-7.25

3.7

4. -7


Question:
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.1.01

2.1.047

3.1.00

4. 1.4


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

function height()
{	
    var  height = 123.56;
    var type = (height>=190) ? "tall" : "short";
    return type;
}

1.123.56

2.190

3.tall

4.short


Question:
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}));

1. clean:India

2.clean:Italy

3.error

4.undefined


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

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

1.Yes

2.No

3.Runtime error

4. Compilation error


More MCQS

  1. JavaScript MCQ Questions And Answers
  2. JavaScript MCQ Questions And Answers Set 2
  3. JavaScript MCQ Set 1
  4. JavaScript MCQ Set 2
  5. Javascript MCQ Questions Set 1
  6. Javascript Multiple Choice Questions
  7. JAVASCRIPT MCQ
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!