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