Activity 3

1. What is a switch statement best used for?

2. What mistake is common with if statements?

3. What is the default case in a switch statement for?

4. What happens if no break statement is used in a switch case?

5. What type of values does a ternary operator return?

6. What is the purpose of the else statement?

7. In an if-else statement, what happens when the if condition is true?

8. What happens without a break statement in a switch case?

9. Which block evaluates multiple conditions sequentially?

10. What does an if statement do in JavaScript?

Correct Answers

1. What is a switch statement best used for? ✅ Checking multiple potential values

2. What mistake is common with if statements? ✅ Using the assignment operator (=)

3. What is the default case in a switch statement for? ✅ Executes when no cases match

4. What happens if no break statement is used in a switch case? ✅ All subsequent cases execute

5. What type of values does a ternary operator return? ✅ Any value based on conditions

6. What is the purpose of the else statement? ✅ Executes if the if condition is false

7. In an if-else statement, what happens when the if condition is true? ✅ The if block runs

8. What happens without a break statement in a switch case? ✅ Fall-through to subsequent cases

9. Which block evaluates multiple conditions sequentially? ✅ if-else if

10. What does an if statement do in JavaScript? ✅ Executes a block if the condition is true

Instructions:

Set Up Your Development Environment

Implement JavaScript Conditional Statements

JavaScript Conditionals