Test 1 CSCI 130 Spring 2003


  1. (10 points) What is an algorithm? Discuss how the algorithm is used in the analysis and specification phase and in the implementation phase.

  2. (5 points) What is a compiler and what does it do?

  3. (5 points) What is a syntax error? Give an example of C++ code that contains a syntax error.

  4. (5 points) Programs must be documented. Given an example of C++ code that is self documenting. Explain your example.

  5. ( 5 points) What is a variable? Give an example of how to declare a variable.

  6. (5 points) Describe one of the problem solving techniques mentioned in the book.

  7. (10 points) Give the rules for constructing a valid variable name. Give an example of an invalid name that violates each rule, identify the problem. Give a valid variable name.

  8. (12 points) Give the basic syntax of any C++ program

  9. (3 pts) Describe the data type char.

  10. (15 pts) Trace the execution of the following code:
    int main () {
        char v1, v2, v3;
    
        v1 = 'a';
        v2 = 'i';
        v3 = v1;
    
        cout << v1 <<"__" << v2 << "__" << v3 << endl;
    
        v1 = v3;
        v3 = '?';
    
        cout << v1 <<"__" << "v2" << "__" << v3 << endl;
        cout << "All Done" << endl;
    
        return 0;
    }