A. How many times will a loop with header for count in range(5): execute statements in its body?
a. 5 times b. 4 times
c. 6 times d. 3 times
B. What will be the output of the following program?
count = 35
for x in range(0,10):
count = count – 1
if x == 2:
break
print(count)
a. 35 b. 32
c. 35, 34 , 33 d. 34, 33, 32
C. What will be the output of the following program?
Z = 1
while Z<>
if Z % 7 == 0:
break
Z = Z + 2
print(Z)
a. 5 b. 3
c. 4 d. 2
D. What will be the output of the following program?
My_str = “I LOVE PHYTHON”
count = 0
for char in my_str:
if char == “O”:
continue
else:
count = count + 1
print(count)
a. 10 b. 9
c. 11 d. 12
E. What will be the output of the following program?
my_str = “I LOVE PYTHON”
count = 0
for char in my_str:
count = count + 1
if char == “E”:
break
print(count)
a. 11 b. 13
c. 10 d. 12
Leave a Reply