Home > Articles

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

Workshop

The Workshop provides quiz questions to help you solidify your understanding of the material covered and exercises to provide you with experience in using what you’ve learned. Try to answer the quiz and exercise questions before checking the answers in Appendix E, and be certain that you understand the answers before continuing to the next lesson.

Quiz

  1. What is the difference between a signed and an unsigned integer?

  2. Why should you not use #define to declare a constant?

  3. Why would you initialize a variable?

  4. Consider the enum below. What is the value of Queen?

    enum YourCards {Ace, Jack, Queen, King};
  5. What is wrong with this variable name?

  6. int Integer = 0;

Exercises

  1. Modify enum YourCards in quiz question 4 to demonstrate that the value of Queen can be 45.

  2. Write a program that demonstrates that the size of an unsigned integer and a normal integer are the same, and that both are smaller in size than a long integer.

  3. Write a program to calculate the area and circumference of a circle where the radius is fed by the user.

  4. In Exercise 3, if the area and circumference were to be stored in integers, how would the output be any different?

  5. BUGBUSTERS: What is wrong in the following initialization:

    auto Integer;
  • + Share This
  • 🔖 Save To Your Account