CS 257
Exam
Due 8:30AM Wednesday, May 21, 2003

This is an open-book, open-Internet exam. Don't talk people other than Jeff Ondich about this exam. If you get ideas from web sites or books (I'm asking for arguments and opinions in some cases, and you may find yourself seeking ideas on the web), provide thorough citations. Have fun.

  1. (8 points) Summarize the arguments for and against comments. Be clear and concise. Include two brief examples of situations where you consider comments essential, and two brief examples of bad comments.

  2. (8 points) Summarize the arguments in favor of assertions. In what situations are they obviously valuable? What, if any, dangers does their use pose? Summarize the arguments for and against leaving assertions turned on in shipping code.

  3. (8 points) Six months after graduating in 1998, one of our CS majors who went off to become a programmer (and whose stock options have made him quite wealthy) wrote to me raving about a paper that I needed to read and then start teaching to my students. The paper, "Hungarian Notation" by Charles Simonyi of Microsoft, describes Simonyi's naming system for identifiers (variables and constants, in particular). I'm having trouble finding an original citation (or title, for that matter), but there are copies of the paper at Microsoft and elsewhere.

    Read Simonyi's paper, and then answer the following questions.

  4. (8 points) In "The UNIX-HATERS Handbook" (Simson Garfinkel, Daniel Weise, Steven Strassmann, IDG Books Worldwide, 1994), there is a section on the find command. This section begins with this quote from Patrick Sobalvarro: "The most horrifying thing about Unix is that, no matter how many times you hit yourself over the head with it, you never quite manage to lose consciousness. It just goes on and on." Though generic as complaints go, the placement of this quote at the top of this section suggests that the authors are not fond of the find command.

  5. (3 points) Most people have had some experiences that they consider amazing, maybe life-changing--the "you haven't lived until you've done X" sorts of things. Tell me something that you have done that you think I should do, too.

  6. (8 points) One of the things programmers have to do is learn APIs (Application Programmers' Interfaces). People write libraries, and many times, you'll want to or need to use them. Want to write programs for Palm OS? You'll need to learn at least part of the Palm OS API. Want to use Microsoft's speech recognition and text-to-speech tools? You'll need to learn SAPI--the "Speech API."

    One very handy API is the regex API, which is included as a component of the POSIX standard. For this problem, I want you to write a C/C++ program that uses the regex API to print out all lines of a given file that contain names of months. I know you can do this easily enough with grep, but I want you to learn to use regex, and this is a simple application. Note, by the way, that a line containing "maybe" or "marchers" should not necessarily get printed--I want you to match whole words, not portions of words.

  7. (10 points) CVS (Concurrent Versions System) is a great tool. Jeremy White referred to version control systems as "the truth and the light" in class the other day, and I am sure he likes CVS in particular. CVS is designed to help you keep control over your source code whether you are a solo programmer or on a team, and it is also very useful for data of other kinds. If you haven't learned it yet, here's your chance to get started.

    Go to http://www.cvshome.org/ and get the CVS manual (also known as "the Cederqvist" after its author). It's available in pdf and HTML form. Then, do the following.

    That's a start. We'll talk more about CVS later.