Intro to Computing
Intro to Computing CS 1301
Popular in Course
Popular in ComputerScienence
This 0 page Class Notes was uploaded by Alayna Veum on Monday November 2, 2015. The Class Notes belongs to CS 1301 at Georgia Institute of Technology - Main Campus taught by Staff in Fall. Since its upload, it has received 20 views. For similar materials see /class/234129/cs-1301-georgia-institute-of-technology-main-campus in ComputerScienence at Georgia Institute of Technology - Main Campus.
Reviews for Intro to Computing
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 11/02/15
1 to 9 F tracing for i in range2 for j in range3 print i j What is printed 10 points ObjectOriented Pythoni Write a class called Dog that has a a constructor b a str method The constructor is to take a breed gender and name in that order as string parameters and store them as a elds called breed gender and name The str method is to return a string structured like this one 77German Shepherd male named Spot77 given the breed is German Shepherd gender is male and name is Spoti Be sure to name both the constructor and str methods correctly 5 points 00 error correction Given correct implementations of the Dog class nd and correct the errors in the following code segment that is in your main programi No def or class header is required Each line has one error myDog new Dogquotma1equot quotWolfiequot print string myDog 10 points Matching Place the number of the term that best ts the question subpartsi Choices can be used once more than once or not at all 1 1 7 In 00 programming if you see the line myCard CardC Ace 7 77Hearts Card is actually a call to What 7 This is like a blueprint for objects in objectoriented programming One Writes this as the model for a given concept like Card Deck Student Friend 7 When you store data for an actual instance using a class you create one of these For example you are storing a particular Card a particular Friend etc 7 If you want to get a meaningful string representation of an object then you should provide this method in your class Functions in objectoriented programming go by this name instead 5i 533 5 9 5 points Big 0 Matching Place the number of the term that best ts the question subpartsi Choices can be used once more than once or not at all What is the Big O of sequential search a 7 b 7 What is the Big 0 of binary search e d e 7 7 What is the Big O of bubblesort What is the Big O of selection sort What is the Big O of quicksort 5 points rnap reduce lter list cornprehensionsi X for X in nurns if X gt 0 What does that list comprehension do 5 points rnap reduce lteri answers rnaprnathisqrt 100 9 49 What does that call to map create 5 points Exception Handling The following code will result in a IOError in Python when the le is not found Write a tryeXcept block around the lines as given Your tryeXcept should be written so that if the IOError occurs the program does not crash but prints 77That le was not found77 instead import os file openquotUserb1ahtxtquot quotrquot def goofy x try ans 10x print quotThe answer isquot ans except ZeroDivisionError print quotSorry cannot divide by zeroquot except TypeError print quotSorry there was a type issuequot finally print quotThe Endquot What is printed when for each of the following goofyltogt goofya goofy 77 Mickey Page 2
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'