/  JavaScript-loops-Quiz

This Quiz contains totally 10 Questions each carry 1 point for you.

1. What are the three important manipulations done in a for loop on a loop variable?
Updation, Incrementation, Initialization
Initialization,Testing, Updation
Testing, Updation, Testing
Initialization,Testing, Incrementation

Correct!

Wrong!

2. What will happen if the body of a for/in loop deletes property that has not yet been enumerated?
The property will be stored in a cache
The loop will not run
The property will not be enumerated
All of the mentioned

Correct!

Wrong!

3. What does the following expression return?

3 <= 300
false
true
not defined
None

Correct!

Wrong!

4. What will be the equivalent code of the following JavaScript code?

for(var p in o)

console.log(o[p]);
for (var i = 0;i < a.length;i++) console.log(a[i]);
for (int i = 0;i < a.length;i++) console.log(a[i]);
for (var i = 0;i <= a.length;i++) console.log(a[i]);
for (var i = 1;i < a.length;i++) console.log(a[i]);

Correct!

Wrong!

5.What will be the step of the interpreter in a jump statement when an exception is thrown?
The interpreter stops its work
The interpreter throws another exception
The interpreter jumps to the nearest enclosing exception handler
None of the mentioned

Correct!

Wrong!

6. Consider the following code snippet

while (a != 0)

{

if (a == 1)

continue;

else

a++;

}

What will be the role of the continue keyword in the above code snippet?
The continue keyword restarts the loop
The continue keyword skips the next iteration
The continue keyword skips the rest of the statements in that iteration
None of the mentioned

Correct!

Wrong!

7. What will be the output of the following JavaScript code?

function range(int length)

{

int a=5;

for(int i=0;i<length;i++)

{

console.log(a);

}

}

range(3);
5
555
3
error

Correct!

Wrong!

8. What will be the output of the following JavaScript code?

var a = 10;

do {

a += 1;

console.log(a);

} while (a < 5);
11121314
1112
12345
11

Correct!

Wrong!

9. Consider the following code snippet

function f(o)

{

if (o === undefined) debugger;

}

What could be the task of the statement debugger?
It does nothing but a simple breakpoint
It debugs the error in that statement and restarts the statement’s execution
It is used as a keyword that debugs the entire program at once
All of the mentioned

Correct!

Wrong!

10. Among the keywords below, which one is not a statement?
debugger
with
if
use strict

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

Ignore & go to results

Javascript – Loops – Quiz

You got %%score%% of %%total%% right

%%description%%

%%description%%

Where to go ?

Quizzes

Loading...