Name: ____________________________________________________ Alpha: _____________Section: ________

Describe help received: _________________________________________________________________

See the bottom for how to submit your work.

Due: Before 0800 on next class day

  1. (10 pts) Read lecture notes for today. Honestly declare how you read the notes.
    1. (10 pts) I read the notes carefully. I have a good understanding of the topics therein.
    2. (10 pts) I read the notes carefully, but I don't really understand the following points well:
      
      
      
      
    3. (0 pts) I didn't read the notes carefully.
  2. [10Pts] Assume the following declarations, and fill in the table.
    
    ifstream fin("data.text");
    int n = 5;
    double x = 1.5;
    char c = 'R';
    
    expressiontype
    cin
    fin
    cin >> x
    cin >> c && c != '.'
    !(fin >> n)

  3. [10pts] Consider the following code:
    
    char next;
    int count = 0, total = 0;
    cin >> next;
           _______________a_______________________
          /                                       \
    while ((next == '0' || next == '1') && count < 3)      
    {      \_________/
                b               c
                               / \
      total = total*2 + next - '0';
              \__________________/
                       d
    
      count = count + 1;
      cin >> next;
    
    }
    cout << total << endl;
    \___________/
          e
    
    
    For each expression denoted left, fill in the type of the expression.
    type
    a
    b
    c
    d
    e

  4. [10pts] Consider the following code:
    
    ifstream fin("foo.txt");
    int count = 0;
    char c = 'x';
    while(fin)
    {
    	if (c == '?')
     		count = count + 1;
    	fin >> c;
    }
    cout << count << endl;
    
    1. What would normally cause the program to exit the while loop?
      
      
      
      
    2. What exceptional condition would cause the program to never enter the while loop?
      
      
      
      
  5. [20 pts] Carefully read the project 1 description and requirements and work on understanding the math behind the row shift and column shift required for parts 4 and 5. Honestly declare how you read the project.
    1. (20 pts) I read the project carefully. I have a good understanding of the topics therein.
    2. (20 pts) I read the project carefully, but I don't really understand the following points well:
      
      
      
      
    3. (0 pts) I didn't read the project carefully.
  6. Project 1 is now starting. Please write by hand the honor pledge below and then sign your name. Turn this in with your homework, on a separate sheet of paper:
    The Naval Service I am a part of is bound by honor and integrity. I will not compromise our values by giving or receiving unauthorized help on project 1.
    
    
    
    
      
    Name: _____________________________

    Signature: _________________________

Turn in (Due: 0800 on the next class day)