final - CS 132 Jens Palsberg Final Exam Each of the six...

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

View Full Document Right Arrow Icon
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. Don’t 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. 3. [Stack layout] Consider again the Java program from question 1. Make a figure that
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern