Lesson 4: Control Flow: Conditional Statements and Loops

MCQ Paper

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





2. Which keyword is used to exit a loop?





3. What will range(1, 5) generate?





4. Which loop is used when the number of iterations is unknown?





5. What is the purpose of the continue statement in a loop?





6. What will be the output of this code?

				for i in range(3):
    				   print(i)
			




7. What will if not (5 == 5): evaluate to?





8. How do you write an if-else statement in Python?





9. What is the output of this code?

      	    x = 0 
		while x < 3: 
		  	print(x) 
		  	x += 1 




10. How do you stop an infinite loop in Python?





Wait for 20 seconds...

Post a Comment

Previous Post Next Post