


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Main points of this exam paper are: Tiger Interpreter, Programming Language, Primitive Type, Type Float, Explicit Declaration, Index Variable, Lisp System, Excecution, Accessible Heap, Heap Cells
Typology: Exams
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Department of Electrical Engineering and Computer Sciences Computer Science Division
Prof. R. Fateman Fall, 2001
CS 164 Midterm 2: October 31, 2001, 9:00AM
Please read all instructions carefully. There are 6 questions in the exam on 4 pages. Some questions have multiple parts. You have 50 minutes to complete this test. The exam is closed book but you may refer to your one page (2-sides) handwritten 8.5 by 11 inch paper. Please write your answers in the space provided. You may use the backs of the exam pages for scratch space. Solutions will be graded on correctness. Partial credit will be given. Your family name Your first name Your LOGIN NAME PRINTED IN CAPITAL LETTERS CS164- Underline the name of your Teaching Assistant: James Lee, Johnathon Jamison READ AND SIGN THIS: I certify that my answers to this exam are all my own work.
Signed:
question grade out of 1 20 2 10 3 20 4 5 5 5 6 10 total 70
1 : S → E$ 2 : E → T 3 : E → E; T 4 : T → ε 5 : T → T a
Construct the LR(0) item sets for this grammar, point out the conflict that arises, and identify what type of conflict it is. Compute FOLLOW(S), FOLLOW(E), and FOLLOW(T ). Argue that since a /∈ FOLLOW(E), these conflicts can be resolved with 1 token of looka- head. Use the reverse of this page for your work.
Mark the location P if it will not Parse. Mark the location T if it will fail Type Checking. If there are no errors, write OK. Give some explanation as to why the failure occurs. If you are not sure what will happen explain that too. If you think there are several errors, such that if you correct the first one, there are still others, mention them all.
a. At time t, just before this GC, how many cells are on the free list?
b. Just after this GC, how many cells are on the free list?
c. Calculate how long the GC took (show work).
d. What is the cost (in seconds) per cell reclaimed?
e. What is the cost (in seconds) per cell reclaimed under the same circumstances if the heap contains 0.30 million cells?