CS152 Fall 2021Practice Final
To study for the final I would suggest you:
- Know how to do (by heart) all the practice problems.
- Go over your notes at least three times. Second and third time try to see how much you can remember from the first time.
- Go over the homework problems.
- Try to create your own problems similar to the ones I have given and solve them.
- Skim the relevant sections from the book.
- If you want to study in groups, at this point you are ready to quiz each other.
Here are some facts about the actual final:
- It is comprehensive.
- It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test.
- You should bring photo ID.
- There will be more than one version of the test. Each version will be of comparable difficulty.
- It is 10 problems (3pts each), 6 problems will be on materials since the second midterm, 4 problems will be from the topics of the midterm.
- Two problems will be exactly (less typos) off of the practice final, and one will be off of the practice midterm.
The practice final is below:
- Given an attribute grammar suitable for evaluating expressions made from floats, +, -, *.
- Define the following programming language concepts: (a) S-attributed grammar, (b) L-attributed grammar, (c) side-effect.
- What is short circuit evaluation? Give a C example of short circuit versus non short circuit evaluation.
- Define structured programming. Give an example of a multi-level return statement, briefly explain Scheme continuations.
- Show with code how the following concepts could be rewritten using recursion: Rust for in, Rust loop. For each say how to avoid running out of stack space.
- Briefly explain how C struct are implemented in memory by the compiler.
- Explain how type inference could be used to determine the type of the expression 7 * 3.14 + 5. Sketch the type checking process in OCaml.
- Differentiate applicative versus normal order evaluation. Give an example using Scheme. Give an example of defining a new macro in Scheme.
- Define and give an example of the following parameter passing mechanism: Pass by Value, Pass By Reference, and Pass By Value Result.
- Write a Prolog program that could be used to compute `sum_{i=n}^{m} i^2`.
|