Self Test Questions

 < Day Day Up > 



  1. What characters are used to begin and end compound statements?

  2. How does the if-else statement differ from the if statement?

  3. What control statement can be used in place of nested if-else statements?

  4. Why should a break statement be added to the end of each case of a switch statement?

  5. What’s the purpose of a default case in a switch statement?

  6. What’s the difference between a while and a do-while statement? When would you use a do-while instead of a while statement?

  7. Convert the following while statement to a for statement:

    int i = 0; while(i<10){    //do something    i++; }
  8. What will happen when the following code executes:

    int i = 0; while(i++ < 3){    cout<<"i = "<<i<<endl;    break; }
  9. What happens when the following code executes:

    int i = 0; while(i < 3){    cout<<"i = "<<i<<endl;    continue;    i++; }
  10. True/False: Goto statements can be used to jump outside of functions.



 < Day Day Up > 



C++ for Artists. The Art, Philosophy, and Science of Object-Oriented Programming
C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504028
EAN: 2147483647
Year: 2003
Pages: 340
Authors: Rick Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net