CBSE Class 10 Computer Applications Question 9 of 26

Python Conditionals and Loops — Question 7

Back to all questions
7
Question

Question 7

What is the output of following code ?

while 3 >= 3 :
    print 3
  1. 3 is printed once
  2. 3 is printed three times
  3. 3 is printed infinitely until program is closed
  4. Error in code
Answer

3 is printed infinitely until program is closed

Reason — Since the given condition (3 >= 3) will always remain true, the while loop will execute indefinitely and keep on printing 3 on the output screen till the program is closed.