CS 117
Midterm 2
Ondich
Due 11:10AM, Monday, June 2, 1997

This is an open-book, open-computer exam. You may use your textbook, your notes, your programs, and whatever information you find on the course Web page. You may not consult other books or on-line resources. Do not discuss this exam with people other than Jeff Ondich, who will be glad to answer your questions if he feels it appropriate to do so. If you have questions, ask them. It's not noble to suffer needlessly.

Please submit your exam on paper.

Stay cool, and have fun.

  1. (10 points) Numbers and characters.

  2. (10 points) The program liststrings.p contains several procedures for manipulating linked lists of characters. Write a non-recursive function
    
          function StringLength( str : nodePtr ) : integer;
    
    to return the number of character nodes in the linked list pointed to by str.

  3. (10 points) Write a recursive version of StringLength from the previous problem.

  4. (3 points) Tell me a joke, please.

  5. (15 points) This problem uses the program midtermsort.p.