This quiz works best with JavaScript enabled. Home > Grammar > Parts Of Speech > Verbs > Moods > Understanding Conditionals – Quiz 12 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Understanding Conditionals Quiz 12 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the output of the following code:x = 0; while x < 3:print(x); x += 1? A) 012. B) 3. C) -1. D) 1.5. Show Answer Correct Answer: A) 012. 2. Match the sentence to its type:A) If you touch a flame, it burns. B) If I go to the party, I will have fun. (1. first coditional, 2. Zero Conditional) A) A:2, B:1. B) A:1, B:2. C) A:2, B:2. D) A:1, B:1. Show Answer Correct Answer: A) A:2, B:1. 3. What is the purpose of the else clause? A) To execute code when the if condition is false. B) To create a loop in a program. C) To define a function in Python. D) To execute code when the if condition is true. Show Answer Correct Answer: A) To execute code when the if condition is false. 4. If Aria studies hard, what will happen? A) If Aria had a car, she would drive to work. B) If Aria studies hard, she will pass the exam. C) If Aria were taller, she would play basketball. D) If it had rained, Aria would have stayed home. Show Answer Correct Answer: B) If Aria studies hard, she will pass the exam. 5. What is the difference between 'while' and 'for' loops? A) The main difference is that 'while' loops are condition-based, while 'for' loops are count-based. B) 'While' loops require a specific number of iterations. C) 'For' loops can only iterate over arrays. D) 'While' loops are faster than 'for' loops. Show Answer Correct Answer: A) The main difference is that 'while' loops are condition-based, while 'for' loops are count-based. 6. Complete the sentence:If it is sunny tomorrow, we ..... (go) to the park. A) Might go. B) Are going. C) Will go. D) Could go. Show Answer Correct Answer: C) Will go. 7. How do you implement a default case in a switch statement? A) Implement a 'catch' block for unmatched cases. B) Leave the switch statement empty for default behavior. C) Use 'default:' followed by the code to execute when no cases match. D) Use 'else' to handle unmatched cases. Show Answer Correct Answer: C) Use 'default:' followed by the code to execute when no cases match. 8. If she were the president, she would change the law. (Second or Third?) A) Third. B) Second. C) First. D) None of the above. Show Answer Correct Answer: B) Second. 9. What is the condition in this statement:If you wake up early, then you can have breakfast? A) Waking up early. B) Having breakfast. C) Waking up late. D) Skipping breakfast. Show Answer Correct Answer: A) Waking up early. 10. Which of the following is a first conditional? 'If you touch a flame, it burns.' or 'If I finish my homework, I will go out.' A) If I eat too much, I get hungry. B) If it rains, I will stay inside. C) If you heat ice, it melts. D) If I finish my homework, I will go out. Show Answer Correct Answer: D) If I finish my homework, I will go out. 11. If I were you, I would apologize. (Second or Third?) A) First. B) Fourth. C) Fifth. D) Second. Show Answer Correct Answer: D) Second. 12. How do you write a basic if statement in Python? A) If:condition then do something. B) If condition:do something. C) If condition do something. D) If (condition) \{ do something \}. Show Answer Correct Answer: B) If condition:do something. 13. Can you use 'unless' in a zero conditional sentence? Give an example. A) 'Unless' is only used in first conditional sentences. B) Yes, you can use 'unless' in a zero conditional sentence. Example:'We go to the park unless it rains.'. C) Example:'If it rains, we go to the park.'. D) No, 'unless' cannot be used in a zero conditional sentence. Show Answer Correct Answer: B) Yes, you can use 'unless' in a zero conditional sentence. Example:'We go to the park unless it rains.'. 14. What is the correct way to write a nested loop? A) For (int i = 0; i < outerLimit; i++) \{ for (int j = 0; j < innerLimit; j++) \{ // code to execute \}\}. B) For (int i = 0; i < outerLimit; i++) \{ while (j < innerLimit) \{ // code to execute \}\}. C) For (int i = 0; i < outerLimit; j++) \{ for (int j = 0; j < innerLimit; i++) \{ // code to execute \}\}. D) For (int i = 0; i < outerLimit; i++) \{ for (int j = 0; j < innerLimit; j++) // code to execute \}. Show Answer Correct Answer: A) For (int i = 0; i < outerLimit; i++) \{ for (int j = 0; j < innerLimit; j++) \{ // code to execute \}\}. 15. Lily is planning her evening. Which of the following sentences is a first conditional? A) If I finish my homework, I will watch TV. B) If I were you, I would study more. C) If it had snowed, we would have stayed home. D) If I had a dog, I would walk it every day. Show Answer Correct Answer: A) If I finish my homework, I will watch TV. 16. Choose the correct option:If I were you, I ..... (would/will) apologize. A) Should. B) Would. C) Can. D) Might. Show Answer Correct Answer: B) Would. 17. If it is sunny, then we can play outside. What is the opposite condition? A) If it is not sunny, then we cannot play outside. B) If it is sunny, then we cannot play outside. C) If it is cloudy, then we can play outside. D) If it is raining, then we can play outside. Show Answer Correct Answer: A) If it is not sunny, then we cannot play outside. 18. How do you iterate over a list using a for loop? A) For each item in my list:. B) For item from my list:. C) Foreach item in my list do. D) For item in my list:. Show Answer Correct Answer: D) For item in my list:. 19. How do you use a while loop to count from 1 to 10? A) Do \{ console.log(counter); counter++; \} while (counter <= 10);. B) While (counter <= 10) \{ console.log(counter); counter++; \}. C) For (counter = 1; counter < 10; counter++) \{ console.log(counter); \}. D) If (counter <= 10) \{ console.log(counter); counter++; \}. Show Answer Correct Answer: B) While (counter <= 10) \{ console.log(counter); counter++; \}. 20. What happens if the condition in a conditional statement is false? A) The program terminates immediately. B) The code block for the 'false' case executes. C) The code block for the 'true' case executes. D) The condition is re-evaluated until it becomes true. Show Answer Correct Answer: B) The code block for the 'false' case executes. 21. Formulate a first conditional sentence about studying for an exam. A) If I don't study, I will fail the exam. B) If I study, I pass the exam. C) If I study hard, I will pass the exam. D) If I study tomorrow, I will not pass the exam. Show Answer Correct Answer: C) If I study hard, I will pass the exam. 22. Which conditional uses 'if' and the present simple? A) Second conditional. B) Zero conditional. C) Third conditional. D) First conditional. Show Answer Correct Answer: D) First conditional. 23. Choose a correct first conditional sentence. A) If it rains, I will take an umbrella. B) If it gets cold, I will open the window. C) If it is sunny, I will stay indoors. D) If it snows, I will wear a coat. Show Answer Correct Answer: A) If it rains, I will take an umbrella. 24. Which keyword is used to create a loop in Python? A) Repeat. B) Loop. C) For, while. D) Iterate. Show Answer Correct Answer: C) For, while. 25. If he had asked me, I would have helped him. (Second or Third?) A) Third. B) Both. C) Neither. D) First. Show Answer Correct Answer: A) Third. ← PreviousNext →Related QuizzesVerbs QuizzesParts Of Speech QuizzesUnderstanding Conditionals Quiz 1Understanding Conditionals Quiz 2Understanding Conditionals Quiz 3Understanding Conditionals Quiz 4Understanding Conditionals Quiz 5Understanding Conditionals Quiz 6Understanding Conditionals Quiz 7Understanding Conditionals Quiz 8 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books