228). What will be the output of the following JavaScript code?
const pi=3.14;
var pi=4;
console.log(pi);

[A]This will flash an error
[B]Prints 4
[C]Prints 3.14
[D]Ambiguity

Show Answer

229). The let keyword cannot be used ___________
const pi=3.14;
var pi=4;
console.log(pi);

[A]as a substitute of var
[B]as a block statement to define new variables
[C]to define variables that are scoped to a single expression
[D]in a else if loop, as a substitute for var

Show Answer

230). The main difference between the variables declared with var and with let is __________
const pi=3.14;
var pi=4;
console.log(pi);

[A]var is confined to a particular function but let is not
[B]let is confined to a particular function but var is not
[C]var defines values based on conditions but let does not
[D]let doesn’t let you change the value of the variable

Show Answer

231). 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;
}

[A] Returns [1,4,9,16,25]
[B]Returns [1,2,3,4,5]
[C] Returns [3,6,9,12,15]
[D]Returns [1,3,5,7,9]

Show Answer

232). What would be the result or type of error if p is not defined in the following JavaScript code snippet?
console.log(p)

[A]Zero
[B]Null
[C]Reference Error
[D]Value not found Error

Show Answer

233). What will be the output of the following JavaScript code?
let x=x+1;
console.log(x);

[A]0
[B]Null
[C] Reference error
[D]NaN

Show Answer

234). What will be the output of the following JavaScript code?
[x,y]=[y,x];

[A]Throws exception
[B]Swap the value of the two variables
[C] Flashes an error
[D]Creates a new reference object

Show Answer

235). Which looping statement allows XML tags to appear in JavaScript programs and adds API for operating on XML data?
[x,y]=[y,x];

[A]for loop
[B] while loop
[C] for/each loop
[D]do while loop

Show Answer

236). Which exception does the Iterators throw from their next() method when there are no more values to iterate, that work on finite collections?
[x,y]=[y,x];

[A]Exit Iteration
[B]Abort Iteration
[C]Abort
[D]Stop Iteration

Show Answer

237). Which method of the iterable object returns an iterator object for the collection?
[x,y]=[y,x];

[A]iterator()
[B] _iterator_()
[C]_iteration_()
[D]_return_iterator_()

Show Answer

238). What will be the output of the following JavaScript code?

[A]True
[B]False
[C]Error
[D]Undefined

Show Answer

239). What will be the output of the following JavaScript code?

[A]1.7976931348623157e+308
[B]1.7976931348623157e+305
[C]1.7976931348623157e+307
[D]Error

Show Answer

240). What will be the output of the following JavaScript code?

[A] -1000
[B] -infinity
[C]infinity
[D]undefined

Show Answer

241). What will be the output of the following JavaScript code?

[A]True
[B]False
[C]Error
[D]Undefiend

Show Answer

242). What will be the output of the following JavaScript code?

[A]5.56789e+0
[B]5.57e+0
[C] 5.568e+0
[D]Error

Show Answer