COMPUTER PROGRAMMING FUNDAMENTALS
WHAT IS PROGRAMMING
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
the process of repeating a specific book of code an unknown number of times, until a condition is met
|
|
the process of reading a specific block of code an unknown number of times, until a condition is met
|
|
do something while something
|
|
the process of repeating a specific block of code an unknown number of times, until a condition is met
|
Detailed explanation-1: -A while loop repeats a block of code an unknown number of times until a condition is no longer met. for loops, on the other hand, repeat a block of code a fixed number of times. So, a while loop is useful when you don’t know how many times you want a block of code to execute beforehand.
Detailed explanation-2: -A while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. The while loop can be thought of as a repeating if statement.
Detailed explanation-3: -Because the while loop checks the condition/expression before the block is executed, the control structure is often also known as a pre-test loop.
Detailed explanation-4: -If the condition is a simple boolean, the repeat / until loop will execute as long as the condition evaluates to false (in other words until it is true).
Detailed explanation-5: -A “While” Loop is used to repeat a specific block of code an unknown number of times, until a condition is met. For example, if we want to ask a user for a number between 1 and 10, we don’t know how many times the user may enter a larger number, so we keep asking “while the number is not between 1 and 10".