Podcast
Questions and Answers
What does a while loop do in programming?
What does a while loop do in programming?
- It executes a block of code for a specific number of times
- It executes a block of code once and then stops
- It repeatedly executes a block of code as long as a specified condition is true (correct)
- It executes a block of code only if a condition is false
When does a while loop stop in programming?
When does a while loop stop in programming?
- When the condition becomes true
- When the program reaches the end of the loop
- When the block of code is executed once
- When the specified condition is false (correct)
What is the main purpose of a while loop in programming?
What is the main purpose of a while loop in programming?
- To execute code once and then move on to the next section
- To execute a block of code for a specific number of times
- To execute code only if a condition is false
- To automate repetitive tasks by repeatedly executing a block of code (correct)