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


c is the correct option





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


b is the correct option





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


d is the correct option





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.


c is the correct option





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


d is the correct option