Page 1 - Home Assignment - ITERATIVE STATEMENT
P. 1
Computer Science
Class – XI
Topic: Iterative Statements
1. What will be the output of the following code fragment?
for i in range(1, 10):
pass
print(i)
2. Convert the following while loop into equivalent for loop:
x=5
while(x<10):
print(x+10)
x=x+2
3. Convert the following for loop into equivalent while loop:
for k in range(10, 20, 5)
print(x+10)
4. Differentiate between break and continue statements using examples.
5. What is an infinite loop? Give one example.
6. What will be the output of the following code fragment?
a) a = 110
while a > 100:
print(a)
a -= 2
b) for i in range(20,30,2):
print(i)
c) country = 'INDIA'
for i in country:
print (i)
d) i = 0
sum = 0
while i < 9:
if i % 4 == 0:
sum = sum + i
i = i + 2
print (sum)
e) for x in range(1,4):
for y in range(2,5):
if x * y > 10:
break
print (x * y)