[ fromfile: controlstructures-questions.xml id: controlstructures-questions ]
What is the difference between a compound statement and a simple statement?
a simple statement is terminated by a ; a compound statement has curly braces {} around a group of simple statements.
How can you guarantee that at least one case will be executed for any given switch
value?
add a default
case.
What are the advantages and disadvantages of the three iteration structures? For each, discuss the kinds of situations that would lead you to prefer using it rather than the other two.
the do..while loop is useful if you want to guarantee that the body is executed at least once. The for loop is useful if you need a counter to be incremented in the loop.
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |