wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Control Flow

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which keyword can one use make a decision based on a condition?

a)

if

b)

let

c)

how

d)

ifToSay

2.

Bisi wants to check if a users age is above 20 and the user is from Nigeria, which if statement can she use?

a)

if (age >=20 && country = 'Nigeria')

b)

if (age > 20 && country === 'Nigeria')

c)

if (age ===20 && country === 'Nigeria')

d)

if (age >= 20 && country === 'Nigeria')

3.

If we need to add multiple conditions, what keyword can we use?

a)

evenThough

b)

else

c)

justBecause

d)

other

4.

Which of the following does this:

The age should be equal to or above 10 OR the gender should be male

a)

if (gender === 'male' && age > 10)

b)

if (gender = 'male' && age >= 10)

c)

if (gender === 'male' || age >= 10)

d)

if (gender === 'male' || age > 10)

5.

Which looping construct in JavaScript is used for iterating over the elements of an array or characters of string?

a)

for loop

b)

continue loop

c)

break loop

d)

insert loop

6.

What is the purpose of the continue statement in a loop

a)

To terminate the loop and exit

b)

To skip the current iteration and move to the next one

c)

To restart the loop from the beginning

d)

To continue to the next iteration of the loop

7.

What is the purpose of the break statement in a loop

a)

To terminate the loop and exit

b)

To skip the current iteration and move to the next one

c)

To restart the loop from the beginning

d)

To continue to the next iteration of the loop

8.

for (let i = 0; i < 10; i++)

How many times would the loop run?

a)

10

b)

11

c)

9

d)

8

9.

Can we use the for loop to iterate over a string?

a)

Yes

b)

No

c)

maybe

d)

I don't know

10.

for (let i = 0; i >= 10; i++)

How many times would this run?

a)

0

b)

10

c)

11

d)

9