Loop in Python MCQs Exercise I

Ques 1 Loop


What is the output of the following Python Code?

for i in range(0,5):
    print(i)

A 0,1,2,3
B 1,2,3,4
C 0,1,2,3,4
D 0,1,2,3,4,5

Ques 2 Loop


What is the output of the following Python Code?

li=[11,23,22,34,45]
for i in li:
    print(i)

A [11,23,22,34,45]
B 11,23,22,34,45
C [45,34,22,23,11]
D 45,34,22,23,11

Ques 3 Loop


What is the output of the following Python Code?

li=["acb","yxp"]
for _ in li:
    _.sort()
print(li)

A ["acb","yxp"]
B ["abc","pxy"]
C ["cba","yxp"]
D error

Ques 4 Loop


What is the output of the following Python Code?

for _ in range(4,32,3):
    print(_,end=" ")

A 4,8,12,16,20,24,28,32
B 3,7,11,15,19,23,27,31,35
C 4 7 10 13 16 19 22 25 28 31
D Error because we can pass only two argument in loop.

Ques 5 Loop


What is the output of the following Python Code?

for day in ["Sunday", "Monday", "Tuesday","Wednesday","Thursday", "Friday"," Saturday"][::-1]:
    print (day,end=" ")

A Sunday Monday Tuesday Wednesday Thursday Saturday Friday
B Monday Sunday Tuesday Wednesday Thursday Saturday Friday
C Sunday Monday Tuesday Wednesday Thursday Friday Saturday
D Saturday Friday Thursday Wednesday Tuesday Monday Sunday