Python-by-codemistic / 8-weeks-of-python

Learn Python from basics to intermediate in 8 weeks.
MIT License
0 stars 11 forks source link

MCQ's while loop #13

Closed ghost closed 4 years ago

ghost commented 4 years ago

Python Tutorial

Topic: Python while Loop(https://codemistic.in/python/while-loop-python.html)


Q1. Which of these loops will not finish?

1) i = 1 
  while i <= 10:
    j = i * 3
    print (j)
    i = i + 2
    
2) i = 1
  while i != 20:
    j = i * 5
    print (j)
    i = i + 2
3) i = 1
  while True:
    j = i * 7
    print (j)
    break
    i = i + 2
4) i = 1
  while True:
    j = i * 10
    print (j)
    i = i + 2
    if j == 20:
      break

A. 3 & 2

B. 2 & 3

C. 2 & 4

D. 4 & 3