CBSE Class 11 Computer Science Question 9 of 42

Practice Paper — Question 9

Back to all questions
9
Question

Question 9

Find the output of the following:

for i in range(20, 30, 2):
    print (i)

1.

21  
22  
23  
24  
25

2.

21  
23  
25  
27  
29

3. SyntaxError
4.

20  
22  
24  
26  
28 
Answer
20
22
24
26
28

Reason — The code uses a for loop with range(20, 30, 2), generating numbers from 20 to 28 with a step of 2. It iterates through these values, printing each number (20, 22, 24, 26, 28) on a new line.