Home > Articles > Programming > C/C++

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


Now that you've learned about variables and constants, you can answer a few questions and do a couple of exercises to firm up your knowledge about them.


  1. Why would you use unsigned over signed integers?

    1. They hold more numbers.
    2. They hold more positive numbers.
    3. There's no reason to prefer one over the other.
  2. Are the variables ROSE, rose, and Rose the same?

    1. Yes
    2. No
    3. None of your business
  3. What is the difference between a #define constant and const?

    1. Only one is handled by the preprocessor.
    2. Only one has a type.
    3. Both a and b


  1. B. Unsigned integers hold more positive values and cannot be used to hold negative values. They hold the same number of values.

  2. B. Because C++ is case sensitive, a ROSE is not a rose is not a Rose. Each reference is treated as a different variable by the compiler.

  3. C. The preprocessor directive #define substitutes the specified value into your code every place it appears in code. It does not have a data type and is invisible to the compiler. A constant, created with the keyword const, has a data type and is handled by the compiler.

  • + Share This
  • 🔖 Save To Your Account