Question-95: When you run below program, what would happen

n=5

while(n):

    print("Current Value = " , n )

    n=n-1

print("Program Ends, Current Value=" , n)

 

  1. There would be infinite iterations.
  2. Get all Questions and Answer from here
  3. You need to have paid subscription to access all questions
  4. Thanks for considering Python Certification Material

 

Answer: B,E

Exp: As we are reducing value on n by 1 in each iteration. Hence, after 5th iteration n=0. And whenever you use 0 as if condition or while loop, it is considered as False. Hence, no further iterations.

You can access to full explanation to question and answer from this page.

Why Dont you prepare for Python Certifications and Interview Questions with 250+ Questions and Answer : Check Here

Real Exam Number of Questions: 70 Questions
Real Exam Pass Score: 70%
Time Allotted: 90 minutes to complete exam