Comp 121

Chapter 5 Study Guide

Chapter 5

 

What is the general format of the while statement?

 

What are the steps the computer goes through to evaluate a while statement?

 

What is missing from the following code segment:

count = 1;

while( count <= 10 )

{

cout << count;

}

If the above code is run what problem will you encounter? How can you fix it?

 

 

What are sentinels and how are they different from fixed-count loops?

 

What statement is used to force an immediate exit from switch, while, for and do-while statements?

 

What does the continue statement do and with which loops can it be used?

 

What is a null statement?

 

What is the general form of a for statement?

 

What is a nested loop?

 

What is the general form of the do statement? How is it different than the while statement?

 

Which loop (while, do, for) is particularly useful for handling validity checks and why?