csci 20 :: book learning challenge 3 (due tues, feb 9)
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 Operators, Operators, Arithmetic operators, Compound assignment, Type conversion and answer the following:

Your name:
  1. Write a C++ statement below that multiplies numberOne and numberTwo together and assigns the result to result. What will the value of result be after the assignment?
    int numberOne = 7;
    int numberTwo = 3;
    int result = 0;
    Answer:
  2. Write a C++ statement below that subtracts numberTwo from numberOne and assigns the result to result. What will the value of result be after the assignment?
    int numberOne = 99;
    int numberTwo = 98;
    int result = 0;
    Answer:
  3. Write a C++ statement below that divides numberOne by numberTwo and assigns the result to result. What will the value of result be after the assignment?
    int numberOne = 25;
    int numberTwo = 7;
    int result = 0;
    Answer:
  4. What is the value of result after the following statement? How does your text describe the purpose of the operator % (also called modulo or modulus operator)?
    int result = 25 % 7;
    Answer:
  5. What is the value of result after the following statement?
    int result = (5 / 10) * 100;
    Answer:
  6. What is the value of result after the following statement? If the result is different from the question above, briefly explain why the result was different.
    int result = (5 / 10.0) * 100;
    Answer:
  7. What is the value of result after the following statement? What is the term used to describe the operation that static_cast<double> performs? What is the purpose of this operation?
    int result = (static_cast<double>(5) / 10) * 100;
    Answer:
  8. Name and briefly describe the purpose of the ++ and -- operators.
    Answer:
  9. What is the output produced by the cout statement below?
    int value = 9;
    cout << value++;
    Answer:
  10. What is the output produced by the cout statement below?
    int value = 9;
    cout << ++value;
    Answer:

Total points for this book learning challenge:

150 points