Control Flow (if else switch) – Multiple Choice Questions (MCQs)
-
-
2. Which keyword is used to specify a block of code to be executed if the if condition is false?
-
3. Which keyword is used to check multiple conditions sequentially in an if-else structure?
-
4. What is the purpose of the 'switch' statement in C?
-
5. Which keyword is used to define different cases within a 'switch' statement?
-
6. What happens if none of the 'case' values match the expression in a 'switch' statement?
-
7. Which keyword is used to specify a default block of code in a 'switch' statement?
-
8. What is the purpose of the 'break' statement within a 'switch' case?
-
9. Can you have nested if-else statements in C?
-
10. What is the condition in an 'if' statement enclosed in?
-
11. What will be the output of the following code? `int x = 5; if (x > 3) { printf(\Hello\"); }`"""
-
12. What will be the output of the following code? `int x = 2; if (x > 3) { printf(\Hello\"); } else { printf(\""World\""); }`"""