{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

2008SpCS61CMidtermAnswers

2008SpCS61CMidtermAnswers - University of California...

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

View Full Document Right Arrow Icon
University of California, Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences Spring 2008 Instructor: Dr. Dan Garcia 2008-03-09 CS61C Midterm After the exam, indicate on the line above where you fall in the emotion spectrum between “sad” & “smiley”... Last Name Answer Key First Name Student ID Number Login cs61c- Login First Letter (please circle) a b c d e f g h i j k l m Login Second Letter (please circle) a b c d e f g h i j k l m n o p q r s t u v w x y z The name of your LAB TA (please circle) Ben Brian Casey David Keaton Matt Omar Name of the person to your Left Name of the person to your Right All the work is my own. I had no prior knowledge of the exam contents nor will I share the contents with others in CS61C who have not taken it yet . (please sign ) a) Instructions (Read Me!) Don’t Panic! This booklet contains 6 numbered pages including the cover page. Put all answers on these pages; don’t hand in any stray pieces of paper. Please turn off all pagers, cell phones & beepers. Remove all hats & headphones. Place your backpacks, laptops and jackets at the front. Sit in every other seat. Nothing may be placed in the “no fly zone” spare seat/desk between students. Question 0 (1 point) involves filling in the front of this page and putting your name & login on every front sheet of paper. You have 180 minutes to complete this exam. The exam is closed book, no computers, PDAs or calculators. You may use one page (US Letter, front and back) of notes and the green sheet. There may be partial credit for incomplete answers; write as much of the solution as you can. We will deduct points if your solution is far more complicated than necessary. When we provide a blank, please fit your answer within the space provided. You have 3 hours...relax. Question 0 1 2 3 4 5 Total Minutes 1 36 36 36 36 36 180 Points 1 14 15 15 15 15 75 Score 1 14 15 15 15 15 75
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
Name: _________ Answers ______________________ Login: cs61c-____ 2/6 Question 1: Potpourri: hard to spell, nice to smell… (14 pts, 36 min) Questions (a) and (b) refer to the C code to the right; pretend you don’t know about MIPS yet. a) In which memory sections (code, static, heap, stack) do the following reside? arg stack arr static *str heap val code #define val 16 char arr[] = "foo"; void foo(int arg){ char *str = (char *) malloc (val); char *ptr = arr; } sizeof sizeof(arr) != sizeof(ptr) ++ (arr++ crashes, ptr++ does not) b) Name a C operation that would treat arr and ptr differently: ________________________________ You peek into the text part of an a.out file and see that the left six bits of an instruction are 0x02 .
Image of page 2
Image of page 3
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