CBSE Class 11 Computer Science Question 109 of 161

Flow of Control — Question 18

Back to all questions
18
Question

Question 11d

Predict the output of the following code fragments:

x = 45
while x < 50 :
    print (x)

Answer

This is an endless (infinite) loop that will keep printing 45 continuously.

As the loop control variable x is not updated inside the loop neither there is any break statement inside the loop so it becomes an infinite loop.

Answer