CS 250 Exam 1.

Due no later than Wednesday March 7 at 10:30 a.m.

You may self-schedule this test in any 6 hour window until the test due date. Once you have begun reading the questions your 6 hours will have begun. Do not discuss the test with anyone except me, even after you are finished!

  1. Consider the concrete and abstract syntax of J, described in the book.
  2. a. Draw a concrete syntax tree for the following J statement.
    while (i>0) i = i - 1;
    b. Draw an abstract syntax tree for this statement.
  3. Discuss the pros and cons of automatic garbage collection versus letting/forcing programmers to do it themselves. Use concrete examples and be sure to discuss cases where garbage collection is an absolute necessity.
  4. We have often use Java and C in this course as examples to distinguish major language design choices. Discuss each of the following:
    a. What language factors (discounting execution speed) might lead a programmer to choose Java over C? C over Java?
    b. Assume you are an equally skilled programmer in Java and C. Imagine you have two programs created by run-of-the-mill coders, one written in each language, that are written to accomplish the same task. Your job is to select one of them, make sure it works, and then heavily modify it to do another task. Which one would you select? Why?
  5. You've just been hired by Microsoft to improve their products. You'll have a large number of employees working for you. Your first decision was basically to redesign and rewrite their old programs. These are programs that in some cases will be millions of lines of code. What have you learned in this class that will help? Stick to things covered in this course.
  6. Consider the following simple language. What problems, if any, does it pose for recursive descent parsing such as you've been doing in your homework assignments? If it doesn't pose any problems then write a recursive method that will recognize strings generated by the language (you may assume a nextToken() method exists exists).
    L -> a
    L -> b
    L -> aLa
    L -> bLb
    
  7. Who will be the last Survivor?