CS 251: Exam 2 Info

Notes sheet

You are permitted one 8.5 x 11 handwritten notes sheet (both sides) for use as a reference during the exam.

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 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.

Exam content

Listed below is the material that I have in mind that you should know for the exam. It's what's in my head when creating it. That said, this isn't a contract. I may have inadvertently left something off this list that ends up on an exam question. I make no guarantees that the exam will be 100% limited to items listed below. 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.

Students should be able to…

Regarding the interpreter project: Be able to answer questions about what we did at each stage so far, 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 the linked list, talloc, and tokenizer portions of the project. (Likewise for the warmup vector assignment.)

Be able to distinguish between a compiler and an interpreter, describe how each works in "classic" simple scenarios as well as in "hybrid" modern scenarios (such as with DrRacket and CPython), and reason about tradeoffs between them and ramifications of using one vs. another.

Be able to motivate what purpose BNF serves. Be able to precisely produce BNF to describe a language that I describe in words and/or examples, as well as use derivations in order to show if a particular "sentence" is valid in a particular language. Be able to draw parse trees, and be able to demonstrate if a grammar is ambiguous. Be able to discuss the merits of different parse trees that describe the same sentence from the perspective of which is more desirable.

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 how it distinguishes from the parsing approach that we'll be using in the interpreter project.

Be able to reason about C memory, including memory allocation, memory leaks, strings, and valgrind errors. 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.

Be able to distinguish clearly between tokenizing and parsing.