Student Corner:
[Submit Sec3]

[Lecture Notes]
[Discussion Board]

Course Info:
[Description]
[Course Outcomes]
[Outcomes Matrix]
[Course Schedule]
[Requirements/HW/Quizzes]
[Class Protocols]
[Exam Info]
[University Policies]
[Announcements]

HW Assignments:
[Hw1] [Hw2] [Hw3]
[Hw4] [Hw5] [Quizzes]

Practice Exams:
[Midterm] [Final]

# CS152 Fall 2021Practice Final

To study for the final I would suggest you:

1. Know how to do (by heart) all the practice problems.
2. Go over your notes at least three times. Second and third time try to see how much you can remember from the first time.
3. Go over the homework problems.
4. Try to create your own problems similar to the ones I have given and solve them.
5. Skim the relevant sections from the book.
6. 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:

1. It is comprehensive.
2. It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test.
3. You should bring photo ID.
4. There will be more than one version of the test. Each version will be of comparable difficulty.
5. 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.
6. 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:

1. Given an attribute grammar suitable for evaluating expressions made from floats, +, -, *.
2. Define the following programming language concepts: (a) S-attributed grammar, (b) L-attributed grammar, (c) side-effect.
3. What is short circuit evaluation? Give a C example of short circuit versus non short circuit evaluation.
4. Define structured programming. Give an example of a multi-level return statement, briefly explain Scheme continuations.
5. 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.
6. Briefly explain how C struct are implemented in memory by the compiler.
7. 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.
8. Differentiate applicative versus normal order evaluation. Give an example using Scheme. Give an example of defining a new macro in Scheme.
9. Define and give an example of the following parameter passing mechanism: Pass by Value, Pass By Reference, and Pass By Value Result.
10. Write a Prolog program that could be used to compute sum_{i=n}^{m} i^2.