Berkeley CS 61A - 61a-fa11-final-solutions (14 pages)

Previewing pages 1, 2, 3, 4, 5 of 14 page document View the full content.
View Full Document

61a-fa11-final-solutions



Previewing pages 1, 2, 3, 4, 5 of actual document.

View the full content.
View Full Document
View Full Document

61a-fa11-final-solutions

392 views


Pages:
14
School:
University of California, Berkeley
Course:
Cs 61a - The Structure and Interpretation of Computer Programs

Unformatted text preview:

CS 61A Structure and Interpretation of Computer Programs Final Exam Solutions Fall 2011 INSTRUCTIONS You have 3 hours to complete the exam The exam is closed book closed notes closed computer closed calculator except a one page crib sheet of your own creation and the three official 61A exam study guides which are attached to the back of this exam Mark your answers ON THE EXAM ITSELF If you are not sure of your answer you may wish to provide a brief explanation Last name First name SID Login TA section time Name of the person to your left Name of the person to your right For which assignments do you have unresolved regrade requests All the work on this exam is my own please sign For staff use only Q 1 Q 2 Q 3 Q 4 Q 5 Q 6 Total 12 16 12 18 10 12 80 2 1 12 points What Would Python Print Assume that you have started Python 3 and executed the following statements def oracle a b c if a 42 return b a return c class Big object def medium self d def small e nonlocal d if e 0 d d self medium e e return d return small class Huge Big def medium self d return Big medium self d 1 For each of the following expressions write the repr string i e the string printed by Python interactively of the value to which it evaluates in the current environment If evaluating the expression causes an error write Error Any changes made to the environment by the expressions below will affect the subsequent expressions a 2 pt oracle 41 lambda x 1 0 blue pill blue pill b 2 pt oracle 42 lambda x red pill 1 0 Error c 2 pt Big medium self 2 1 Error d 2 pt Big medium 1 Big medium 2 3 6 e 2 pt Huge medium 4 5 11 f 2 pt Big Huge False Login 3 2 16 points Environment Diagrams a 6 pt Complete the environment diagram for the program in the box below You do not need to draw an expression tree A complete answer will Complete all missing arrows Arrows to the global frame can be abbreviated by small globes Add all local frames created by applying user defined functions Add all missing names in frames Add all



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view 61a-fa11-final-solutions and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view 61a-fa11-final-solutions and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?