More Inventory of midterm problems 

Forum: Com Sci 221, U Chicago, Autumn 2001, Old Classwork
Re: News Take-home midterm exam, due 5 November (Mike O'Donnell)
Date: 2001, Oct 30
From: Mike O'Donnell <odonnell@cs.uchicago.edu>

Here is a review of the 5 problems on the take-home midterm exam. I encourage you strongly to focus your studying based on this review.

  1. abstract syntax, pre/in/post/mixfix, evaluation. You will get most of the points on this problem if you can convert correctly between abstract syntax trees, prefix, infix, postfix, and mixfix versions of an expression, and describe machine code evaluating the expression. There's a final kicker to the question, requiring you to really understand the structural relationship between the evaluation code and the abstract syntax tree, and to draw general conclusions from that relationship.

  2. context-free grammar. This problem deals with an alternative to the use of gimmicks in a grammar to enforce precedence and/or associativity restrictions. Instead of introducing new nonterminal symbols, we can use an intuitively appealing, but ambiguous, grammar. Then, we can introduce additional restrictions on the derivation trees to eliminate some or all of the ambiguity.

  3. structured programs. This problem explores the structural relationship between pure iterative programs and their flowcharts. The syntax of the program enforces a disciplined hierarchical structure on the flowchart. A comparison illustrates how that structure becomes more complicated when we deviate from pure iterative programming.

  4. reasoning with invariants. I define a weird arithmetic function of two arguments by means of some equations. I give you an invariant. You write the simple iterative procedure to compute the function using the given invariant. Although the notation looks different, the structure is quite similar to the efficient exponentiation procedure that we studied in one of the lectures. This problem is a variation on Problem 3 from the 1994 mideterm. The point of the problem is to work with the precise correspondence between invariant and procedure. Although the information about the weird function provides a recursive definition, you should not think about making the iteration mimic the recursion. Do not look for any clever mathematical optimizations of the function definition. There might be some that I didn't notice. But I am asking for the most direct implementation of the given invariant, not for the most clever or efficient way to compute the given function.

  5. datatypes. Describe the calculation of l values and r values in a given assignment command. You don't need to give the formulae for calculating the values, but you must be precise about which values are calculated from which other values, in what order.



Mike O'D.


Messages

1. Question L and R values in retrospect by Avi Schwab, 2001, Nov 05

to: "Inventory of midterm problems"