Home > Articles > Programming > C/C++

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Review Questions

  1. Why does C++ have more than one integer type?

  2. Declare variables matching the following descriptions:

    1. A short integer with the value 80

    2. An unsigned int integer with the value 42,110

    3. An integer with the value 3,000,000,000

  3. What safeguards does C++ provide to keep you from exceeding the limits of an integer type?

  4. What is the distinction between 33L and 33?

  5. Consider the two C++ statements that follow:

  6. char grade = 65;
    char grade = 'A';

    Are they equivalent?

  7. How could you use C++ to find out which character the code 88 represents? Come up with at least two ways.

  8. Assigning a long value to a float can result in a rounding error. What about assigning long to double?

  9. Evaluate the following expressions as C++ would:

    1. 8 * 9 + 2

    2. 6 * 3 / 4

    3. 3 / 4 * 6

    4. 6.0 * 3 / 4

    5. 15 % 4

  10. Suppose x1 and x2 are two type double variables that you want to add as integers and assign to an integer variable. Construct a C++ statement for doing so.

  • + Share This
  • 🔖 Save To Your Account