Control Structures – Multiple Choice Questions (MCQs)
-
-
2. Which keyword is used for the 'else if' condition in Python?
-
3. Which keyword is used for the 'else' condition in Python?
-
4. What will be the output of the following code? `x = 5; if x > 3: print('Yes') else: print('No')`?
-
5. What will be the output of the following code? `x = 2; if x > 3: print('A') elif x == 2: print('B') else: print('C')`?
-
6. Which keyword is used to start a 'for' loop in Python?
-
7. Which function is often used with 'for' loops to iterate over a sequence of numbers?
-
8. What is the output of the following code? `for i in range(3): print(i)`?
-
9. Which keyword is used to start a 'while' loop in Python?
-
10. What is the output of the following code? `x = 0; while x < 3: print(x); x += 1`?
-
11. Which keyword is used to exit a loop prematurely in Python?
-
12. Which keyword is used to skip the current iteration of a loop and move to the next?