NANDHOO
.
Learning Paths
Dashboard
Sign In
Home
Dashboard
Basic JavaScript: A Comprehensive Guide
Control Flow: The Art of Digital Decision Making
Quiz
Chapter Quiz: Control Flow: The Art of Digital Decision Making
Control Flow Quiz
Complete this assessment with 100% score to master this chapter.
01
What will 'if (0)' evaluate to?
True
False
Error
Undefined
02
Which statement is used for comparing one variable against many exact values?
if/else
while
switch
for
03
In a switch statement, what happens if you forget the 'break' keyword after a case?
The program throws an error
Execution falls through to the next case
The switch statement exits immediately
The default case runs
04
What is the ternary operator syntax for: if age >= 18 return 'adult', otherwise return 'minor'?
age >= 18 ? 'adult' : 'minor'
age >= 18 then 'adult' else 'minor'
if age >= 18 { 'adult' } else { 'minor' }
(age >= 18) => 'adult' | 'minor'
05
What is the main benefit of using a guard clause in a function?
It makes the function run faster
It returns early on failure, reducing nesting and keeping code flat
It creates a new scope for variables
It prevents the function from being called twice
Submit Answers
Back to Lesson
Next Chapter