CS 1803 Fall 2010 Exam 1

Similar documents
CS 1803 Fall 2010 Exam 1

CS 1301 Exam 1 Fall 2010

CS 1301 Exam 1 Fall 2010

CS 1301 Exam 1 Fall 2011

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

Exam Percentage: / 55 = %

CS 1301 Exam 1 Spring 2011

CS 2316 Exam 1 Spring 2013

CS 1301 Exam 1 Spring 2014

CS 2316 Exam 4 Fall 2011

CS 1301 Exam 2 Fall 2014

CS 1301 Exam 1 Fall 2014

CS 2316 Exam 1 Spring 2014

CS 1301 Exam 3 Spring 2014

CS 1301 Exam 1 Fall 2014

CS 1301 Exam 3 Fall 2014

CS 2316 Exam 4 Fall 2012

CS Name : Grading TA:

CS 1301 Exam 2 A Fall 2015

CS 1301 Exam 1 Spring 2014

CS 1301 Exam 1 Fall 2013

CS 1301 Exam 2 Fall 2013

CS 1301 Exam 1 Fall 2013

CS Exam 2 - Spring 2010

CS 1301 Exam 2 Fall 2010

CS 1301 Exam 3 Spring 2012

CS 1301 Exam 2 A Fall 2015

CS 2316 Exam 4 Fall 2011

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

CS 1301 Exam 1 Spring 2015

CS 2316 Exam 3 Fall 2011

CS 2316 Exam 3 Spring 2013

CS 2316 Exam 4 Fall 2012

CS 2316 Exam 4 Spring 2013

CS Exam 3 - Spring 2010

CS 1301 Exam 2 Spring 2014

CS 1301 Post Exam 3 Practice Spring 2016

CS Exam 3 - Spring 2010

CS 2316 Exam 2 Summer 2011

CS 2316 Exam 4 Fall 2014

CS 1301 Exam 3 A Spring 2015

CS 2316 Exam 3 Fall 2012

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

Question: Total Points: Score:

CS 2316 Exam 4 Spring 2012

CS 1301 Exam 3 Fall 2010

CS 2316 Exam 3 Summer 2014

CS 190 Exam 2 Fall 2014

CS 1301 Exam 1 Answers Fall 2009

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

CS 1301 Exam 1 Fall 2009

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

CS 110 Exam 2 Spring 2011

Question: Total Points: Score:

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

Question: Total Points: Score:

Instructor: Yu Wang 11/16/2012

Question: Total Points: Score:

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 170 Exam 2. Version: A Spring Name (as in OPUS) (print): Instructions:

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

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

CS 111X - Fall Test 1

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

CS 190 Exam 1 Fall 2010

Question: Total Points: Score:

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

Question: Total Points: Score:

Question: Total Points: Score:

Question: Total Points: Score:

CS 155 Exam 2 Spring 2015

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

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

Question: Total Points: Score:

Place your name tag here

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

Question: Total Points: Score:

Question: Total Points: Score:

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

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

Question: Total Points: Score:

Question: Total Points: Score:

CS 1316 Exam 1 Summer 2009

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

Question: Total Points: Score:

CS 1322 Test 2 - Version 1 Tuesday June 24 th

Spring 2017 CS 1110/1111 Exam 1

CS 110 Exam 2 Fall 2011

CSE 131 Introduction to Computer Science Fall Exam I

CS 111X - Spring Final Exam - KEY

CSE 131 Introduction to Computer Science Fall Exam I

Part 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points)

CS170 (005): Introduction to Computer Science Exam 2

: Intro Programming for Scientists and Engineers Final Exam

CSE 131 Introduction to Computer Science Fall 2016 Exam I. Print clearly the following information:

LAB 4.1 Relational Operators and the if Statement

Reviewing all Topics this term

All program statements you write should be syntactically correct. Partial credit is not guaranteed with incorrect use of syntax.

CS 1316 Exam 2 Summer 2009

CSE 131 Introduction to Computer Science Fall Exam I

Transcription:

CS 1803 Fall 2010 Exam 1 Name: Your Grading TA: Your Section : 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 Academic Honor Code of Georgia Tech. Do NOT sign nor take this exam if you do not agree with the honor code. DEVICES: If your cell phone, pager, PDA, beeper, ipod, or similar item goes off during the exam, you will lose 10 points on this exam. Turn all such devices off and put them away now. You cannot have them on your desk. ACADEMIC MISCONDUCT will not be tolerated. You are to uphold the honor and integrity bestowed upon you by the Georgia Institute of Technology. a) Keep your eyes on your own paper. b) Do your best to prevent anyone else from seeing your work. c) Do NOT communicate with anyone other than a proctor for ANY reason in ANY language in ANY manner. d) Do NOT share ANYTHING during the exam. (This includes no sharing of pencils, paper, erasers). e) Follow directions given by the proctor(s). f) Stop all writing when told to stop. Failure to stop writing on this exam when told to do so is academic misconduct. g) Do not use notes, books, calculators, etc during the exam. I commit to uphold the ideals of honor and integrity by refusing to betray the trust bestowed upon me as a member of the Georgia Tech community. Signature: Question Possible Points Earned Points Graded By 1 True / False 5 2 Multiple Choice 20 3 Code Reading 20 4 - amountpaid 25 5 getrange 30 Total 100 1

Question 1: True/False - Circle the correct answer! 5 points T / F try/except statements work the same as if/else statements. T / F You can assign the result of a print function call to a variable using an assignment statement. E.g.: myvar = print( Hey! ) T / F What you put in the parenthesis of a function, myfunction(this), is called the input. T / F If you have two if statements, such as: if(x<5): dosomething() if(x>5): dosomethingelse() both function calls will always run. T / F If you have an if statement, such as: if(x<5): dosomething() else: dosomethingelse() the dosomethingelse() function will always run. Question 2: Multiple Choice / Fill in the Blank 20 points A. What is a way to change the string nbalegend = "Larry Bird" to say Harry Bird a) nbalegend[1] = "H" b) nbalegend[0] = "H" c) nbalegend = "H" + nbalegend[1:] d) none of the above B. Which of the following statements about functions is true? a) All a function needs is a header to be a valid function b) A function can be defined in another function c) Once you write and debug a function, you can reuse it d) Only A e) B and C f) A, B and C C. Which of the following is a valid line of code to open a file that you want to read? a) f.open( filename.txt, read ) b) f.open( filename.txt, r ) c) f = open( filename.txt, r ) d) f = open( filename.txt, w ) 2

D. Which of these does not require parenthesis? a).strip b) print c) print d) return e) int E. The code contained in an if statement is called what? a. Group b. Block c. Section d. Lines F. Infinite recursion is often caused by an incorrect or lack of a(n) : a) Recursive call b) Terminating condition c) Iterator d) Global counter variable Questions G-J will fill in the blanks for the following code: def classstanding (hours): status = if G <= 29: H = Freshman I : H = Not a Freshman ans = My status is, + status J ans standing = classstanding(56) Choose the BEST choice to make the code valid G. The value of space G should be a) try b) status c) else d) hours H. The value of the spaces marked H should be a) year b) hours 3

c) status d) grade I. The value of space I should be a) else b) next c) elif d) except J. The value of space J should be a) print b) then c) 29 d) return Question 3: Code Reading 20 points A. Look at the code below- what is the value stored in result? myinput = [3,7,1,8,6] def somefunc(funcinput): myval = 5 for item in funcinput: myval = myval + item x= int(len(funcinput)) result = myval / x return (result) result = somefunc(myinput) B. Does this code run? If so, what is printed on the screen and what is the type of output? def doesthiswork(string,i = 12): for x in string: i = i + 2 return ( print(i) ) return i output = doesthiswork("cs 1803 is fun!") type(output) 4

C. What is printed when this code is run? def whatdoido(num4, num2 = 0.1): num1 = [1.0,"hi",'rawr'] num3 = num1 if(num4 == "bye" or "cya"): num3[0] = num2 else: num1[2] = num4 return num1 x = whatdoido("hello",15) print(x) D. What would the value of the retvalue variable be after this code is run? morenums= [3,2.99,12.01,12,2,9] def blank(num_list): variable = num_list[0] while type(variable) == type([]): variable = variable[0] for element in num_list: if type(element) == type([]): variable2 = blank(element) if variable < variable2: variable = variable2 variable = float(variable) else: if variable < element: variable = element variable = int(variable) return variable retvalue = blank(morenums) 5

Question 4: Code Writing amountpaid 25 points Write a function called amountpaid() Prompt the user to enter the pay rate and the number of hours worked. If the user worked more than 40 hours, their overtime rate of pay is time and a half (1.5 x the normal pay rate) and only applies to the extra hours (over 40) that were worked. The function should generate and return a string telling how much the person is to be paid: "Your amount paid is: $67.50 " You may assume that the user will only type correct floating point numbers, so no error checking is needed. The returned string must use string formatting to place the number immediately after the dolar sign, and the dollar amount must be rounded to exactly two decimal places. Parameters: none Return: A string stating the amount of pay 6

Question 5: Code Writing getrange 30 points Write a function that meets the following specifications: Name: getrange Parameters: a list of items, some of which are integers and floats (you may not assume that all list elements are numbers!) Return: the difference between the largest and smallest numbers in the list as a floating point value E.g: if the input list is [10,7, Bob,23,21,3,8] the range would be 20.0 (23-3) 7