1. Compare and contrast the for and the while loops. Make sure you identify in e
ID: 3631117 • Letter: 1
Question
1. Compare and contrast the for and the while loops. Make sure you identify in each case the location of the basic three loop components (initialization, test, and update). USE C++ Examples.2. What is the major difference between the do-while loop on one side and the for and the while loops on the other side. Can an arbitrary task that is implemented with a for/while loop be implemented via the do-while loop? Explain your answer with an example code.
3. Discuss the three types of Event-controlled loops. Provide example C++ statements for each type.
4. Expound the usefulness of both break and continue statements when used with a looping construct.
5. List and discuss at least five different loop testing techniques.
**Answer all the questions or NO points will be rewarded**
Explanation / Answer
1. Compare and contrast the for and the while loops. Make sure you identify in each case the location of the basic three loop components (initialization, test, and update). USE C++ Examples.
for( init i=0; i<10; i++)
int i=0;
while(i<10)
{
i++
}
2. What is the major difference between the do-while loop on one side and the for and the while loops on the other side. Can an arbitrary task that is implemented with a for/while loop be implemented via the do-while loop? Explain your answer with an example code.
using do while loop any taks can be executed atleast once
Can an arbitrary task that is implemented with a for/while loop be implemented via the do-while loop?
YES
3. Discuss the three types of Event-controlled loops. Provide example C++ statements for each type.
for
while
do while
4. Expound the usefulness of both break and continue statements when used with a looping construct.
use of break will exit from loop
while use of continue will skip next steps.
5. List and discuss at least five different loop testing techniques.
for
while
do while
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.