2024 November 1,
Carleton College, Fall 2024, Dr. Joshua R. Davis, , CMC 324, x4095
For Exam A, we discussed some important concepts in class, that we didn't explicitly practice in homework. In this sense, they slipped through the cracks. And then some students understandably didn't do well with those concepts on the exam.
Exam B is scheduled for Day 22 (Wednesday November 6). To prevent any concept from slipping through the cracks, this page lists some practice questions/problems. It is under construction. I will add more topics and questions as we get closer to the exam. The exam will be focused on recent material — meaning, material that wasn't tested on Exam A. Here is an outline of topics, which I have culled from my notes:
Although Exam B is focused on recent material, earlier material might show up, just because the course material is somewhat cumulative. Moreover, it is possible that I will re-ask a question from Exam A, and not necessarily in the same way as on Exam A. The first question below is another version of Exam A Problem E.
A. Here's a question that's highly relevant to what we've been studying: Is C statically scoped, dynamically scoped, or something else? Don't search the Internet for the answer! The point is to think. But you can't figure out the answer by thinking alone. So here's your problem: In C, write a test program that reveals the answer to the question. Are you unsure how to start? Try to translate the code from Exam A Problem E into C, with one function playing the role of f and g.
B. Assignment K: Tokenizer mentions a little "puzzle". Solve it.
C. Is our Scheme parser more like a top-down parser or a bottom-up parser? Explain, of course.
D. Considering the Scheme interpreter that we are implementing in our project, give an example of a syntax error that is detected while tokenizing, and give an example of a syntax error that is detected while parsing.
E. The Scheme code (define x 3 7) is invalid, because there are too many arguments to the keyword define. At which stage of interpretation is this error detected: tokenization, parsing, or evaluation?
F. The expression (f 7) is buried deep in my Scheme program. Is this expression valid or not? I mean, does it cause an error or not? Or do you need more information? What information? At which stage of interpretation is that information available?
G. Our Scheme interpreter project does not implement '. To implement it, what changes would we need to make, to the code that we've written thus far?
H. Suppose that we are managing heap memory using a buddy system. Write a sequence of mallocs and frees. (On an exam, to expedite grading, I would give you a specific sequence.) Draw several sketches showing how that sequence leads to splitting and reuniting of buddies.
I. Discuss the advantages and disadvantages of reference counting compared to mark-and-sweep garbage collection.
J. Draw an object graph sitting in the active part of a stop-and-copy garbage collector. (On an exam, to expedite grading, I would give you a specific graph.) Illustrate how the stop-and-copy algorithm operates on it. Several sketches are required. Is that too vague? Tell me how the memory looks after the first pointer in the global frame has been completely copied.
K. Something about static versus dynamic typing... What are their advantages and disadvantages? If you were designing a language, which would you pick? Does it matter, what the purpose of that language is?
L. Something about polymorphism...