COMPUTER SCIENCE AND ENGINEERING
ALGORITHMS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
while loop
|
|
for loop
|
|
if loop
|
|
indentation
|
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: -The repeat / until loop is a loop that executes a block of statements repeatedly, until a given condition evaluates to true . The condition will be re-evaluated at the end of each iteration of the loop, allowing code inside the loop to affect the condition in order to terminate it.
Detailed explanation-3: -Loop statement lets you repeat a number of statements either all the time that an expression returns True or until an expression returns True.
Detailed explanation-4: -The while() loop repeats as long as the condition is true (non-zero). If the condition is false the body of the loop never executes at all.
Detailed explanation-5: -Answer: (d) While. A While loop is a conditional loop that will repeat the instructions within itself as long as a condition remains true.