Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [10pts] For each of the below, circle expression, statement or neither appropritely.

    1. expression statement neither: 3+x
    2. expression statement neither: int y;
    3. expression statement neither: 3 + x /
    4. expression statement neither: y = 3
    5. expression statement neither: y = x+5;
  2. [10pts] Assume the following delcarations fill in the table.
    int n = 5;
    double x = 1.5;
    char c = 10*n + 2;
    n + x
    n = x
  3. [10pts] Explain why cout << (3.5*5)/4 results in 4.375 being printed to the screen, but cout << 3.5*(5/4) results in 3.5 being printed to the screen.
  4. [10pts] With super vision you look into your computer and see that a particular byte in memory has contents 00101011. If we interpret that byte as a char, what character does it represent? If we interpret that byte as a bool, what boolean value does it represent? Explain your answers!
  5. [60pts] Write a program that reads in a 3-letter word in lowercase letters and prints out the same word with the first letter capitalized. A typical run of the program should look like:
    Input a 3-letter word in lowercase letters: cat
    With leading letter capitalized this is   : Cat
    Hint look at the ASCII table and think about how to go from the ASCII value of a lowercase letter to the ASCII value of the same letter in uppercase.
Turn in a printout of this cover sheet with your answers to the questions, your source code, and a screen capture of your program running.