2008SpCS61CMidtermAnswers - University of California,...

Info iconThis 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 .. 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
Background image of page 1

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

View Full DocumentRight 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 . As a result of executing this instruction…
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 10/10/2008.

Page1 / 6

2008SpCS61CMidtermAnswers - University of California,...

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

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