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?

  1. It continually executes the statements as long as the given condition is true
  2. It first checks the condition and then jumps into the instructions
  3. The loop stops running when the condition becomes fail, and control will move to the next line of code.
  4. 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.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.