Self Test Questions

 < Day Day Up > 



  1. What’s the purpose of the main() function? Why does every C++ program need one?

  2. Describe how disassembling your programs and studying the results can improve your understanding of the C++ language and your computing platform.

  3. What is the purpose of the preprocessor directive #include?

  4. (True/False) You can use the C++ reserved keywords to name your own program objects.

  5. The sizeof operator will return the size of data types in what unit of measure?

  6. You can either memorize C++ operator precedence or use ________________ to force precedence and make source code easier to read at the same time.

  7. Why can an unsigned data type represent a larger positive value than a signed data type?

  8. When negative numbers are shifted to the right using the >> operator what is the effect on the sign bit?

  9. How are string literals terminated?

  10. Study the following code and answer the following questions:

     1  #include <iostream>  2  using namespace std;   3  4  int val1 = 1;  5  6  int main(){  7    {  8      cout<<val1++<<endl;  9      int val1 = ::val1; 10      cout<<val1<<endl; 11    } 12    cout<<val1<<endl; 13  return 0; 14  }
    • What value will the new variable named val1 be initialized to on line 9?

    • Which val1 will be printed to the screen on line 10?

    • What is the value of val1 printed to the screen on line 12?

    • Describe the effect of using the unary scope resolution operator :: on line 9. Why is its use necessary?



 < 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