NEW
Font size
WorksheetsJavaScript Control Flow – MCQ Quiz (With Answers)
Total questions: 20
Worksheet time: 15mins
Which of the following statements is used to make decisions in JavaScript?
select
if
loop
switchcase
What is the correct syntax for an if statement in JavaScript?
if (condition) then { }
if condition { }
if (condition) { }
if { condition }
What keyword is used to test multiple conditions with the same variable?
if
else
switch
when
What will this code print?
Big
Small
10
Error
In a switch statement, which keyword stops execution from continuing to the next case?
stop
break
end
exit
What will this output?
A
A B
B
Nothing
Which loop runs a block of code at least once, even if the condition is false?
for
while
do...while
if
What is the output?
1
1 2
1 2 3
Infinite loop
What is the output?
0 1 2
0 2
1 2
2
What keyword immediately exits a loop?
exit
stop
break
skip
What is the output?
1 2 3
1 1
1 2
2 1
2 2
3 1
3 2
3,2 2,1
Error
Which of the following is true about for...in?
Iterates through array values
Iterates through object keys
Works only with strings
Used for infinite loops
Which loop is best suited for iterating through an array of numbers?
for...of
for...in
while
switch
What will this output?
0 1 2
10 20 30
num num num
undefined
What happens if you forget the break statement in a switch?
Error occurs
Execution stops automatically
The next case also runs
The program terminates
What is the output?
A) 2
B) 3
C) 4
D) Infinite loop
In nested loops, how many times will the inner loop run?
2 times
3 times
6 times
Infinite
What is the output?
0
0 1 2
0 1
1
Which of the following correctly skips an iteration in a loop?
skip;
pass;
continue;
next;
Which statement best describes control flow in JavaScript?
The order in which variables are declared
The order in which statements are executed
The number of loops in a program
The way JS handles memory
