Loops Questions and Answers
Python Programming - Loops Questions with Answers explain repetitive task execution efficiently. These Python Loops Questions are common in Infosys, TCS, and SSC exams testing logical flow control and iteration
Loops
Showing 10 of
25 questions
21. What will this code output: for i in range(1, 6): if i == 3: continue print(i, end=" ")
- 1 2 4 5
- 1 2 3 4 5
- 1 2
- 4 5
22. Which method is used to iterate over dictionary key-value pairs?
- dict.keys()
- dict.values()
- dict.items()
- dict.pairs()
23. What is the output of: numbers = [1, 2, 3] for num in numbers: if num % 2 == 0: break print(num)
- 1
- 1 2
- 1 3
- 1 2 3
24. How to reverse iterate through a list in Python?
- Using reverse()
- Using reversed()
- Using backward()
- Using invert()
25. What does the range() function with three parameters represent?
- start, stop, step
- begin, end, increment
- first, last, jump
- initial, final, skip