Home »
MCQs »
Python MCQs
Amongst which of the following is / are true about the while loop?
45. Amongst which of the following is / are true about the while loop?
- It continually executes the statements as long as the given condition is true
- It first checks the condition and then jumps into the instructions
- The loop stops running when the condition becomes fail, and control will move to the next line of code.
- All of the mentioned above
Answer: D) All of the mentioned above
Explanation:
While loops are used to execute statements repeatedly as long as the condition is met, they are also used to execute statements once. It begins by determining the condition and then proceeds to execute the instructions. Within the while loop, we can include any number of statements that we want. The condition can be anything we want it to be depending on our needs. When the condition fails, the loop comes to an end, and the execution moves on to the next line of code in the program.