New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

CS 61A Midterm 1 Study Guide

by: Scott Lee

CS 61A Midterm 1 Study Guide CS 61A

Scott Lee

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Covers basics and tips for midterm 1.
The Structure and Interpretation of Computer Programs
John DeNero
Study Guide
Computer Science
50 ?




Popular in The Structure and Interpretation of Computer Programs

Popular in Elect Engr & Computer Science

This 3 page Study Guide was uploaded by Scott Lee on Friday September 16, 2016. The Study Guide belongs to CS 61A at University of California Berkeley taught by John DeNero in Fall 2016. Since its upload, it has received 48 views. For similar materials see The Structure and Interpretation of Computer Programs in Elect Engr & Computer Science at University of California Berkeley.


Reviews for CS 61A Midterm 1 Study Guide


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/16/16
Midterm 1 Reminders  This guide was written by Andrew Huang for Spring 2015 Midterm 1.  Here's a bunch of stuff that might help for midterm 1. Consider it a checklist of sorts, that aims to remind you  of common traps and misconceptions as you crunch problems on past exams for practice.    Remember that evaluating the operator is not the same as calling it.  def​ square​(​x​):    r​ eturn​ x ​​ x    >>>​ square ​# Evaluating square (the name) into the function that does squaring  <​func square at 0 ​ ​ ...>  >>>​ square​(​2​+​2​)​ ​# Evaluating square (the name), evaluating 2+2 (the operand  expression), and then calling the squaring function on 4.  16    In order to evaluate a function call, you must always evaluate the operator and then the operands.  Only then do you call the operator on the operands (where you start by drawing a new frame...)  def ​ weird_operator​():    ​print​(​"Aren't I weird?"​)    ​return​ ​lambda​ x​ ​ x ​ x    >>>​ weird_operator​()(​2​+​2​)​ ​# Aren't I weird is printed. 16 is returned  Aren'​ t I weird?  16    Remember return kicks you out of the function it is in. Print does not.  def​ example_with_return( ​ ​x​):    r​ eturn​ x ​​ ​2    x ​/​ ​     def ​ example_with_print( ​ ​x​):    ​print​(​​ ​ ​)    x ​/​ ​     >>>​ example_with_return​(​2​)​ ​# REMEMBER THAT IT'S THE INTERPRETER THAT'S DISPLAYING THE  4 ON THE SCREEN  4  >>> ​ example_with_print( ​ ​​   4  ZeroDivsionError      Remember to never evaluate the body of a function when you define it.  >>> ​​ ef​ boom​ ):       ​return​ ​1​/​0​ ​# Defining boom won't cause an error.  >>>​ boom(​ )​​  but calling it will  ZeroDivisionError    >>>​ ​def​ make_adder​(​n​):​ ​# We don't worry about defining adder yet.        ​def​ adder​(​x​):​ ​# Since we haven't called make_adder.          ​return​ x + ​ ​ n        ​return  ​ adder  >>>​ make_adder​(​4​)​ ​# This evaluates into the adder function that knows n as 4  <​func make_adder​.<​locals​>.​adder at ​0x. ​ ..>  >>>​ make_adder​(​4​)(​5​)​ ​# Here the operator is make_adder(4), and the operand is 5.  9    Remember that Python has special constructs that follow their own rules of evaluation.  Also remember that all data values are either Truth­y or False­y. For example, 0 is the only false  number. The empty string is the only false string.  >>>​ ​1​ ​or​ ​0  1  >>>​ ​0​ ​or​ ​1  1  >>> ​​ ​ ​or​​ ​0  1  >>> ​​ ​ ​or​​ ​0  ZeroDivsionError  >>> ​​ False'​ ​or​​   'False'      Remember that frames and functions both have parents.  The parent of a function is the frame in which the function was defined.  The parent of a frame is the parent of the function that was called in order to create that frame.    Remember that the Global frame does not have parent, nor a return value.    Remember that names bound to values, not expressions. You can never have x ​ ​ point t​  + 2 ​ on  an environment diagram.    Remember that a Lambda expression ALWAYS evaluate into a function  >>>  ​​ ambda​ x,​ ​ y​​ x ​ ​ x​ ​ y ​​ y  <​func < ​ lambda>​ at ​0x​...>    Remember that you can call Lambda functions on the spot.  >>>​ ​(​ ambda  ​ x​​ y​ ​ x ​*​ x ​+​ y ​*​ y​)(​ ​​   25    Remember that to figure out tricky lambda expression problems, you should start by identifying  the operator and then the operands. Then figure out what each lambda function does  ​ independently, before trying to combine them together.    Remember that recursion requires three things:  1. One or more Base Cases  2. One or more ways to make a smaller problem and solve it recursively  3. One or more ways to solve the original problem given the solution to the smaller problem    Remember Domain and Range and use them while working through problems.    Remember Domain and Range and use them while working through problems.    Remember Domain and Range and use them while working through problems.    Lastly...  Students of 61A! Of SICP! My kin.  I see in your eyes the same fear that would take the heart of me.    A day may come when we fail CS exams,  when we forsake our functions and break all layers of abstraction,  but it is not this day.    Two hours of screams and shattered GPAs  when our minds come blanking out,  but it is not this day!    This day we fight!  By all that you hold dear this good Fall,  I bid you stand, Computer Scientists!  


Buy Material

Are you sure you want to buy this material for

50 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Anthony Lee UC Santa Barbara

"I bought an awesome study guide, which helped me get an A in my Math 34B class this quarter!"

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.