JAVASCRIPT QUIZ
1 .
What is negative infinity in Java script?

Correct Answer : Option (D)

number in JavaScript, derived by dividing negative number by zero
  Show Answer
2 .
Where do you use the “break” statement?

Correct Answer : Option (C)

To terminate a switch statement, loop, or labeled block. 
  Show Answer
3 .
What is the value of x?
var x = ‘1’+2+3;

Correct Answer : Option (C)

“123”
  Show Answer
4 .
Which of these will throw a SyntaxError?

Correct Answer : Option (C)

if (x ==== 1) { }
  Show Answer
5 .
Whats the output of the below
for(var i = 0; i < 10;i++){ 
   setTimeout(function(){console.log(i) }, 10)
}‚Äč

Correct Answer : Option (B)

10 10 10 10 10 10 10 10 10 10
  Show Answer
6 .
How do you check what the type of a value in variable x is?
var x = { ftl: "bar" }

Correct Answer : Option (D)

type(x);
  Show Answer
7 .
What will be the output of the following JavaScript code?
<p id="demo"></p>
<script>
  function myFunction() {
     document.getElementById("demo").innerHTML = Number.NEGATIVE_INFINITY;
  }
</script>

Correct Answer : Option (B)

-infinity
  Show Answer
8 .
What will be the output of the following JavaScript code?
<p id="demo"></p>
<script>
  function myFunction() {
     var num = 5.56789;
     var n = num.toExponential();
     document.getElementById("demo").innerHTML = n;
 }
</script>

Correct Answer : Option (A)

5.56789e+0
  Show Answer
9 .
What will be the output of the following JavaScript code if oddsums(5); is executed after the following code snippet?
function oddsums(n) {
     let total = 0, result=[]; 
     for(let x = 1; x <= n; x++) 
     { 
        let odd = 2*x-1; 
        total += odd;
        result.push(total);
     }
     return result;
}

Correct Answer : Option (B)

Returns [1,4,9,16,25]
  Show Answer
10 .
Which is the correct code that returns a complex number that is the complex conjugate of this one?

Correct Answer : Option (A)

Complex.prototype.conj = function() { return new Complex(this.r, -this.i); };
  Show Answer