CS 190 Exam 1 Fall 2010

Similar documents
Question: Total Points: Score:

Question: Total Points: Score:

CS 1301 Exam 1 Fall 2011

Section 003 Fall CS 170 Exam 2. Name (print): Instructions:

Section 003 Fall CS 170 Exam 1. Name (print): Instructions:

CS 110 Exam 2 Spring 2011

CS 190 Exam 2 Fall 2014

CS 1301 Exam 1 Fall 2014

CS 1301 Exam 1 Fall 2014

Question: Total Points: Score:

CS 1301 Exam 1 Fall 2010

CS 1301 Exam 2 A Fall 2015

CS 1301 Exam 3 Spring 2014

Instructor: Yu Wang 11/16/2012

CS 1301 Exam 1 Spring 2011

CS 1301 Exam 1 Fall 2010

Question: Total Points: Score:

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print):

CS 1301 Exam 1 Spring 2014

Question: Total Points: Score:

Question: Total Points: Score:

CS 1301 Exam 2 A Fall 2015

CS 170 Exam 1. Version: B Fall Name (as on OPUS):

CS 170 Exam 2. Version: A Spring Name (as in OPUS) (print): Instructions:

CS 170 Exam 1. Version: C Fall Name (as on OPUS):

CS 1301 Exam 2 Fall 2013

CS 2316 Exam 4 Fall 2012

CS 170 Section 3, Spring 2015 Programming in Java Midterm Exam 1. Name (print):

Exam Percentage: / 55 = %

CS 2316 Exam 1 Spring 2013

CS 1301 Exam 1 Fall 2013

CS 1301 Exam 1 Spring 2014

Question: Total Points: Score:

CS 1301 Exam 2 Fall 2014

CS 155 Exam 2 Spring 2015

CS 2316 Exam 4 Fall 2011

Question: Total Points: Score:

Your (printed!) Name: CS 1803 Exam 3. Grading TA / Section: Monday, Nov. 22th, 2010

CS 1301 Exam 1 Fall 2013

CS 1803 Fall 2010 Exam 1

Question: Total Points: Score:

CS 2316 Exam 4 Fall 2012

Question: Total Points: Score:

CS Name : Grading TA:

Place your name tag here

Section 004 Spring CS 170 Exam 1. Name (print): Instructions:

CS 110 Exam 2 Fall 2011

CS 170 Exam 2. Version: A Fall Name (as in OPUS) (print): Instructions:

CS 1803 Fall 2010 Exam 1

CS 110 Exam 1 Fall 2011

CS 170 Exam 2. Version: A Spring Name (as in OPUS) (print): Instructions:

CS 1301 Exam 3 A Spring 2015

CS 1301 Exam 2 Fall 2010

CS 170 Exam 2. Section 004 Fall Name (print): Instructions:

Question: Total Points: Score:

CS 1301 Exam 1 Spring 2015

CS 2316 Exam 4 Fall 2014

CS 1301 Exam 3 Fall 2014

CS Exam 2 - Spring 2010

CS 1301 Exam 3 Spring 2012

Question: Total Points: Score:

CS 2316 Exam 4 Fall 2011

CS 1301 Exam 2 Spring 2014

CS 2316 Exam 1 Spring 2014

Section 002 Spring CS 170 Exam 1. Name (print): Instructions:

CS 2316 Exam 4 Spring 2013

CS 2316 Exam 2 Summer 2011

CS 2316 Exam 3 Fall 2011

CS Exam 3 - Spring 2010

CS 2316 Exam 3 Spring 2013

Question: Total Points: Score:

Question: Total Points: Score:

CS 1301 Post Exam 3 Practice Spring 2016

CS Exam 3 - Spring 2010

CS170 (005): Introduction to Computer Science Exam 2

CS 2316 Exam 4 Spring 2012

CS Exam 2 Name: Your Grading TA: This exam has 7 pages including the title page. Please check to make sure all pages are included.

CS 2316 Exam 3 Fall 2012

CS 111X - Fall Test 1

CS 1301 Exam 3 Fall 2010

Question Possible Points Earned Points Graded By GUI 22 SQL 24 XML 20 Multiple Choice 14 Total Points 80

CS 1301 Exam 1 Answers Fall 2009

CS 2316 Exam 3 Summer 2014

Your (printed!) Name: CS 1803 Exam 2. Grading TA / Section: Monday, Oct 25th, 2010

CS 111X - Fall Test 1 - KEY KEY KEY KEY KEY KEY KEY

CS 1301 Exam 1 Fall 2009

This exam has 10 pages including the title page. Please check to make sure all pages are included.

what is an algorithm? analysis of algorithms classic algorithm example: search

CS112 Spring 2012 Dr. Kinga Dobolyi. Exam 2. Do not open this exam until you are told. Read these instructions:

(the bubble footer is automatically inserted into this space)

Spring 2017 CS 1110/1111 Exam 2

CS143 Final Fall 2009

Spring 2017 CS 1110/1111 Exam 1

CS 1044 Program 6 Summer I dimension ??????

Page: Total Points: Score:

Review of Engineering Fundamentals CIVL 4197

EECS 470 Midterm Exam Answer Key Fall 2004

University of Jordan Faculty of Engineering and Technology Mechatronics Engineering Department

Exam 1. CSI 201: Computer Science 1 Fall 2018 Professors: Shaun Ramsey

Decision Logic: if, if else, switch, Boolean conditions and variables

Transcription:

CS 190 Exam 1 Fall 2010 Name (print): Integrity: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking of this exam in compliance with the Honor Code of Emory University. Do NOT sign nor take this exam if you do not agree with the honor code. Instructions: Keep your eyes on your own paper. Do your best to prevent anyone else from seeing your work. Do NOT communicate with anyone other than the professor/proctor for ANY reason in ANY language in ANY manner. Do not use notes, books, calculators, etc during the exam. Turn all mobile devices off and put them away now. You cannot have them on your desk. Write neatly and clearly. What I cannot read, I will assume to be incorrect. Academic misconduct will not be tolerated. You are to uphold the honor and integrity bestowed upon you by Emory University. Penalties for misconduct will be a zero on this exam, an F grade in the course, and/or other disciplinary action. Time: This exam has 9 questions on 9 pages including the title page. Please check to make sure all pages are included. You will have 50 minutes to complete this exam. I commit to uphold the ideals of honor and integrity by not betraying the trust bestowed upon me as a member of the Emory community. I have read and understand the requirements outlined above. Signature: Page: 2 3 5 6 7 8 9 Total Points: 12 15 20 9 12 14 18 100 Score: 1

1. Multiple Choice. Choose the best answer and circle your answer. (a) (2 points) A cyborg is. A. a robot. B. a mechanical/artificial humanoid. C. a robot which has biological components. D. a mobile robot. (b) (2 points) Modern computers are digital. This means that: A. their data must be human readable. B. they store all data in binary format. C. they must contain memory. D. they have no moving parts. E. they must be programmed in natural languages. (c) (2 points) A language which must be compiled or interpreted into a form the computer can run is called: A. a high-level language. B. a machine language. C. a natural language. D. an assembly language. (d) (2 points) The word robot was originally coined by: A. the Czech playwright, Karel Capek. B. the ancient Greek inventor, Archtas of Tarentum. C. the French automaton maker, Jacques de Vaucanson. D. Hisashige Tanaka, who was known as Japan s Edison. (e) (2 points) The first autonomous electronic robot which could sense and respond to its environment was: A. Televox. B. the tortoises, Elmer and Elsie. C. Unimate. D. Elektro (f) (2 points) The 2005 DARPA Grand Challenge was won by successfully completed the 7.36 mile course without human intervention. A. Sandstorm B. Highlander C. Stanley D. TerraMax which 2

2. Find the Errors. All of the example programs below have errors. Identify the error and explain why it is an error or how you would fix it. (a) (3 points) def area: return a print "Area of a three foot circle " + area(3) Solution: incorrect function definition. should be def area(radius): (b) (3 points) def area(radius): return a print "Area of a three foot circle " + area(3) Solution: no indentation for statements in function. (c) (3 points) def area(radius): return a print "Area of a three foot circle " + area() Solution: no argument given when call to area() is made in print statement. Needs to have a value for the argument such as area(3), area(6.2), etc. (d) (3 points) def area(radius): return a area(3) print "Area of a three foot circle " + a Solution: a is a local variable and is only defined inside the function. Need to assign a a value in the main body of the program. Ex: a = area(3) (e) (3 points) 3

def area(radius): print "Area of a three foot circle " + area(3) Solution: no return statement from function. Will cause program to only print Area of a three foot circle with no result. 4

3. (6 points) What are comments in the context of programming in Python? Why would you include comments in your code? Solution: Comments are lines in the program which begin with a #. They are not executed like normal program statements. You use them to make your code more readable and to explain your intentions when writing the code. 4. (6 points) Why do the Mars rovers, Spirit and Opportunity, have the ability to operate autonomously? Why don t we remotely control/drive them from Earth? Solution: Takes a long time for commands/programs/data to travel back and forth between Earth and Mars. On order of 15-30 minutes. Human perception of state of robot is particularly bad with a time delay. 5. (8 points) Explain the difference between syntax errors and semantic errors in programming. Give an example of each. Solution: syntax errors: rules that must be followed in programming: mistakes in spelling, indentation, etc. Ex: print bob only works if there is a variable named bob. It will not print the string "bob". semantic errors: mistakes in logic. Program will run, but doesn t do what you wanted it to. Ex: expecting the mod operator to give a percentage instead of the remainder. Ex: expecting 2^3 to be 8 (correct power operator is **) 5

6. (9 points) List three tasks that a robot might be particularly suited to do in space and what makes them suited better suited for it than a human. Solution: Answer varies. Must make connection to space. For example collecting data is something that robots do equally well on Earth or in space. Good answers would be things like mining other planets for minerals, performing pre-arrival tasks for space colonization, exploring other planets/moons, etc. Reasons include that robots are rugged, expendable, have no biological processes, cheaper, etc. 6

7. Definitions. Define the following terms and give an example of each from the robots you have seen, read about, or encountered during this course. (a) (3 points) Robot Solution: any (partly) autonomous mechanical machine which takes over human tasks in place of (or in conjunction with) a human. Examples: Stanley, Spirit, Opportunity, Topio, etc. (b) (3 points) Sensor Solution: sensors: any device which allows the robot to gather data about the state of the robot or the environment around the robot. Examples: cameras, IR sensors, light sensors, pressure sensors, etc. (c) (3 points) Effector Solution: effectors: what the robot uses to effect or manipulate the world around it. Examples would be pincers, wheels, arms, etc. (d) (3 points) Actuator Solution: actuators: mechanism which enables effector to execute actions. Examples would be gears, hydraulic or pneumatic cylinders, motors, etc. 7

8. Interpreter. Pretend you are the Python interpreter and evaluate the following mathematical expressions. Pay attention to the data types. (a) (2 points) >>> 7.0 / 14 (b) (2 points) >>> 7 / 14 (c) (2 points) >>> 7 % 14 (d) (2 points) >>> 21 / 6 (e) (2 points) >>> 21 % 6 (f) (2 points) "a"*5 (a).5 (b) 0 (c) 7 (d) 3 (e) 3 (g) (2 points) "b" + "a" + "d" (f) (g) aaaaa bad 8

9. Code Writing. For each problem, write the correct Python code. (a) (7 points) Write a function called stickstotbsp which takes a parameter representing the number of sticks of butter and returns the number of tablespoons of butter. One stick of butter is equivalent to 8 Tbsp, so stickstotbsp(1) should return 8 and stickstotbsp(1.5) should return 12. Solution: def stickstotbsp(sticks): tbsp = sticks * 8.0 return tbsp +2 function definition +1 correct parameter use +2 correct calculation of tbsp +1 return statement +1 correct value returned (b) (11 points) Write a composite function called gramstotbsp which takes a parameter representing the number of grams of butter and returns the number of tablespoons. There are 113.4 grams in one stick of butter. This function should call the function you wrote in part (a). You may assume the function from part (a) works correctly and as described. Solution: def gramstotbsp(grams): sticks = grams/113.4 tbsp = stickstotbsp(sticks) return tbsp +2 function definition +1 correct parameter use +2 correct calculation of num. sticks +2 correct call to stickstotbsp funct. with result used +1 correct parameter to stickstotbsp funct. +1 return statement +2 correct value returned 9