wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

JavaScript Control Flow – MCQ Quiz (With Answers)

Total questions: 20

Worksheet time: 15mins

Name
Class
Date
1.

Which of the following statements is used to make decisions in JavaScript?

a)

select

b)

if

c)

loop

d)

switchcase

2.

What is the correct syntax for an if statement in JavaScript?

a)

if (condition) then { }

b)

if condition { }

c)

if (condition) { }

d)

if { condition }

3.

What keyword is used to test multiple conditions with the same variable?

a)

if

b)

else

c)

switch

d)

when

4.

What will this code print?

a)

Big

b)

Small

c)

10

d)

Error

5.

In a switch statement, which keyword stops execution from continuing to the next case?

a)

stop

b)

break

c)

end

d)

exit

6.

What will this output?

a)

A

b)

A B

c)

B

d)

Nothing

7.

Which loop runs a block of code at least once, even if the condition is false?

a)

for

b)

while

c)

do...while

d)

if

8.

What is the output?

a)

1

b)

1 2

c)

1 2 3

d)

Infinite loop

9.

What is the output?

a)

0 1 2

b)

0 2

c)

1 2

d)

2

10.

What keyword immediately exits a loop?

a)

exit

b)

stop

c)

break

d)

skip

11.

What is the output?

a)

1 2 3

b)

1 1

1 2

2 1

2 2

3 1

3 2

c)

3,2 2,1

d)

Error

12.

Which of the following is true about for...in?

a)

Iterates through array values

b)

Iterates through object keys

c)

Works only with strings

d)

Used for infinite loops

13.

Which loop is best suited for iterating through an array of numbers?

a)

for...of

b)

for...in

c)

while

d)

switch

14.

What will this output?

a)

0 1 2

b)

10 20 30

c)

num num num

d)

undefined

15.

What happens if you forget the break statement in a switch?

a)

Error occurs

b)

Execution stops automatically

c)

The next case also runs

d)

The program terminates

16.

What is the output?

a)

A) 2

b)

B) 3

c)

C) 4

d)

D) Infinite loop

17.

In nested loops, how many times will the inner loop run?

a)

2 times

b)

3 times

c)

6 times

d)

Infinite

18.

What is the output?

a)

0

b)

0 1 2

c)

0 1

d)

1

19.

Which of the following correctly skips an iteration in a loop?

a)

skip;

b)

pass;

c)

continue;

d)

next;

20.

Which statement best describes control flow in JavaScript?

a)

The order in which variables are declared

b)

The order in which statements are executed

c)

The number of loops in a program

d)

The way JS handles memory