Module 3 – JavaScript If/Else, Switch & Loops MCQs

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





2. What will this code output?





3. Which keyword is used in JavaScript to start a switch block?





4. What will this switch statement output?





5. Which loop executes at least once even if the condition is false?





6. How many times will the following loop run?





7. What does this while loop print?





8. Which loop is best when you know the exact number of repetitions?





9. What is missing in this for loop?





10. What happens if you forget the break in a switch case?





Wait for 20 seconds...

Post a Comment

Previous Post Next Post