csci 20 :: book learning challenge 2 (due tues, feb 2)
Submitting your work:

Complete this exercise on your own.

(1) Fill in all of the "Answer" boxes, (2) press "Prepare for printing", then (3) print the answer grid.

Staple all pages together and submit to the instructor on the date listed above.

Questions:

Read C++ Variable Types, C++ Constants/Literals, Variables and types, Variables and answer the following:

Your name:
  1. What must be true about the first letter of a variable name? What characters are allowed in variable names?
    Answer:
  2. Can you use keywords/reserved words for variable names?
    Answer:
  3. What two pieces of information must you supply to declare a variable in a C++ program? Are you required to declare a variable in a C++ program before you use it?
    Answer:
  4. For each of the following pieces of literal data, list the C++ data type (int, char, bool, double) that best goes with that piece of literal data:
    • 0 (zero)
    • true
    • -1234
    • 'Z'
    • 3.1415

    Answer:
  5. What symbol is used in C++ to perform an assignment? What does an assignment statement do to the variable on its left-hand side?
    Answer:
  6. Does the variable number below have a value? What term do we use to describe a variable like number that has not been given a value?
    int number;
    Answer:
  7. Declare and initialize the double variable temperature using the assignment operator to set the initial value to 98.6. Then, declare and initialize the double variable temperature using the constructor initialization described at cplusplus.com.
    Answer:
  8. Label each of the following as literal or variable (although no variables are being declared, it should be easy to identify which C++ would accept as a literal, and which would have to be declared as variables in C++).
    • 'A'
    • hello
    • -99
    • "hello"
    • car9
    • true
    • 9.99
    • x
    • "1234"
    • 0 (zero)

    Answer:
  9. Declare and initialize an int variable (NOT as a #define) CLASS_CAP with the value 24. Use the proper modifier on your declaration so that CLASS_CAP cannot be modified.
    Answer:
  10. What is the purpose of the CinReader class being provided by the instructor?
    Answer:

Total points for this book learning challenge:

150 points