CS 251: Programming Languages
Fall 2017
Exam 3 information
1. Notes
You are permitted one letter-size handwritten notes sheet (both sides) for use as a reference during the exam.
2. How to study
Lots of research has shown that reading over material isn't a very good way to prepare for exams. The best thing to do is to practice. Reading how to swing a baseball bat or how to cross-country ski might give you some good ideas on how to get better the next time you try it, but it's not even close to just getting out there and swinging a bat or skiing in the Arb.
How can you practice? Go back to look at the assignments. Can you code selected portions of them from scratch on paper? Can you write down thoughts for all of the topics listed below? Can you invent questions to try for the topics listed below? Practice these under test conditions and see how you do. Even though the solutions may not be available, just trying to do them can be incredibly useful. The ones that involve programming you can put into the computer to see if they work. Otherwise, you can work with other students to see if you think you've got the right answers. Even if you don't know for sure if you've got the right answer, just practicing with these exercises can be helpful.
Go back and pick out all of the content from class that you understand least well. Then, without simultaneously looking at your notes, write down all that you know about that content. Think about what I might ask you to do on an exam that would be scary. Try to do that yourself. If you can't, work with other people in the class or stop by office hours to get help on doing that.
Finally, make sure to do all of your practicing on paper, not at a keyboard, so as to simulate the exam conditions.
3. Exam content
The exam covers everything we have done, except continuations. While the exam is cumulative, we will focus on what was not already tested (starting with recursive descent parsing).People asked me to give more description as to what the exam would be like. So I am going to list some types of things students should be able to do.
Students should be able to:
- Write Scheme and C code on paper to do specified tasks.
- Evaluate Scheme code using the environment model, including drawing environment diagrams as we have done in class.
- Be able to explain what an LL grammar is, and how it is distinguished from an LR grammar. For a simple grammar, assess whether or not it is LL.
- Describe, trace, or otherwise answer questions to show understanding of what recursive descent parsing is, how it works at a high level, and distinguish recursive descent parsing from the kind of parsing that we did for our Scheme interpreter. Be able to produce FIRST, FOLLOW, and PREDICT sets for a particular grammar. Be able to demonstrate how this information would be used in coding a parser.
- Be able to distinguish between a compiler and an interpreter, and reason about tradeoffs between them and ramifications of using one vs. another.
- Show understanding of how C compilation works, with regards to header files and compilation of multiple files. Be able to demonstrate how/why include guards are used.
- Distinguish between static and dynamic scoping, and be able to evaluate trade-offs. Be aware of scoping behaviour for languages regularly discussed in class.
- Explain and answer questions regarding how to manage heap memory; including free lists, segregated free lists, and buddy system techniques.
- Define, explain, compare, and contrast dangling pointer strategies such as tombstones and locks-and-keys; and garbage collection techniques, such as reference counting, mark-and-sweep (including tri-color marking), stop-and-copy, and generational approaches.
- Evaluate the results of pseudocode using different parameter passing methods, including pass by value, by reference, by value-result, and by sharing. Be aware of parameter passing methods for languages regularly discussed in class. Be able to think through considerations regarding how they are implemented underneath.
- Evaluate lambda calculus expressions, and define well-known logical or arithmetic operations on Church booleans or numerals.
-
Regarding the interpreter project: Be able to answer questions about what we did at each stage, and why we did it. Be able to write variations of aspects of the project by writing C code, modifying provided C code, or describing what your technique might be. Specifically, be able to do the above regarding questions about:
- tokenization
- parsing
- frames
- bindings
- lambda expressions
- closures
- primitives / function pointers
As usual, please note that this document is not a contract. I may have inadvertently left something off that ends up on an exam question. Moreover, I will not be able to test all of this material given the time limitations of the exam. I will have to pick and choose some subset of it.