ANSWERS: 3
  • The do while construct consists of a block of code and a condition. First, the code within the block is executed, and then the condition is evaluated. If the condition is true the code within the block is executed again. This repeats until the condition becomes false. Because do while loops check the condition after the block is executed, the control structure is often also known as a post-test loop. Contrast with the while loop, which tests the condition before the code within the block is executed. So it is different from the while loop because while loop first check the condition then execute the loop and in this case the query will be executed at least once.
  • The do while loop is same as while loop except that the condition is checked after the execution of statements in the do..while loop, Hence in do..while loop, statements inside the loop are executed atleast once. However, in while loop, since the condition is checked before, the statements inside the loop will not be executed if the loop condition is false. Syntax: Do < Statement1; Statement2 >While (condition expression); In the above example the statement1 and statement2 are executed and the condition is checked. If the condition is true then the statements are executed again and if the condition is false then the control is transferred to the next statement after the do..while statement. Farlow (tutor) examville.com
  • Do..while is exit control loop. I will execute the statements first then it will check the condition. syntax: do { statements; }while(conditioin)

Copyright 2023, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy