COS 371: Programming Languages
Spring 2022
Exam 2 information
1. Allowed materials
You are permitted one letter-size handwritten notes sheet (both sides) for use as a reference during the exam.
You may only use electronic devices (computer, smart phone) to the extent of following exam logistics (below).
In particular, you should NOT use clang
or DrRacket during the exam.
2. How to study
Please see tips from first exam.
3. Exam content
The exam covers everything we have done, up to but not including recursive descent parsing (which was on the pop quiz and may be covered on the next exam). While the exam is cumulative, we will focus on what was not already tested.Students should be able to:
- distinguish clearly between tokenizing and parsing.
- write regular expressions to specify tokens.
- precisely produce a CFG (in standard EBNF notation) for 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.
- draw parse trees, and be able to demonstrate if a grammar is ambiguous.
- discuss the merits of different parse trees that describe the same sentence from the perspective of which is more desirable: associativity, precedence.
- evaluate simple pieces of Scheme code.
- write C code on paper to do specified tasks.
- reason about C memory, including memory allocation, memory leaks, arrays, strings, and Valgrind errors.
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.
4. Logistics
Logistics will be identical to Exam 1; review it if you don't remember the procedure.