final

final - CS 132, Jens Palsberg Dec 15, 2005 Final Exam Each...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 132, Jens Palsberg Dec 15, 2005 Final Exam Each of the six questions is worth five points, for a total of 30 points. Write your name and id number at the top of the first page you submit. Write the solutions for different questions on different sheets of paper. Dont submit this handout. 1. [Type checking] Consider the following Java program: class P { Q next; void expand() { Q temp; P v; temp = next; v = new P(); next = new Q(); v.next = temp; temp.pred = v; next.insert(this, v); } } class Q { P pred; P succ; void insert(P x, P y) { pred = x; succ = y; } } Show the symboltable at the point where the type checker will try to type check the statement next.insert(this, v); . 2. [Translation] Consider again the Java program from question 1. Make a figure that illustrates a heap layout for a P-object. Present the result of translating the body of the method expand in class P to intermediate code in the style of Piglet, with reasonably detailed comments in the code....
View Full Document

This note was uploaded on 03/14/2008 for the course CS 132 taught by Professor Palsberg during the Winter '05 term at UCLA.

Page1 / 2

final - CS 132, Jens Palsberg Dec 15, 2005 Final Exam Each...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online