wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Moringa JavaScript Iteration

Total questions: 10

Worksheet time: 8mins

Name
Class
Date
1.

Loops offer a quick and easy way to do something repeatedly.

a)

FALSE

b)

TRUE

2.

The code below repeats the log 5 times.

for (let i = 0; i < (a)   ; i++) { console.log(i); }

3.

The following code repeats the code 5 times;

let i = 0;

do { i += 1; console.log(i); } while (i < 5);

What would be the first log value?

a)

1

b)

0

4.

The following code repeats the log 5 times.

let i = 0; while (i < 5) { console.log(i); i++; }

What is the first logged value?

a)

1

b)

0

5.

A (a)   statement is used to terminate execution is a for loop, while loop, do-while loop & switch statement.

6.

A (a)   statement is used to restart a while, do-while, and for loop.

7.

Is the following statement true?

for in loops over enumerable property names of an object, while for of uses an object-specific iterator and loops over the values generated.

a)

YES

b)

NO

8.

(a)   is the act of a function calling itself and is used to solve problems that contain smaller sub-problems.

9.

Which of the following statements is true about recursion?

a)

Recursion has more overhead in terms of memory.

b)

Recursion can reduce time complexity.

c)

Recursion is better at tree traversal.

10.

A (a)   function can pause midway and then continues from where it paused.