DOC PREVIEW
MIT 6 01 - Sample Midterm Exam

This preview shows page 1-2-3 out of 10 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

6 01 Spring Semester 2008 Sample Midterm Exam Distributed March 16 1 MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6 01 Introduction to EECS I Spring Semester 2008 Sample Midterm Exam Distributed March 16 Ground Rules This is a sample midterm to help you study and to give you a sense of what kinds of problems to expect on the real midterm You can pick up the midterm in 34 501 the 6 01 lab on Wednesday May 19 any time between 8 30AM and 7 00PM and return it within 3 hours after you pick it up If you plan to print out your answers good idea we suggest that you work out the mechanics of how you are going to print before you pick up the exam My dog ate my printer is not a valid excuse for being late When you pick the exam up you ll see the following instructions Read through this exam and ask any questions you have before you leave If you find that you have a question after that try to pick your own answer and write down what assumption you re making We will not answer your questions after you ve left the room Turn the exam in to room 34 501 the 6 01 lab at most three hours after you pick it up You may turn in your solution early but late papers will be penalized 10 of the grade value for every ten minutes you are late For the problems that ask you to write Python code you should just think it through and write down the code You must not try to actually debug it it will take too long Don t spend time trying to be sure the syntax is correct It s more important to communicate your ability to think algorithmically than to worry about the fine grained details of syntax Be sure to add comments that explain what you re trying to do We expect you to spend less than an hour per question The extra time is to let you relax and think Your answer may be handwritten or typed it should be legible in either case We reserve the right to refuse to grade illegible papers Label your answers clearly we won t look through long printouts for something that looks like an answer You may read anything you like labs books the web during the exam but you may not communicate with anyone else When you turn in your paper the sheets must be stapled together and you must have your name and section number on each sheet Papers that do not do this will not be graded and you will not get credit for the exam 6 01 Spring Semester 2008 Sample Midterm Exam Distributed March 16 2 Programming Soar as you recall contains a procedure sonarDistances which returns the list of distances reported by the robot sonars For this problem assume that there is only one sonar and that the procedure readSonar returns that sonar reading as a single number You ve undoubtedly noticed that the robot sonars sometimes give flaky readings So it might be useful to have a procedure like readSonar but which returns the entire history of sonar readings or the average of the sonar readings over several calls or the minimum and maximum readings In this problem we ll ask you to implement such a procedure Please use only the basic functions built into Python e g don t use fancy packages you might find on the Web We ll start with the following class class RangeTracker def init self self saved def values self self saved append readSonar return self saved The RangeTracker class behaves as follows assuming that the first few sonar readings are 10 9 11 and 12 rt RangeTracker rt values 10 rt values 10 9 rt values 10 9 11 rt values 10 9 11 12 6 01 Spring Semester 2008 Sample Midterm Exam Distributed March 16 3 Question 1 Add methods to the RangeTracker class to return the maximum and minimum of the saved values one method for each Question 2 The mean or average of a set of N numbers x1 xN is the sum of the x s over the number of x s N 1 X x xi N i 1 Add a method to the RangeTracker class that returns the mean of the sonar readings Question 3 The standard deviation of a set of numbers is a measure of how spread out the numbers are around the mean It can be computed as v u u u t 1 X xi x 2 N 1 N i 1 Add a method to the RangeTracker class that returns the standard deviation of the sonar readings Question 4 Add a method to the RangeTracker class that takes a function f as an argument and returns the mean of the values of f applied to each of the x values That is 1 X f xi N N i 1 Question 5 The above parts of the problem asked you to add new methods to the RangeTracker class An alternative way to add new methods without modifying the original class is to use inheritance Define a new class called TrackerWithReset a subclass of RangeTracker that has a reset method that reinitializes the list of saved values to the empty list In assessing your performance on this programming problem we re interested not only in whether your programs return the right answers but in whether your code is and shows good style The definition of good style is somewhat idiosyncratic but for us it includes things like Do you reuse pieces of code to achieve compactness and clarity for example does your code for computing the standard deviation make use of your code for computing the mean Do you take advantage of list comprehension rather than writing explicit for or while loops It is not necessary for you to test and debug your code We won t be taking off points for trivial syntax errors Similarly on the final exam we may ask you to write code but we certainly won t expect you to run and debug it Helpful hint The mean of the set of numbers 1 2 3 10 is 5 5 and the standard deviation is 3 02766 6 01 Spring Semester 2008 Sample Midterm Exam Distributed March 16 4 Feedback control In lab for week 6 you programmed the robot to drive down the center of a narrow corridor maintaining a desired distance desired from the center You used a control algorithm based on the error e n ddesired n d n where d n is measured distance to the left of the center You modeled the robot s dynamics by d n d n 1 V T n 1 n n 1 T n 1 where n is the angle of the robot heading n is the robot s angular velocity V is the robot s forward speed and T is the time step You then implemented a control law that produced values for n Suppose n is specified …


View Full Document

MIT 6 01 - Sample Midterm Exam

Documents in this Course
Week 1

Week 1

3 pages

Op-Amps

Op-Amps

8 pages

Op-Amps

Op-Amps

6 pages

Syllabus

Syllabus

14 pages

Planning

Planning

14 pages

Load more
Download Sample Midterm Exam
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Sample Midterm Exam 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 Sample Midterm Exam 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?