The final exam will be cumulative.

For sample questions for the material covered for Midterm 1 you should look at this page. For sample questions for the material covered for Midterm 2 you should look at this page.

Sample questions concerning material covered since Midterm 2:

  1. BRIEFLY define the following terms and give an example of how each term is used:
  2. What are some of the key questions that must be answered in order to implement an interpreter that works by first parsing an entire file and then executing the resulting AST (you may indicate other steps of compilation you think should be included before intepretation occurs)?
  3. How is memory generally laid out for a program? What are the various parts of the memory associated with the program used for?
  4. What are the components of an activation record? How is an AR used?
  5. How does a display of AR pointers work and what process(es) does it make more efficient? What are the drawbacks of a display?
  6. Data can be allocated statically, on the stack, or in the heap. What types of variables are the different sections of the program used for?
  7. How is an AR created during code generation? Which parts of the code are responsible for generating the AR? Explain how the different parts of a function call interact during creation of the AR.
  8. Assume you are in the process of writing a function codegen that does code generation for compiling a simple language to an intermediate language similar to the one discussed in class. What would your codegen routine generate for an addition operator?
  9. How are objects represented in memory during code generation when inheritance occurs? What are the key issues for code generation and inheritance?
  10. Explain how dynamic dispatch works for code containing objects with respect to inheritance. Give an example that illustrates your explanation.
  11. Compilers often generate intermediate code from an AST rather than generating machine code? Why? Are there disadvantages to this approach?
  12. What are some of the optimizations that can be done on our code that is generated. Give an example of each.
  13. It is often the case that local optimizations are very simple. How then can they have such profound effects on code? Give an example to illustrate your point.