Python Quiz – For loop in Python Welcome to your Python Quiz - For loop in Python Name Email 1. For loop can run over any range or sequence of data in Python Yes No 2. Number of iterations are normally fixed when a for loop starts Yes, fixed No, it can change 3. For loop’s body requires an indentation in Python Absolutely Not necessary 4. What will be the output of following code? [Line1] for data in range(3): [Line2] print (data) >> 0,1,2,3 >> 0,1,2 >> 3 >>1,2,3 5. What is the output of list(range(4)) >> Error >> Object present at xyz location >> [0,1,2,3] >> range(0,4) 6. What will be the output for list(range(0,10,3)) >> [0,1,2,3,4,5,6,7,8,9,10] >> [0,10,3] >> [0,1,2,3] >> [0,3,6,9] 7. Can we write for loop in one line itself ? Yes, Possible No way 8. We can also utilize index of a data structure to iterate using for loop No Yes 9. We can also place another control structure inside a for loop Yes, why not No 10. Can a for loop exists inside another for loop (loop inside loop) Yes, Possible Not Possible 11. For loop can also be applied on a String Yes No 12. Can a for-loop be terminated before it iterate over the entire sequence Yes No Related Posts